Is there a desktop app that runs Claude Code, Codex and other agents in parallel git worktrees, and copies my .env files in?
Run Claude Code, Codex and more in parallel git worktrees
Trek is a free, open-source desktop app for macOS, Windows and Linux (a preview) that runs Claude Code, Codex, OpenCode and other coding agents side by side in one window. Choose New worktree on a thread and Trek makes a git worktree on a new trek/ branch, copies your git-ignored .env and .env.local into it and starts the agent there. You review, commit, push, open a pull request or merge from the same thread. Trek doesn’t run a setup script or hand out ports by itself. Conductor (on a Mac or in its paid cloud) and Pane do both, the Codex app runs a setup script, and claude --worktree covers Claude Code alone. All four are compared below, and fifteen apps are ranked in a separate guide.
Run agents in parallel worktrees with Trek
Each thread in Trek has its own agent and model. Give each one a worktree, and Claude Code on one bug and Codex on another never touch each other’s files.
- Install Trek, choose Add project in the sidebar and pick your repository’s folder. It needs at least one commit, and the folder must be on a branch.
- Start a new thread and pick its agent, such as Claude Code, and the model.
- In the composer, click the chip that reads Local and choose New worktree. Beside it, Trek shows the branch the worktree will start from.
- Type the task and send. Trek runs
git worktree addon a newtrek/branch named from your first words, copies your ignored.envfiles in and starts the agent in that folder. - Start another thread, pick Codex or any other agent, choose New worktree again and send. Each thread now edits its own folder on its own branch.
- When a thread is done, open Git in the right panel. It lists what the branch changed against its base. Commit, push, create a pull request, or merge into the base branch on your computer.

