How to run multiple Claude Code sessions in parallel

Running one agent means watching a progress spinner. Running four means becoming a reviewer. The mechanics are easy now that Claude Code has worktrees built in; the part nobody warns you about is that your bottleneck moves to merging.

By the Continuum team. We build a workbench that runs Claude Code, Codex, and their peers, so the model rates quoted here are the ones our own cost analytics ship with.

The short version

Give each agent its own git worktree so their file edits cannot collide. Claude Code does this for you with claude --worktree <name>, which creates .claude/worktrees/<name>/ on a branch named worktree-<name> and blocks any tool call that would reach back into the main checkout. Keep tasks genuinely independent, and expect your rate limit and your review capacity to become the real constraints rather than the tooling.

What you need to know
  • File isolation is the hard requirement. Two agents in one directory will corrupt each other's edits.
  • claude --worktree <name> creates the worktree, the branch, and the session in one command.
  • Once isolated, Claude Code blocks writes, working directories, and git redirects that reach the main checkout, for the session and every subagent it spawns.
  • All sessions on one account share one rate limit. Four agents hit the wall roughly four times faster.
  • Tasks must be independent. Two agents on the same module produce two conflicting diffs and one wasted run.
  • Your bottleneck becomes review and merge, not generation. Plan for it before scaling past three.

Why one directory does not work

The naive approach is to open three terminals in the same repository and start three agents. It fails quickly and in a way that is hard to diagnose, because the failure looks like the model being stupid.

  • Agent A reads src/api.ts and plans an edit. Agent B rewrites the file. Agent A applies its edit to a version that no longer exists.
  • Both run the test suite simultaneously against a tree that is half A's change and half B's. Both see failures neither caused.
  • One runs git checkout or git stash and silently discards the other's uncommitted work.
  • You end up with a diff containing two interleaved half-features and no clean way to separate them.

Three ways to parallelise, and when each is right

Worktrees are not the only parallelism Claude Code offers, and picking the wrong one is why people conclude "parallel agents do not work".

Parallelism options in Claude Code, August 2026.

ApproachWhat is isolatedYou reviewReach for it when
Separate sessions in worktreesFiles and branch stateOne diff per sessionTwo or more genuinely independent tasks
Subagents inside one sessionContext, not files by defaultOne combined resultVerbose work (tests, research) you want kept out of your context
Subagents with isolation: worktreeContext and filesOne combined resultParallel edits inside one task, such as a mechanical refactor
Agent teamsWhole Claude instancesCoordinated outputA large task worth roughly 7x the tokens; off by default

A custom subagent gets permanent file isolation by adding one line to its frontmatter.

.claude/agents/refactorer.md
---
name: refactorer
description: Applies mechanical refactors across many files
isolation: worktree
---

Apply the requested refactor across every affected file, then run the tests
and report the results.

The setup

The fast path: let Claude Code do it

Three isolated sessions, three terminals
# terminal 1
claude --worktree csv-export
# terminal 2
claude --worktree tax-rounding
# terminal 3
claude --worktree dep-bump

Each call creates .claude/worktrees/<name>/ at the repository root on a branch named worktree-<name>, then starts the session there. Omit the name and Claude generates one such as bright-running-fox. Two setup steps make this pleasant rather than annoying:

Two things to do once per repo
# 1. Keep worktree contents out of your main checkout's git status
echo ".claude/worktrees/" >> .gitignore

# 2. Carry your gitignored env files into every new worktree
cat > .worktreeinclude <<'EOF'
.env
.env.local
config/secrets.json
EOF

An interactive --worktree run requires workspace trust. If you have never run Claude in that directory, run plain claude once to accept the trust dialog first. Non-interactive runs with -p skip the trust check.

The manual path, when you need control

Use git directly when you want a specific existing branch, a specific base, or a directory outside the repository.

01

Start from a clean base

cd ~/code/myapp
git checkout main && git pull
02

Create one worktree per task

Name them after the task, not after the agent. You will be reading these names in a PR list later.

git worktree add -b feat/csv-export   ../myapp-csv    origin/main
git worktree add -b fix/tax-rounding  ../myapp-tax    origin/main
git worktree add -b chore/dep-bump    ../myapp-deps   origin/main
03

Install dependencies in each

