Can each agent work in its own git worktree?
A git worktree for each thread
Yes. Pick New worktree when you start a thread, and Trek makes a checkout of its own for it on a new branch. Threads in worktrees of their own don’t edit each other’s files. Everything after that, from review to merge, happens in the same thread.
Start a thread in a worktree
On a new thread in a Git project, the composer has a chip that reads Local. Click it, and the menu New thread runs in offers two places.
- Local, the project folder.
- New worktree, a branch of its own.

Pick New worktree and send. Beside the chip, Trek shows which branch the worktree will start from. The choice is fixed once the thread starts.
To make worktrees the default for a project, open Project Settings and set Runs in, under New threads, to New worktree. If another thread is already editing the folder you’re in, the composer says Another thread is also editing this folder, with Use a worktree next time. That opens a new thread set to New worktree.
Where it goes, and its branch
Trek runs git worktree add for you and puts the folder in its own data folder, under worktrees/<repository>/<name>. On a Mac that is in ~/Library/Application Support/dev.trek.Trek, on Windows in %APPDATA%\trek\Trek\data, and on Linux in ~/.local/share/trek. Your repository gets no new folders.
The branch is trek/ plus the first words of your first message, such as trek/fix-the-login-redirect. It starts from the branch your project folder is on, not from the default branch. The thread’s row in the sidebar shows the branch name, without trek/.
The thread runs there with whichever agent you picked. Claude Code in one thread and Codex in another each get their own folder. A thread you fork from it, and its sub-agents, work in the same worktree.
Your .env files come along
A fresh checkout has no ignored files, so Trek copies .env and .env.local into each new worktree. It copies a file only if it exists in the project folder and git ignores it.
Change the list in Project Settings, under New threads, Copy into new worktrees. Separate entries with commas. A folder name works and is copied whole. Globs don’t.
That is all Trek does when it makes a worktree. It doesn’t install dependencies and doesn’t assign ports. Orca, Emdash Classic and Conductor run a setup script for each new worktree, as the ranking shows. In Trek, a project’s Actions, in the title bar’s Run menu, run in the worktree of the thread you’re in, so an install step or a dev server on another port can be an Action. The worktree guide covers ports and the other things that break.
Review, commit and merge
Open the right panel and choose Git. In a worktree thread it shows everything the branch changed against its base: commits, staged, unstaged and untracked files. Under it, in this order:
- A commit message, with Write a message from the changes when Claude Code is installed.
- Commit all.
- Push, to
origin. - Create pull request, which pushes and runs the GitHub CLI. It needs
ghsigned in and a GitHub remote. - Merge into main, or whatever your base branch is called. It merges on your computer, in the project folder. Trek refuses, with the reason, unless the project folder is on the base branch and clean and the worktree has nothing uncommitted. A merge with conflicts is stopped and the files are listed.
When the agent in a thread runs gh pr create, gh pr checks or gh pr merge, Trek shows a card that follows that pull request: its merge state, checks and conflicts, refreshed from the GitHub CLI while the card is open. The card’s Merge merges the pull request on GitHub. Merge into main in the Git tool merges on your computer.

Removing a worktree
Trek never removes a worktree by itself, not on merge and not when a pull request closes. You remove one in one of three ways, and each asks first.
- Remove worktree… in the Git tool. The dialog lists what would be lost: the number of uncommitted changes, and whether the branch has commits the base doesn’t. If it has none, the branch goes too. If it has some, you choose Remove, keep branch or Remove with branch.
- Archive thread… in the thread’s menu, with Archive, keep worktree or Archive and remove it.
- Delete… in the thread’s menu. The worktree goes with the thread, and a branch with unmerged commits is kept.
If the agent wrote more changes after you said yes, Trek removes nothing and tells you the new count. A worktree folder you deleted by hand shows as Worktree missing, with Recreate from branch and Run in project folder.
Worktrees from other apps
If Conductor, T3 Code or Orca left worktrees on your computer, Settings › Import Threads shows a section for them. Review… lists what would come across, and Bring over adds them as projects and threads, with their Claude Code, Codex and OpenCode sessions. Trek leaves those worktrees where they are and never removes them.
Platforms
Worktrees work the same on macOS, Windows and Linux. They need git, and pull requests need the GitHub CLI. Trek sets no limit on worktrees per project.
Questions
Can any Git project use a worktree?
It needs at least one commit, and the project folder must be on a branch. With no commits, or on a detached HEAD, Trek says so and makes no worktree.
Does the worktree get my uncommitted changes?
No. It starts from the last commit on the branch your project folder is on. Only the ignored files on the copy list come across.
What if a branch with that name exists?
Trek adds a number, such as trek/fix-the-login-redirect-2. The name takes up to six words of your first message, in at most 32 characters after trek/, then the number if one is needed.
Will removing a worktree delete my branch?
Only if the branch has nothing its base branch doesn’t, or if you choose Remove with branch. Archiving or deleting a thread never deletes a branch with unmerged commits.