Way to configure location of worktrees

Open 💬 15 comments Opened Feb 4, 2026 by adnanjpg

What version of the Codex App are you using (From “About Codex” dialog)?

Version 260203.1501 (523)

What subscription do you have?

ChatGPT Plus

What issue are you seeing?

In the Codex macOS app, when I use the UI flow to create a Git worktree, Codex always creates the worktree under a fixed default location:

/Users/{myuser}/.codex/worktrees/{worktreeid}/{MyProject}

There is no setting or UI option to choose/configure where the worktree should be created.

This is a major issue for workflows where the repo lives on an external/remote-mounted drive (e.g. SMB mounted volume). In my case, the repo lives here:

/Volumes/home/{MyProject}

Since the project is large and needs to run from the mounted volume, worktrees should ideally be created in the same volume (or at least a user-configurable directory). Instead, the worktree gets placed on the local machine under ~/.codex/worktrees/, which breaks the workflow.

What steps can reproduce the bug?

On macOS, open the Codex macOS app.

Open/import a Git repo located on a mounted volume, e.g.:

/Volumes/home/{MyProject}

In Codex, use the UI worktree creation flow to create a new worktree.

Observe that Codex creates the worktree in:

/Users/{myuser}/.codex/worktrees/{worktreeid}/{MyProject}

Confirm there is no setting to configure the worktree root/destination directory.

This occurs 100% of the time.

What is the expected behavior?

Codex should allow configuring the worktree destination directory / worktree root directory, e.g.:

Let the user choose a worktree root directory in Settings (global), and/or

Let the user choose the location during worktree creation (per-worktree)

For example, I should be able to configure worktrees to be created next to the repo on the mounted drive:

/Volumes/home/worktrees/...

Bonus:

  1. configure default paths per project
  2. default to placing worktrees near the repo if the repo is located on a mounted volume.

Additional information

_No response_

View original on GitHub ↗

15 Comments

gmetzker-4c · 5 months ago

Agreed this would be nice. I'm running into tooling issues when the parent directory is under a "dot" path. Would be nice to be able to pick your own path.

https://github.com/facebook/pyrefly/issues/2402

iamsenseiken · 4 months ago

This is a significant problem.

itsadrianxv · 3 months ago

This is a significant problem not yet solved.

birtles · 3 months ago

Having this would also provide a workaround for #13762

richardwhatever · 3 months ago

come on guys. WSL users are a big and growing market.

datalogics-kam · 3 months ago

Codex should be following a standard like the XDG Base Directory Specification, and especially not mixing config and source code in the same directory root. If anything worktrees should go in a cache directory. It was really surprising to find that an automation to summarize work daily was copying source code outside of the source code work area without asking.

Ref: https://specifications.freedesktop.org/basedir/latest/

diogovalada · 3 months ago

I have the same issue...
Should be possible to place the worktrees folder in places like:
../<repo-folder-name>.worktrees

kevinhorst · 3 months ago

Same issue here, I am getting frustrated trying to use Codex with worktrees.

As it is scoped to the sandbox environment, it is unable to commit by default, running into permission issues.

This completely breaks my workflow

MichaReiser · 2 months ago

A workaround for this feature is to create a symlink from ~/.codex/worktrees to your desired location. However, that's not a very obvious solution.

Another motivation for this feature is that companies sometimes have specific directories that are excluded (or have less aggressive) antivirus scanning. Being able to move the worktrees into that directories can significantly help with performance (and battery life)

pessini · 1 month ago

+1 Would be great to have this.

frankie325 · 1 month ago

+1 it is significant to custom directory for worktrees

hyperlolo · 1 month ago

+1 absolutely need this especially for wsl environment, the default directory when set to work with wsl causes the agents to slow down by around 3-5x. Tested by using the same repo and sending the same simple prompt of checking git status for the repo on the app and in wsl terminal.

Terminal finished in 1min 34 seconds. App finished in 7minutes 8 seconds.
This makes the app useless if you want to work safely using worktrees

brendan-m-murphy · 1 month ago

Setting the env var $CODEX_HOME will at least change the root where worktrees are created. I cannot stop codex from creating remote worktrees, which is also annoying.

invoker-bot · 2 days ago

+1, we need this feature.

kevinhorst · 1 day ago

Come on codex. Poke
+1, still necessary