A fresh worktree has no node_modules. This is the step people forget, and the agent will spend its first three turns confused about missing modules.

for d in ../myapp-csv ../myapp-tax ../myapp-deps; do
  (cd "$d" && cp ../myapp/.env . 2>/dev/null; npm ci) &
done
wait
04

Start an agent in each

One terminal (or tmux pane) per worktree. Give each a single, well-bounded task.

cd ../myapp-csv  && claude "Add CSV export to the reports page. Tests included."
cd ../myapp-tax  && claude "Fix the tax rounding bug in checkout/total.ts. Add a regression test."
cd ../myapp-deps && claude "Bump minor dependency versions. Run the suite. Do not touch majors."

Choosing the base branch

By default a Claude-created worktree branches from the repository's default branch on the remote, so it starts clean. When you want it to carry your unpushed work instead, set worktree.baseRef to "head".

settings.json
{
  "worktree": {
    "baseRef": "head"
  }
}

How the isolation is actually enforced

This is the part that makes parallel sessions safe rather than merely tidy. While a session is isolated in a worktree, Claude Code refuses any tool call that would reach into the main checkout, and the same enforcement covers every subagent that session spawns.

  • File edits: an Edit, Write, or NotebookEdit targeting a path in the main checkout is blocked.
  • Working directory: a Bash, PowerShell, or Monitor command whose working directory resolves to the main checkout is blocked, and so is one whose working directory cannot be verified as outside it.
  • Git redirects: a command that redirects git into the main checkout is blocked, whether via git -C, --git-dir, GIT_DIR, GIT_WORK_TREE, or a cd before the git call.

What a worktree still shares with the main checkout is deliberate: the repository's .git directory (so git commit works from inside a worktree even with sandboxing on), project-scope plugins, and saved permission approvals. Choosing "Yes, don't ask again" in a worktree writes the rule to the main checkout's .claude/settings.local.json, so it applies everywhere and survives the worktree being removed.

Choosing tasks that parallelise

The tooling stops being the constraint almost immediately. Task selection becomes the thing that determines whether parallel agents help or waste your money.

Parallelises wellParallelises badly
Separate features in separate modulesTwo features in the same file
A bug fix and an unrelated featureA refactor plus anything else in that area
Adding tests to module A while B is builtA change and its own dependent change
Dependency bumps, lint cleanups, codemodsAnything touching a shared type or schema
Same task on two models, best result winsSame task twice on one model

The A/B pattern

One genuinely good use of parallelism is deliberate duplication: give the same hard task to two different models, then pick the better diff. It costs twice as much and is often worth it for something architectural, where the failure mode is a subtly wrong design you will live with for a year.

Sequence anything with a dependency

If task B needs task A's types, running them together produces B guessing at an interface A has not written yet. Merge A first. Parallelism is for independent work, and pretending otherwise wastes two runs instead of one.

The rate limit math

feat/csv-exportclaudefix/tax-roundingcodexchore/dep-bumpclaudeone account93%Isolation is free. The quota underneath all three is not.
Isolation is the easy half. Worktrees stop the agents colliding on disk, but every session still draws on the same quota underneath.

Every session on one account draws from the same rolling five-hour window and the same weekly cap. This is the constraint that surprises people who scale from one agent to four in an afternoon.

Rough shape, assuming similar session weight.

Agents runningEffect on your window
1Baseline
2Roughly 2x consumption rate
4Roughly 4x. A window that lasted a day now lasts an afternoon.
6+You will hit limits inside a single session on most plans.
An agent teamAbout 7x a standard session in plan mode, from one prompt

Four ways out, in ascending order of cost:

  1. Mix models. Put the dependency bump and the test writing on a small model and save the large one for the hard task. This often halves consumption with no quality cost. Set model: haiku in a subagent's config for the mechanical ones.
  2. Watch the meter. Add rate_limits.five_hour.used_percentage and rate_limits.seven_day.used_percentage to your status line so the fourth agent is a decision, not an accident.
  3. Mix providers. Run one agent on Claude and one on Codex. Two vendors, two independent quotas, and you get a second opinion on architecture for free.
  4. Run a second account. Two Max 5x subscriptions cost the same as one Max 20x and give you two independent windows, which is the shape you actually want for parallel work.

Reviewing what comes back

