Skip to content
New: answer your agents from your phoneLearn more

Run multiple Claude Code sessions in parallel.

Each session needs a working directory of its own, or the agents edit the same files. You can give each one a worktree with plain Git, with Claude Code's --worktree flag, or with an app that does it for you.

Each Claude Code session needs its own directory

Two Claude Code sessions started in the same checkout edit the same files. One session's half-finished change breaks the other's build, a test run picks up both, and a commit can sweep in work that belongs to the other task. A separate branch doesn't fix this, because a checkout has only one branch and one set of files at a time.

A Git worktree is a second checkout of the same repository in another directory, on its own branch. All three options below start each session in one. What a worktree is, and how it compares with a clone.

Option 1: plain Git

Create a worktree per task, then start Claude Code inside it. Each command runs in its own terminal:

$ git worktree add -b fix-flaky-poll ../atlas-fix-flaky-poll main
$ cd ../atlas-fix-flaky-poll && claude
$ git worktree add -b add-rate-limit ../atlas-add-rate-limit main
$ cd ../atlas-add-rate-limit && claude

This works with any version of Claude Code and puts the worktrees wherever you like. You manage everything else yourself: which terminal holds which task, installing dependencies in each new directory, and removing the worktree and branch after the merge.

Option 2: Claude Code's --worktree flag

Claude Code can create the worktree for you. Give the session a name:

$ claude --worktree fix-flaky-poll

It creates the worktree under .claude/worktrees/fix-flaky-poll/ in your repository, on a new branch named worktree-fix-flaky-poll, and starts the session there. Run the same command with another name in a second terminal for a second session. Add .claude/worktrees/ to your .gitignore so the worktrees don't show up as untracked files in your main checkout.

The new worktree is a fresh checkout without your dependencies or .env files, so install them there, or ask Claude to. The Claude Code worktree docs cover the options, including which commit new worktrees start from.

Option 3: an app that manages the worktrees

Past two or three sessions, the hard part is keeping track of the worktrees: which session is waiting on a permission prompt, which one finished, and what each changed. ket handles that tracking. In the ket app you press ⌘⇧N, name the task, pick Claude Code as its agent, and it starts in the new worktree. From a terminal, run:

$ ket project add .
$ ket worktree add fix-flaky-poll
fix-flaky-poll-3f2a9c41d0be  ~/.local/share/ket/worktrees/…
$ ket run claude --on fix-flaky-poll-3f2a9c41d0be --prompt "fix the flaky poll test"
$ ket ps
  • Live status. ket installs hooks for Claude Code, so each worktree's row reads running or waiting as it changes, and the header counts the waiting ones across every project.
  • Setup. ket worktree add clones node_modules, .venv and vendor from your primary checkout copy-on-write and copies your .env files. For worktrees made in the app, run Re-run provisioning for a worktree from the command palette.
  • Resume. Coming back to a worktree resumes its most recent Claude Code session.
  • Plan usage. The header shows how much of your Claude plan's session and weekly limits you've used, and when each resets.
  • Review and merge. The Git view lists everything a worktree changed since its base, each file's diff opens in a tab, and a merge commits the work and merges the branch into its base.

ket runs other agent CLIs the same way as Claude Code, including any you add to its config.toml, so different worktrees can run different agents. Your first worktree in ket.

What parallel sessions still share

  • Your plan's limits. Every session on the same Claude account draws on the same usage limits, so running several at once uses them up sooner.
  • Ports and databases. Worktrees give each session its own files, but running services stay shared. Two dev servers on the same port collide, and two branches migrating one local database interfere. Giving each worktree its own ports and database.
  • The base branch. Each task starts from the main of the moment it began. After one merges, rebase the others before reviewing them. Merging parallel work in order.

Review before you merge

Read each task's committed changes against its base, not only Claude's summary of them:

$ git diff main...fix-flaky-poll --stat
$ git diff main...fix-flaky-poll

In the task's worktree, check for unfinished changes and run the project's checks as well:

$ git status --short
$ git diff HEAD

git diff HEAD shows staged and unstaged changes to tracked files. Open the untracked files that git status reports before you merge.

Then merge it from your main checkout, and remove the worktree and branch:

$ git merge fix-flaky-poll
$ git worktree remove ../atlas-fix-flaky-poll
$ git branch -d fix-flaky-poll