To make New worktree the default for a project, open Project Settings and set Runs in, under New threads, to New worktree. Every thread sits in one sidebar with its branch name. A thread that stops for an approval or a question goes to the top of the Inbox, whichever agent it runs.
What Trek does when it makes a worktree
- It runs
git worktree addon a new branch,trek/plus up to six words of your first message, such astrek/fix-the-login-redirect. If that name is taken, it adds a number. - The branch starts from the branch your project folder is on, not from the default branch.
- The folder goes in Trek’s data folder, under
worktrees/<repository>/<name>. On a Mac that is~/Library/Application Support/dev.trek.Trek, on Windows%APPDATA%\trek\Trek\dataand on Linux~/.local/share/trek. Your repository gets no new folder to ignore. - It copies the files on the project’s copy list,
.envand.env.localunless you change it, when they exist in the project folder and git ignores them. A file git doesn’t ignore is left out. Commit the.gitignorerule that covers them, because the worktree starts from the last commit, and with an uncommitted rule the copies show up there as new files. - It doesn’t install dependencies, run a setup script or give the worktree its own port. The next section shows how to add those.
- It never removes a worktree by itself. Remove worktree… first says how many uncommitted changes would be lost and whether the branch has commits its base doesn’t. Ignored files, such as a copied
.env, aren’t counted and go with the folder. - Merge into the base branch happens on your computer, and only when the project folder is on that branch with no uncommitted changes. A merge that conflicts is undone and the files are named.
Copy .env files and run a setup script in each worktree
A new worktree holds only what is committed. Ignored files such as .env, .env.local or a local certificate don’t come along, and neither do node_modules or a virtual environment. Without them most apps won’t start. With git alone, copy them yourself, as in cp .env .env.local ../myapp-login/. Each tool below does it its own way.
In Trek
Trek copies the files on the project’s list. Change it in Project Settings, under New threads, Copy into new worktrees. Entries are files or folders, separated by commas.
For a step you run now and then, such as an install or a dev server, add an Action in Project Settings. Pick it from the Run row of the Overview in the title bar, and it runs in the worktree of the thread you’re in.
For a step that should run every time, use a git post-checkout hook. Trek makes worktrees with plain git worktree add, so git runs the hook inside each new worktree, as it does for any tool that uses that command. For a new worktree, its first argument is all zeros (40 of them, or 64 in a SHA-256 repository). This one copies the .env files from the main checkout.
#!/bin/sh
# .git/hooks/post-checkout (make it executable with chmod +x)
# Runs after every checkout. "$1" is all zeros for a new worktree.
case "$1" in *[!0]*) exit 0 ;; esac
main="$(git worktree list --porcelain | sed -n '1s/^worktree //p')"
for f in .env .env.local; do
[ -f "$main/$f" ] && [ ! -e "$f" ] && cp "$main/$f" "$f"
done
# Install dependencies here, for example: npm ci
exit 0
One hook serves every worktree, since they share the repository’s hooks folder (or the folder core.hooksPath names). It runs before Trek copies its own list, and the thread’s first message waits until the hook ends, an install included. End it with exit 0. If the hook fails, git worktree add reports a failure even though the folder was made, and Trek shows Couldn’t create the worktree instead of starting the thread.
Two dev servers in two worktrees will also want the same port. Start each on its own port with the server’s own option, such as next dev -p 4001 or vite --port 4001, from an Action. Some servers read PORT from .env, but Next.js doesn’t. The worktree guide covers the rest of what breaks.
In Conductor
Conductor copies gitignored files from your main checkout into each new local workspace. It takes the patterns from .worktreeinclude if the repository has one, otherwise from the repository’s Files to copy setting, otherwise .env*. A file that git doesn’t ignore is never copied.
Its setup and archive scripts are saved in each person’s Conductor settings, not in the repository, and run from the workspace folder. A setup script reaches the main checkout through CONDUCTOR_ROOT_PATH.
cp "$CONDUCTOR_ROOT_PATH/.env" .env
npm install
Each workspace gets 10 ports, starting at CONDUCTOR_PORT. New workspaces start from the repository’s base branch, such as origin/main.
In Claude Code and Codex
claude -w fix-login (or --worktree) starts Claude Code in .claude/worktrees/fix-login on a new branch, worktree-fix-login, from the remote’s default branch. It copies the ignored files that a .worktreeinclude file at the repository root names, written like .gitignore.
# .worktreeinclude
.env
.env.local
To branch from where you are instead, set worktree.baseRef to "head" in Claude Code’s settings. A WorktreeCreate hook replaces how Claude Code makes the worktree, and then .worktreeinclude isn’t read, so the hook copies the files itself.
In Codex, codex exec --worktree "…" or /worktree in a session runs in a managed worktree, and the Codex app has a Worktree option under the composer. The Codex app reads the same .worktreeinclude for the worktrees it manages, and runs a local environment’s setup script, kept in the .codex folder, when it makes one. The docs give that copying only for worktrees the app manages, so with the CLI, copy the files yourself or use the hook above.
In Pane
Pane copies .env* files, agent folders such as .claude, and node_modules into each new worktree by default. The list is under Settings, Worktrees & Git. It runs the setup script from its Project Settings, otherwise from the first of pane.json, conductor.json, .gitpod.yml or .devcontainer/devcontainer.json that has one. Each pane gets 10 ports, starting at PANE_PORT.
Trek, Conductor, Pane and claude --worktree compared
Facts about the other three come from their own docs, checked on 5 December 2026 and listed under Sources. Conductor’s site now reads Conductor from Meta. Its November plan to wind down was withdrawn on 13 November, and new releases have come out since.
| Trek | Conductor | Pane | claude --worktree | |
|---|---|---|---|---|
| What it is | Desktop app | Desktop app | Desktop app | A flag of the Claude Code CLI |
| Runs on | macOS 13 or later, Windows 11 x64, Linux (preview) | macOS, and cloud workspaces on paid plans | macOS, Windows, Linux | Wherever Claude Code runs |
| Agents | Claude Code, Codex, OpenCode, Droid, Cursor, GitHub Copilot, other ACP agents, API and local models | Claude Code, Codex, Cursor, OpenCode, Muse Code and Antigravity | Claude Code, Codex and other CLI agents | Claude Code |
| Where the worktree goes | Trek’s data folder, on a trek/ branch off your current branch | ~/conductor/workspaces/<repo>/<name> by default, on a new branch off the base branch | <repo>/worktrees/<name> by default, on a branch per pane | .claude/worktrees/<name>, branch worktree-<name>, off the remote’s default branch |
| Ignored files copied | .env and .env.local by default, list in Project Settings | .worktreeinclude if present, else its Files to copy setting, else .env* | .env*, agent folders and node_modules by default | Those .worktreeinclude names |
| Setup script | No. Use an Action or a post-checkout hook | Yes, saved in its settings, plus an archive script | Yes, in its settings or pane.json, and it reads conductor.json | No. A WorktreeCreate hook can replace how it makes one |
| Ports per worktree | No | 10, starting at CONDUCTOR_PORT | 10, starting at PANE_PORT | No |
| Cleanup | Never by itself. Asks first, with the count of uncommitted changes and unmerged commits. Ignored files aren’t counted | Archiving saves the git state, uncommitted files included, and History restores it. Your archive script runs first | Archiving removes the worktree, uncommitted changes included. The branch stays, and Restore makes it again | On exit, an unnamed session’s clean worktree goes. A named one, or one with changes, asks first. Ignored files don’t count as changes |
| Licence and price | Apache-2.0, free | Proprietary. Free today, cloud workspaces need a Pro, Teams or Enterprise plan | AGPL-3.0 with an attribution term, free | Part of Claude Code |
Which one to pick
- If you only use Claude Code, start with
claude -wand a.worktreeincludefile. If you only use Codex, use the Codex app’s Worktree option, which reads the same file. - If every worktree needs a setup script and its own ports, Conductor does both on a Mac, and Pane does both on macOS, Windows and Linux.
- If you want worktree threads on macOS, Windows and Linux under Apache-2.0, with a model from an API key or a local one such as Ollama beside Claude Code and Codex, and an app that checks a merge before it makes it and never deletes a worktree on its own, use Trek.
Eleven other apps and four terminal tools are in the full worktree guide and the ranking of apps that run several agents.
Moving from Conductor to Trek
Open Settings › Import Threads. If Conductor left workspaces on your computer, a section lists them. Review… shows what would come across, and Bring over adds each repository as a project and each workspace as a thread, with its Claude Code, Codex or OpenCode session.
The worktrees stay where Conductor put them, on their branches, and Conductor keeps working with them. Trek never removes them. Setup scripts don’t come across, so make yours a post-checkout hook or an Action, as above.
Questions
Does Trek copy .env files into new worktrees?
Yes. By default it copies .env and .env.local from the project folder into each new worktree, if they exist there and git ignores them. Change the list in Project Settings, under New threads, Copy into new worktrees. Entries are files or folders, separated by commas. Globs don’t work.
Can Trek run a setup script when it makes a worktree?
Not by itself. Two things work. A project Action, such as npm install, runs in the worktree of the thread you’re in when you pick it from the Run row of the title bar’s Overview. Or a git post-checkout hook runs on its own, because Trek makes each worktree with plain git worktree add.
Can Claude Code and Codex work on the same repository at the same time?
Yes. Give each thread its own worktree. Each gets its own folder and branch, and both share one git history, so a commit on one branch can be merged into the other’s at once.
Does Trek use claude --worktree?
No. Trek makes the worktree with git and starts the agent’s own CLI inside it, so it works the same for Claude Code, Codex, OpenCode and the rest. It turns off Claude Code’s own tools for moving a session into another worktree, so a thread stays in the folder Trek gave it.
Can I bring my Conductor worktrees into Trek?
Yes. Settings › Import Threads lists the worktrees Conductor, T3 Code or Orca left on your computer, and Bring over adds them as projects and threads with their Claude Code, Codex and OpenCode sessions. Trek leaves them where they are, never removes them, and the other app keeps working. Setup scripts don’t come across.
Is there a Conductor alternative for Windows or Linux?
Trek and Pane both run agents in git worktrees on macOS, Windows and Linux, and both are free and open source, Trek under Apache-2.0 and Pane under AGPL-3.0. Trek’s Linux build is a preview. Emdash Classic, Orca and T3 Code also run on Windows. The ranking compares them.
Does Trek give each worktree its own port?
No. Two dev servers in two worktrees will want the same port. Make an Action that starts the server with its own port option, such as next dev -p 4001. Some servers read PORT from .env, but Next.js doesn’t.
Is Trek free?
Yes. It is free and open source under Apache-2.0, with no account. It runs on macOS 13 or later (the build isn’t notarized yet), Windows 11 x64 and Linux, which is a preview.
Sources
- Trek’s worktree code (crates/trek-core/src/worktree.rs)
- Making a thread’s worktree (crates/trek-app/src/workspace/worktrees.rs)
- Worktrees from other apps (crates/trek-core/src/import/worktree_apps.rs)
- git worktree, Git documentation
- githooks, post-checkout, Git documentation
- Worktrees, Claude Code docs
- CLI reference, Claude Code docs
- Hooks, Claude Code docs
- Git worktrees, Codex docs
- Local environments, Codex docs
- Command line reference, Codex docs
- Git worktrees, Conductor docs
- Files to copy, Conductor docs
- Configure your project, Conductor docs
- Environment variables, Conductor docs
- Installation, Conductor docs
- Scripts, Conductor docs
- Workspaces and branches, Conductor docs
- Terms, Conductor
- Changelog, Conductor
- Pane
- Panes and worktrees, Pane docs
- Configuration, Pane docs
- Environment variables, Pane docs
- Pane licence
- Pricing, Pane
- Pane on GitHub
- FAQ, Conductor docs
- Cloud FAQ, Conductor docs
- 0.33.5, Better archiving, Conductor changelog
- 0.94.2, Conductor is back, Conductor changelog