Worktrunk for Claude Code: Run Parallel Claude Sessions in Git Worktrees (Tested)

Worktrunk for Claude Code: Run Parallel Claude Sessions in Git Worktrees (Tested)

Running two Claude Code sessions in the same folder is a recipe for trouble. They edit the same files, trip over each other’s changes and mix two tasks into one messy diff.

Git worktrees fix that by giving each task its own folder and branch, but the plain git worktree commands are clunky. Worktrunk is a small open-source tool that wraps them in three short commands, and it ships a Claude Code plugin too.

We installed Worktrunk in a throwaway setup and ran real Claude Code tasks through it. Here’s how it works, what the plugin adds, and how it compares to Claude Code’s own --worktree flag.

What Worktrunk Does for Claude Code

Worktrunk is a command-line tool called wt. It’s free, open source under the MIT or Apache 2.0 license, and written in Rust.

The idea is simple: one worktree per task. Each worktree is a separate folder next to your project, on its own branch, so a Claude session in one can’t touch the files in another.

Diagram of the Worktrunk loop for parallel Claude Code sessions: wt switch -c -x claude, Claude works, wt list, wt merge, plus what the optional Claude Code plugin adds
Create, work, check, merge: the whole loop is four commands

These are the commands you’ll use most:

CommandWhat it does
wt switch -c feature -x claudeCreates a branch and worktree called feature, moves you there and starts Claude Code
wt listShows every worktree with its changes, commits ahead of main and status
wt mergeRebases the branch on main, merges it, then removes the worktree and branch
wt removeRemoves a worktree you don’t want to merge

If worktrees are new to you, our guide to Claude Code worktrees explains the idea with plain git first.

How to Install Worktrunk

On a Mac or Linux, install it with Homebrew and turn on shell integration in one line:

brew install worktrunk && wt config shell install

If you use Rust, cargo install worktrunk works too, followed by the same wt config shell install. On Windows, winget install max-sixty.worktrunk installs it as git-wt, because wt is already the Windows Terminal command.

Don’t skip the shell integration step. It lets wt change your terminal’s folder, and our test showed what happens without it later in this guide.

Start Claude Code in a New Worktree

From inside your project, this one command creates a branch called docs, makes a worktree for it and starts Claude Code there:

wt switch -c docs -x claude

The -x flag runs a program once the worktree is ready. Anything after -- goes to that program, so you can hand Claude its task right away:

wt switch -c priority -x claude -- 'Add an optional priority to tasks, with tests'
Terminal showing wt switch -c docs -x claude creating the docs branch and worktree and starting Claude Code inside tasklist.docs
The new worktree sits next to the project, and Claude starts inside it

This shot was taken before we turned on shell integration, so wt warns that it can’t change folders. Claude still starts in the right place, because -x runs it inside the new worktree.

One small catch: -x takes a program, not a shell command. If you need pipes or &&, use -x sh -- -c 'your command'.

Our Test: Two Claude Code Tasks in Two Worktrees

We used a small Node.js task list with two tests. Then we gave Claude Code (version 2.1.318, Sonnet 5.5) two separate jobs, each in its own Worktrunk worktree:

WorktreeTaskTimeCostResult
priorityAdd an optional low, normal or high priority to tasks23 s$0.095Done and committed, 4 tests passing
searchAdd a searchTasks function in a new file18 s$0.076Done and committed, 5 tests passing

We ran the two sessions one after the other to keep the test light, but nothing about the setup needs that. Each session only saw its own folder, so you can run them side by side in two terminal tabs.

When both were done, wt list showed the two new branches, each one commit ahead of main:

wt list output showing main plus the search and priority worktrees, each one commit ahead with their added and removed lines
One glance shows what each Claude session changed

For bigger parallel setups, like many agents at once or subagents that split one job, see our guide to running parallel agents in Claude Code.

Merge Claude’s Work With wt merge

To bring a branch back, switch to its worktree and run wt merge. The -y flag skips the confirmation:

wt switch priority
wt merge -y

The first merge was a simple fast-forward. Worktrunk merged the branch, removed its worktree and branch, and put us back in the main folder.

The second merge was the real test. After the first one, the search branch was behind main, so a plain merge would have needed a manual rebase.

Terminal showing wt list, wt switch search and wt merge -y rebasing onto main, merging one commit and removing the search worktree
wt merge rebased the branch onto main before merging it

Worktrunk rebased the branch onto main, merged it, cleaned up and switched back without any extra steps. Both features ended up on main, and all 7 tests passed:

wt list showing only main left, git log with both Claude commits on main, and npm test with 7 of 7 tests passing
Both Claude commits on main, nothing left over, 7 of 7 tests passing

Turn On Shell Integration First

Our first run of wt merge was without shell integration. The merge worked, but it deleted the folder our terminal was sitting in, so the next commands failed until we moved back by hand.

With wt config shell install done, the same merge moved the terminal back to the main folder by itself. That’s the step to get right before anything else.

Remove a Worktree Without Losing Work

Not every task deserves a merge. wt remove throws a worktree away, but it’s careful about it.

Terminal showing wt remove refusing to remove a worktree with uncommitted changes, then removing another worktree but keeping its unmerged branch
Uncommitted work blocks removal, and unmerged branches are kept

When we tried to remove a worktree with an uncommitted file, Worktrunk refused and told us how to save the change first. When we removed one with an unmerged commit, it deleted the folder but kept the branch, so the commit wasn’t lost.

To delete an unmerged branch on purpose, use wt remove -D branch-name. To throw away uncommitted changes, there’s wt remove --force.

The Worktrunk Plugin for Claude Code