Four agents finishing at once produce four diffs that all need reading. If you skim them because there are four, parallelism has made your codebase worse, not your throughput better. Some structure helps.

Review each worktree on its own

A pass over every worktree
# Manual worktrees
for d in ../myapp-*; do
  echo "=== $d ==="
  git -C "$d" --no-pager diff --stat main...HEAD
done

# Claude-created worktrees
for d in .claude/worktrees/*/; do
  echo "=== $d ==="
  git -C "$d" --no-pager diff --stat main...HEAD
done

Merge in dependency order, not finish order

The agent that finished first is not necessarily the one to merge first. Merge the change other branches will need to rebase onto, then rebase the rest. Rebasing an agent branch is normal and cheap; merging four branches that each assume they are on top of main is not.

Open PRs rather than merging locally

Even solo, one PR per worktree gives you CI per change and a place to leave notes about what the agent did. It also means a bad agent run gets closed rather than reverted.

git -C ../myapp-csv push -u origin feat/csv-export
gh pr create --fill --head feat/csv-export

Cleanup

Worktrees accumulate. A month of this and you have fourteen directories and a branch list you cannot read. Claude Code cleans up most of it, with rules worth knowing so you do not fight them.

  • On exit, clean worktree: an unnamed session removes its worktree and branch automatically. A named session asks first.
  • On exit, worktree has work: you are prompted to keep or remove. Removing deletes the directory, the branch, and everything in them.
  • Non-interactive -p runs: no exit prompt, so nothing is cleaned up. Remove those yourself with git worktree remove.
  • Subagent and background worktrees: a periodic sweep removes them once they are older than your cleanupPeriodDays setting, skipping any that still hold changed files, untracked files, or unpushed commits. It never touches worktrees you created with --worktree.
  • While an agent runs: Claude runs git worktree lock on its worktree so a concurrent sweep cannot remove it, and releases the lock when the agent finishes.
Tearing down by hand
# Remove a finished worktree and its branch
git worktree remove ../myapp-csv
git branch -d feat/csv-export

# The sweep is keeping one because it still holds work
git worktree remove --force .claude/worktrees/dep-bump

# Clear registrations for directories deleted by hand
git worktree prune

# What is still open?
git worktree list

# Delete local branches already merged into main
git branch --merged main | grep -v '^\*\| main$' | xargs -r git branch -d

Questions people ask

Technically as many as your machine handles. Practically, rate limits bite around four on one account, and human review capacity bites around three. Start with two.

You need isolation. Several terminals in one directory means agents overwriting each other mid-edit. Worktrees are the cheapest way to get separate files with a shared repository, and Claude Code creates them for you with --worktree.

Yes. claude --worktree <name> creates .claude/worktrees/<name>/ on a branch named worktree-<name> and starts the session there. Omit the name and Claude generates one. Pass a quoted "#1234" to branch from a pull request.

No. While a session is isolated, Claude Code blocks edits into the main checkout, blocks commands whose working directory resolves there, and blocks git redirects via git -C, --git-dir, GIT_DIR, or GIT_WORK_TREE. The same applies to every subagent it spawns.

Yes, if they run under the same account. Four sessions consume roughly four times as fast, and an agent team runs about 7x a standard session in plan mode. Separate accounts, or mixing Claude with Codex, gives you independent quotas.

Only as a deliberate A/B: same task, two models, you pick the better diff. Splitting one feature across two agents produces two partial implementations that do not fit together.

Each worktree needs its own, since ignored files are not checked out. Add a .worktreeinclude file listing your gitignored env files and Claude Code copies them into every worktree it creates. For dependencies, install fresh, or use pnpm which hard-links from a shared store.

Usually not. Exiting an interactive session removes a clean unnamed worktree automatically and prompts when there is work in it. Subagent and background worktrees are swept once they pass cleanupPeriodDays, unless they still hold changes. Worktrees from -p runs are never cleaned up.

Sources

Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.

  1. Claude Code: run parallel sessions with worktrees the --worktree flag, isolation enforcement, cleanup rules
  2. Claude Code: manage costs effectively agent team token costs
  3. git-worktree documentation isolation mechanics
Try it

Four agents.
One sidebar.

Continuum spawns each session into its own worktree, shows every running agent in one list with live status, and lets you approve a plan from your phone while the rest keep working.

free app · your subscriptions · local-first