How to run multiple Claude Code agents in parallel
Updated July 27, 2026 · 8 min read
Running several Claude Code agents at once is a solved problem — git worktrees give each one an isolated checkout, and the CLI has flags for it built in. What isn't solved is supervision: past about three concurrent sessions, your attention, not your CPU, becomes the limiting resource.
Verified against Claude Code 2.1.220
Flags below were checked against claude --help on 2.1.220. Older builds may not have --worktree, --bg, or claude agents.
The reason to run agents in parallel is simple arithmetic: a substantial refactor takes an agent ten to forty minutes, and you are not doing anything useful for most of it. Three agents on three projects is three times the throughput — right up until all three need you at once.
There are four approaches that actually work. They differ mostly in how much isolation you get and how much ceremony it costs.
1. Built-in git worktrees (start here)
Two agents editing the same checkout will corrupt each other's work — one rewrites a file the other is mid-way through reasoning about. Git worktrees solve this properly: each session gets its own directory and its own branch, sharing one .git object store.
Claude Code has this built in, so you don't need to manage the worktrees yourself:
# Create a worktree for this session, named automatically
claude --worktree
# Or name it
claude --worktree refactor-auth
# Same, but also spin up a tmux session for it
# (uses iTerm2 native panes when available)
claude --worktree refactor-auth --tmuxClaude Code stores these under .claude/worktrees/<name>/. Each is a real checkout: the agent can run the test suite, install dependencies, and commit without touching what you have open in your editor.
The dependency tax
A fresh worktree has no node_modules, no .venv, no build cache. For a large JS project that's a two-minute npm install per worktree and a lot of disk. Worth it for long tasks, painful for quick ones — which is the main argument for reusing a small pool of long-lived worktrees rather than creating one per task.
2. Background agents
Since 2.1.x the CLI can start a session detached and hand you back your terminal immediately:
# Start detached, return immediately
claude --bg "migrate the settings store to the new schema"
# Manage what's running
claude agentsThis is the lowest-ceremony way to get parallelism: no tmux, no window management, no worktree bookkeeping if you don't want it. The trade is visibility — a background agent that hits a permission prompt is blocked somewhere you aren't looking, which is exactly the failure this whole page builds toward.
3. tmux panes
The manual version, and still the most common setup among people running four or more agents. One pane per project, each running its own claude:
#!/usr/bin/env bash
# fleet.sh — one pane per project
set -euo pipefail
SESSION=agents
tmux new-session -d -s "$SESSION" -c ~/code/api
tmux send-keys -t "$SESSION" 'claude' C-m
for project in web docs infra; do
tmux split-window -t "$SESSION" -c "$HOME/code/$project"
tmux send-keys -t "$SESSION" 'claude' C-m
done
tmux select-layout -t "$SESSION" tiled
tmux attach -t "$SESSION"You get full visibility into every session and a familiar way to jump between them. What you don't get is a signal — you have to *look* at the tiled panes to notice that pane 3 has been blocked for eleven minutes. That's a polling loop implemented with your eyes.
4. Separate clones
Sometimes the right answer is the boring one. If your projects are genuinely unrelated, just clone them into separate directories and run claude in each. No shared git state means no worktree edge cases, no branch collisions, and no shared node_modules surprises. Use --add-dir if a session legitimately needs read access to a sibling project.
Keeping the sessions apart
A few flags matter more once several agents are live at once:
| Flag | Why it matters in parallel |
|---|---|
--session-id <uuid> | Pin a session to a known ID so external tooling can track it rather than guess. |
-n, --name <name> | Sets a display name shown in the prompt box, /resume picker, and terminal title. Cheap and immediately worth it once you have more than two. |
--model / --effort | Run the mechanical migration on a cheaper model and the design work on a stronger one. --effort takes low, medium, high, xhigh, max. |
--max-budget-usd <amount> | Caps spend per session (print mode). A runaway loop across five agents is a genuinely expensive mistake. |
--add-dir <dirs...> | Grant read access to a sibling repo without merging the checkouts. |
--setting-sources <sources> | Comma-separated user,project,local — control which settings layers a session loads. |
The bottleneck nobody mentions
Here's the thing you discover around week two. Every approach above scales the *work*. None of them scale the *supervision*.
With a conservative permission mode — which is the correct setting, see permission modes explained — each agent stops several times per task and waits for a human. With one agent, you're right there. With four, the interruptions arrive at random from four directions, and the cost isn't the click. It's that you were deep in something else and now you're context-switching four times an hour to answer yes.
So people do the predictable thing and reach for --dangerously-skip-permissions, which converts a supervision problem into a blast-radius problem. That trade is worth reasoning about explicitly rather than drifting into — here's the risk model.
The alternative is to keep the conservative mode and fix the *latency* instead: make being asked cheap enough that a blocked agent costs you seconds rather than the rest of the afternoon. That's a notification problem, and there are several ways to solve it on macOS — hooks that fire a system notification, a statusline you can glance at, or an always-visible overlay that survives fullscreen.
A setup that scales to three or four
- 01One worktree per long-running task (
claude --worktree <name>), reused across tasks rather than created per task, so you pay the dependency install once. - 02Name every session (
-n) so you can tell them apart in/resumeand in your terminal tabs. - 03A conservative
defaultModein project settings, plus adenylist covering push, force-delete, and secret reads. - 04A
NotificationorPermissionRequesthook that makes a blocked agent visible without you polling — see the hooks guide. - 05A hard cap on concurrency. Three or four is where most people top out, and it's an attention limit, not a machine limit.
FAQ
Can you run multiple Claude Code sessions at once?
Yes. There's no limit imposed by the CLI — you can run as many `claude` processes as your machine and plan allow. The practical constraints are that two sessions must not share a working directory, and that each session may block waiting for a permission decision from you.
Do I need git worktrees to run agents in parallel?
Only if the sessions share a repository. Two agents editing the same checkout will overwrite each other's in-flight work. For unrelated projects, separate directories are enough. `claude --worktree` creates and manages a worktree for you.
How many Claude Code agents can I realistically supervise?
Most people top out around three or four. The limit is not compute — it's that each agent interrupts you for permission decisions at unpredictable times, and beyond a handful the context-switching costs more than the parallelism gains.
What does `claude --bg` do?
It starts the session as a background agent and returns immediately instead of taking over your terminal. You manage running background agents with `claude agents`.
Keep reading
Claude Code permission modes, explained
The six modes the CLI accepts, what each one stops asking about, and how to pick one for unattended runs.
Claude Code notifications on macOS
Six ways to get told an agent is blocked, from a terminal bell to a phone push — and where each one drops the signal.
Is --dangerously-skip-permissions safe?
What the flag actually turns off, what an agent inherits from your shell, and when bypassing is defensible.