Everything above works with plain Claude Code. Worktrunk also has an optional Claude Code plugin, which needs wt 0.81.0 or later. The quickest install is:

wt config plugins claude install

That does the same as these two commands, which you can also run yourself:

claude plugin marketplace add max-sixty/worktrunk
claude plugin install worktrunk@worktrunk

To take it out again, run wt config plugins claude uninstall. Our guide to Claude Code plugins covers how plugins load if you want the details.

Start a Task in a New Worktree From Inside Claude

The plugin adds a /wt-switch-create skill. It creates a worktree, moves the current session into it and starts the task, all without leaving Claude Code.

Claude Code running /worktrunk:wt-switch-create readme, creating the tasklist.readme worktree, editing README.md and committing it on the readme branch
One slash command: new worktree, task done, commit on its own branch

Normally Claude Code asks before a session moves into a folder outside its own worktrees area. The plugin’s permission hook answers yes for the repo’s own Worktrunk worktrees, so there was no prompt for that step, and Claude only asked before the git commit.

See Which Sessions Are Working or Waiting

The plugin also marks each worktree in wt list while Claude runs there. A robot means Claude is working, and a speech bubble means it’s waiting for you.

wt list showing a robot marker on the notes worktree while a Claude Code session works there
The robot marker: Claude is busy in the notes worktree
wt list showing a speech bubble marker on the notes worktree when the Claude Code session is waiting for input
The speech bubble: that session needs you

With several sessions open, this is the most useful part of the plugin. You can tell at a glance which tab to check.

One quirk we hit: when /wt-switch-create moved a session into a new worktree, the marker stayed on the branch where the session started. Markers were right for sessions started with wt switch -x claude.

What the Plugin Changes Behind the Scenes

The plugin also hooks into Claude Code’s own worktree feature. According to Worktrunk’s docs, worktrees that Claude Code creates, including for subagents with worktree isolation, then go through wt switch --create and wt remove.

The docs also list a /wt-diff side pane and a status line command. We didn’t test those two, so we’re leaving them out of our results.

Worktrunk vs Claude Code’s Built-In --worktree Flag

Claude Code has its own worktree option. claude -w name (or --worktree name) starts a session in .claude/worktrees/name on a branch called worktree-name.

We tried it next to Worktrunk. It worked, and wt list even showed Claude’s worktree alongside its own:

Terminal showing git worktree list with a locked Claude Code worktree under .claude/worktrees, git status showing .claude as untracked, and wt list showing all worktrees
Claude’s built-in worktree lives inside the project, and wt list sees it too
Featureclaude --worktreeWorktrunk
Extra installNoneThe wt tool, plus shell integration
Where worktrees goInside the project, in .claude/worktrees/Next to the project, like ../project.feature
List all worktreesNo command for itwt list with status
Merge back to mainBy hand with gitwt merge rebases, merges and cleans up
CleanupAsks to keep or remove when an interactive session endswt merge or wt remove, with safety checks
Works with other agentsClaude Code onlyAny command, plus plugins for Codex and others

Two small things to know about the built-in flag. The worktree folder showed up as an untracked .claude/ folder in git status, and Claude Code’s docs suggest adding .claude/worktrees/ to your .gitignore. A worktree made in a non-interactive -p run also stayed behind, locked, with no cleanup prompt.

For one quick side task, the built-in flag is enough. Once you run several sessions a day and merge their work, Worktrunk saves real time.

Our Verdict on Worktrunk With Claude Code

Results card for Worktrunk with Claude Code: two tasks in two worktrees done, wt merge rebased and merged with 7 of 7 tests passing, wt remove refused uncommitted work, plugin features worked, built-in claude --worktree has no list or merge
Everything we tried, and what happened

Worktrunk does what it promises. In our test it kept two Claude Code tasks fully apart, merged both cleanly, rebased the one that had fallen behind, and refused to throw away uncommitted work.

The weak spots are small. You must install shell integration or merges strand your terminal, the -x flag doesn’t take shell syntax directly, and the plugin’s marker can stick to the wrong branch after /wt-switch-create.

If you run more than one Claude Code session at a time, it’s worth installing. If you only ever run one, plain Claude Code is fine, and claude --worktree covers the odd side task.

FAQ

Do I need the plugin to use Worktrunk with Claude Code?

No. wt switch -c feature -x claude, wt list and wt merge all work with plain Claude Code. The plugin adds the /wt-switch-create skill, the working and waiting markers and the worktree hooks.

Can I run Claude Code sessions at the same time in different worktrees?

Yes. Each worktree is a separate folder on its own branch, so sessions don’t see each other’s files. Open one terminal tab per worktree, and use wt list to check on all of them.

Does Worktrunk work with Codex and other agents?

Yes. -x runs any program, and Worktrunk has plugins for Codex, OpenCode, Gemini CLI and others. The /wt-switch-create skill and worktree hooks are Claude Code only.

What happens to my dependencies in a new worktree?

A new worktree starts with only the files in git, so folders like node_modules aren’t there. Install them again in the worktree, or set up a Worktrunk project hook to do it every time.

Conclusion

Worktrunk gives Claude Code a clean way to run several tasks at once: wt switch -c name -x claude to start, wt list to check, and wt merge to bring the work home. In our test, two Claude sessions finished in their own worktrees, both branches merged with a rebase where needed, and all 7 tests passed.

Install it with brew install worktrunk && wt config shell install, add the plugin if you want status markers, and keep claude --worktree for quick one-off tasks. The Worktrunk docs cover hooks and more settings.

For more tested guides like this one, see our Claude Code tutorials, or search 500+ add-ons in the Claude Code Skills Directory.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top