Claude Code multiple agents: how to run them in parallel, and check the work
Run several Claude Code agents in parallel with subagents, agent teams, worktrees or -p, then keep one record of them and check the work with Caprock.
Claude Code runs agents in parallel four ways: subagents inside one session, background sessions, agent teams and dynamic workflows. Git worktrees keep their edits apart. In all four, an agent decides when the work is done; none of them runs your tests and refuses "done" until they pass. Caprock adds that, and a record of every agent on the machine, whether or not it started them — who is waiting on you, who is stuck, how close each subscription is to its limit — with tabs and split panes to live in it.
Ways to run Claude Code agents in parallel
| Option | Runs as | Own checkout | Who says it is done |
|---|---|---|---|
| Subagents | a side task inside your session | with isolation: worktree | the subagent |
claude --worktree | a whole session | yes, under .claude/worktrees/ | the agent |
claude --bg | a background session | yes, before it edits | the agent |
| Agent teams | a lead and teammate sessions | no, one shared checkout | the agents |
| Caprock's app, ⌘K | a session in a tab | yes, under .caprock-worktrees/ | the agent |
| Caprock's task runner | a worker session per task | yes, under .caprock-worktrees/ | your checks, run by Caprock |
How to manage several Claude Code sessions without juggling terminals
Let Claude Code keep the list, and give every session its own checkout. The free ways, all built in:
- Agent view.
claude agentsis one screen for every background session: Working, Needs input, Idle, Completed, Failed. Start one withclaude --bg "<task>", or send an open session there with/bg. A research preview. - Worktrees.
claude --worktree <name>gives a session its own checkout and branch, so two sessions never edit the same files. - tmux.
claude -w <name> --tmuxopens that worktree session in a tmux session of its own, or in iTerm2's own panes when iTerm2 is available. - Claude Desktop's Code tab. A sidebar of sessions, Ctrl+Tab to cycle them, ⌘-click (Ctrl-click on Windows) to open two side by side; it needs a paid plan.
What they leave out: agent view lists only background sessions, so a claude open in another terminal stays out until you background it; agent view and the Code tab manage Claude sessions only, not Codex or OpenCode; and /usage prices only the session you are in.
Caprock fills those gaps. Anthropic's own desktop app is a window for one agent, free with a plan; Caprock, a free desktop app for macOS, Windows and Linux, is the record across agents: every Claude Code, Codex, OpenCode or Gemini CLI session, the claude you started in your own terminal included, with who is waiting on you, who is stuck, how close each subscription is to its limit and what each pull request cost. The tabs — up to four panes each, the waiting sessions first, ⌘J to the next — are how you live with it. It never types into a session it did not start. The app and its record are below.
Subagents: parallel work inside one session
A subagent does a side task in its own context window and returns only a summary. Ask for several at once — "Research the authentication, database, and API modules in parallel using separate subagents" — or define your own in .claude/agents/. With isolation: worktree in its front matter, a subagent edits a temporary git worktree, not your checkout. Every field, and what subagents cost: Claude Code subagents.
Multiple sessions: worktrees, background and -p
- 1
Start a session in its own checkout, on a branch worktree-<name>
- 2
Start a background session (or /bg inside one); it moves into a worktree before it edits
- 3
Open agent view: every background session, and whether it is working, needs input or finished
A research preview.
- 4
Run without the interface, for scripts and CI
The JSON result includes total_cost_usd.
With -p there is no one to answer a permission prompt, so it is denied; pre-approve tools with --allowedTools or a permission mode.
Agent teams: Claude Code's orchestrator
Agent teams are experimental and off by default. Turn them on with an environment variable, in your shell or in settings.json:
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }
Then ask for teammates in plain language. Your session becomes the lead: it fills a shared task list and spawns teammates, each a separate Claude Code instance that claims tasks and messages the others.
…approximately 7x more tokens than standard sessions when teammates run in plan mode.
Teammates share one checkout, so give each different files. They are not spawned in -p mode, and /resume does not restore in-process teammates.
What gets hard with several agents at once
- Seeing all of them. Agent view lists background sessions; sessions open in other terminals do not appear until you background them, and subagents and teammates are not separate rows.
- Cost per session.
/usageprices only the session you are in. Agent view's docs warn that ten agents use quota roughly ten times as fast as one. - Knowing which one is stuck. A session repeating the same tool call looks like a busy one.
- Verifying the work. Every option ends with an agent saying it finished. The docs' answer is hooks you write yourself (
TaskCompletedexits 2 to refuse completion) and watching: "letting a team run unattended for too long increases the risk of wasted effort."
Several agents, one record: the Caprock app
Caprock is a free desktop app for macOS, Windows and Linux. Each project in its sidebar opens to its worktrees and the agent sessions and shells in each.
- Tabs and split panes. New agent (⇧⌘N) starts Claude Code, Codex, OpenCode, Gemini CLI, Grok Build or Hermes Agent in a terminal tab of its project. ⌘E opens a shell beside it, ⇧⌘E below it, up to four panes a tab. Closing a tab ends an idle agent, its conversation saved, and asks about one still working.
- A task becomes a worktree. In the palette (⌘K), type a task that matches nothing — "Add rate limiting to the API" — and Enter opens New agent with it as the first message, in a new worktree named after it (
add-rate-limiting-to-the-api), on its own branch. - What is waiting on you. Sessions stopped on a permission prompt or waiting for your answer come first in the sidebar and the palette; ⌘J opens the next one. The Dock badge (a dot on the Windows taskbar) counts them, and on macOS the menu bar names them beside its icon (2 waiting).
- Review each worktree. Click a worktree's ±N to see its diff, stage, commit and push, and open a pull request once GitHub is connected.
Starting several sessions from the app does not make them cheaper or safer than starting them in terminals: each is a whole session, and two agents editing the same checkout still collide. Give each its own worktree.
A dashboard of every Claude Code session at once
Claude Code's own is agent view, claude agents: every background session and whether it is working, needs input or finished, but not the sessions open in other terminals. Caprock's Home screen shows every Claude Code session on the machine at once, including the ones you start in your own terminals:
- Cost per session, beside its last hour of activity, and per project.
- Loop alerts — a session repeating the same tool call is flagged with the call and what the session has spent; the rule, and the two other ways a session stops moving, in Claude Code stuck.
- Waiting on you — a session idle at a question gets a row, with "what did it ask?" to read it without finding the terminal.
Caprock watches the sessions you start in your own terminal; it only stops or types into the ones it started itself.
Caprock's task runner: an orchestrator with a test gate
The task runner is off by default; turn it on from the Tasks screen. A task is a markdown file with a title, a budget and done_criteria — shell commands that must pass:
caprock task create --title "Add a /healthz endpoint" \ --done-criteria "go test ./..." --done-criteria "go vet ./..." --budget 3
After you press Start orchestrator, an orchestrator session assigns each task to a worker, one task per worker at a time. Each worker is a Claude Code session in its own git worktree, at <repo>/.caprock-worktrees/<worker-id> on branch caprock/<worker-id>. Your working tree is not touched.
| When | Caprock |
|---|---|
| The worker says it is done | runs each done_criteria command in its worktree, 5 minutes at most |
| Every check passes | moves the task to Done |
| A check fails | sends the failing output back to the worker |
| Three rounds have failed | stops the task in Needs you |
| The task goes over budget | stops it in Needs you |
| A check looks destructive | waits for your approval |
A Done card shows the diff, the checks that passed, the branch and the git command that merges it. Caprock never merges into your branches; you land the work.
Before you turn it on
- Workers skip permission prompts (
--dangerously-skip-permissions). A task body is acted on without asking. - Nothing detects two workers editing the same file. Give tasks that run at the same time different files.
- Set a budget. A task created without one gets $5; a task file you write by hand with no budget has no limit.
Agent teams, subagents or Caprock's runner
- Subagents — a side task whose output you do not need in your context, in one session.
- Agent teams — work that needs discussion, such as reviewers challenging each other, if you will stay and steer and can pay for several full sessions.
- Worktrees and agent view — independent tasks you hand off and review by hand.
- Caprock's app — several agents, or several kinds of agent, across projects, and one record of who is waiting on you, who is stuck, how close each limit is and what each pull request cost. Install it; more on worktrees in Claude Code worktrees.
- Caprock's task runner — independent tasks where a test, not an agent, decides when the work is finished.
Questions people ask
- How do I manage several Claude Code sessions without juggling terminals?
- Built in: start each session in its own worktree with claude --worktree <name> (add --tmux for a tmux session of its own), or in the background with claude --bg and watch them all in claude agents. Claude Desktop's Code tab lists sessions in a sidebar, on a paid plan. Caprock, a free desktop app, records Claude Code, Codex and other agents whether or not it started them, keeps them in tabs per project with the ones waiting on you first, and shows what each session and pull request cost.
- Is there a dashboard that shows all my Claude Code sessions at once?
- Claude Code's agent view (claude agents, a research preview) lists every background session and whether it is working, needs input or finished; a session open in another terminal shows only once you background it. Caprock, free and local, shows every Claude Code session on the machine, including the ones started in your own terminals, with each one's cost and loop alerts.
- Is there an app to run several Claude Code agents side by side?
- Caprock, a free desktop app for macOS, Windows and Linux, runs Claude Code, Codex, OpenCode and Gemini CLI in terminal tabs and split panes per project. Typing a task into its command palette opens a new agent on it, in a new worktree, and ⌘J jumps to the next session waiting on you.
- Can Claude Code run multiple agents in parallel?
- Yes: subagents inside one session, background sessions with claude --bg, agent teams and dynamic workflows. Git worktrees keep each session's edits apart.
- How do I turn on Claude Code agent teams?
- Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to 1 in your shell or in the env block of settings.json, then ask for teammates in plain language. Agent teams are experimental and off by default.
- How many tokens do Claude Code agent teams use?
- Anthropic's costs page says approximately 7x more tokens than standard sessions when teammates run in plan mode.
- How do I run two Claude Code sessions on the same repo?
- Start each with claude --worktree and a name. Each gets its own checkout in .claude/worktrees/<name>/ on a branch worktree-<name>.
- How do I know a parallel agent's work is really done?
- In Claude Code an agent decides; a TaskCompleted hook that exits 2 can refuse completion. Caprock's task runner runs your done_criteria in the worker's worktree and moves the task to Done only when every check passes.
- Does Caprock merge the agents' work?
- No. A Done card shows the diff, the checks that passed and the git command that merges it; you land the work.
Sources
- Claude Code docs — Run agents in parallel
- Claude Code docs — dynamic workflows
- Claude Code docs — Subagents
- Claude Code docs — Agent teams
- Claude Code docs — Agent view, read 20 October 2026
- Claude Code docs — Worktrees, read 20 October 2026
- Claude Code docs — CLI reference (--worktree, --tmux, --bg), read 20 October 2026
- Claude Code docs — Desktop application (parallel sessions in the sidebar), read 20 October 2026
- Claude Code docs — Run Claude Code programmatically (-p)
- Claude Code docs — Manage costs (agent team token costs)
- Caprock docs — the desktop app: tabs, split panes, the command palette, ⌘J, the badge and notifications (docs/app.md)
- Caprock source — a task typed into the palette becomes a worktree name (ui/src/screens/AppShell.tsx)
- Caprock source — new worktrees under .caprock-worktrees on branch caprock/<name> (internal/agents/worktree.go)
- Caprock changelog — 0.75.0 workspace; 0.76.0 badge and notifications; 0.78.0 split panes, ⌘J and the palette's new-worktree task
- Caprock README — Run tasks unattended
- Caprock spec — Orchestration
- Caprock source — verification (internal/board/verify.go)
- Caprock source — the $5 default budget (internal/board/board.go)
- Caprock source — budgets and workers (internal/orchestrator)
- Caprock source — loop detector (internal/loop)
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app