Claude Code Agent Teams: How to Run One Without Wasting Tokens
Claude Code agent teams let one Claude Code session act as a team lead that spawns several teammates, each a full Claude Code instance with its own context window. Teammates share a task list, claim work, and message each other directly. The feature is experimental, off by default, and turned on with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1.
The docs explain the mechanics. This guide adds the judgment calls: when a team beats subagents, what each teammate costs, and how to keep a record after the session ends.
Key takeaways
- Turn it on with one variable, in your shell or in
settings.json. Teams only form in interactive sessions, never withclaude -p. - Teammates talk to each other. Subagents report back to the main session only. That is the whole difference, and it is also why teams cost more.
- Cost scales with headcount. Anthropic's costs doc says token usage is "roughly proportional to team size". Start with 3 to 5 teammates.
- There is no worktree isolation. Teammates share one checkout, so give each one its own set of files.
- The team's state is temporary. The team config is deleted when the session ends. Use hooks to keep a durable record of each finished task.
What are Claude Code agent teams?
Agent teams are an experimental Claude Code feature where a lead session coordinates several independent Claude Code sessions, called teammates, through a shared task list and a mailbox. You describe the team in plain language and Claude spawns it.
The docs describe four parts:
| Part | What it does |
|---|---|
| Team lead | The main session. It spawns teammates, creates tasks and synthesizes results. It stays the lead for its whole lifetime. |
| Teammates | Separate Claude Code instances. Each loads CLAUDE.md, Model Context Protocol (MCP) servers and skills, plus the lead's spawn prompt, but not the lead's conversation history. |
| Task list | Shared work items with three states (pending, in progress, completed) and dependencies. Claiming uses file locking. |
| Mailbox | One JSON inbox per agent at ~/.claude/teams/{team-name}/inboxes/{agent-name}.json. |
You can message any teammate directly: select it in the agent panel and press Enter.
"Agent teams add coordination overhead and use significantly more tokens than a single session. They work best when teammates can operate independently." (Claude Code docs)
How are agent teams different from subagents?
Subagents work inside one session and return a summary to the agent that called them. Agent teams are separate sessions that message each other and coordinate through a shared task list. Use subagents when only the result matters; use a team when workers need to share findings or challenge each other.
| Subagents | Agent teams | |
|---|---|---|
| Who coordinates | The main agent | The lead, plus teammates self-claiming tasks |
| Communication | Result returns to the caller | Teammates message each other by name |
| Context | Own window, summary goes back | Own window, fully independent |
| Token cost | Lower | Higher: every teammate is a full instance |
Works in claude -p and the Claude Agent SDK |
Yes | No, named subagents run as ordinary subagents |
| Best for | Searches, file reads, single-track side jobs | Parallel review, competing hypotheses, cross-layer features |
One surprise: while agent teams are on, a subagent that Claude names launches as a teammate, so a team can form when you only asked for delegation. Setting the variable to 0 in settings.json stops that from the next spawn, without a restart.
How do you turn on agent teams in Claude Code?
Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to 1 in your environment or in settings.json, start an interactive claude session, and ask for teammates in plain language. There is no separate install: you ask for teammates in your prompt.
Copy this: setup block
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
},
"teammateMode": "auto"
}
Put it in ~/.claude/settings.json. teammateMode controls the display:
- In-process (the default): all teammates run inside your terminal. Use the agent panel to switch between them,
xto stop one, and Ctrl+T to show the task list. Works in any terminal. - Split panes: each teammate gets its own pane. This needs tmux or iTerm2 with the
it2CLI and the Python API turned on (iTerm2 > Settings > General > Magic > Enable Python API). With"auto", panes open when you run Claude Code inside tmux or iTerm2.
For one session, use claude --teammate-mode auto; the flag is experimental and hidden from claude --help.
Name the model per teammate
Claude picks each teammate's model in this order: the model your spawn prompt names, then the subagent definition's model, then CLAUDE_CODE_SUBAGENT_MODEL, then the lead's model. The simplest control is the prompt: "Use Sonnet for each teammate." The costs doc recommends exactly that for coordination work.
How do you start and steer an agent team?
Describe the job and the roles in one prompt, give each teammate a name and a set of files it owns, and say what done looks like. Claude creates the tasks, spawns the teammates and synthesizes the results. Then watch, redirect, and shut teammates down when they finish.
Copy this: team prompt template
Create an agent team for: <goal in one sentence>.
Spawn 3 teammates, using Sonnet for each:
- "api": owns src/api/ and tests/api/ only. Task: <task>.
- "web": owns src/web/ and tests/web/ only. Task: <task>.
- "reviewer": read-only. Reviews each finished task for <criteria> and
messages the owner with fixes. Never edits files.
Rules for every teammate:
- Do not edit files outside the paths you own. Ask the owner instead.
- Break your work into tasks of about one function, test file or review each.
- Before marking a task complete, write proof to .team/proof/<task-id>.md:
what changed, the test command you ran, and its result.
- When all your tasks are done, report to the lead and wait for shutdown.
Lead: wait for your teammates to finish before you implement anything
yourself. When every task is complete, summarize the changes and open a
draft PR. Do not merge.
For a review, the docs' own parallel code review prompt is a ready shape to copy:
Spawn three teammates to review PR #142:
- One focused on security implications
- One checking performance impact
- One validating test coverage
Have them each review and report findings.
Three habits from the docs make this work:
- Size the team to the work. "Start with 3-5 teammates for most workflows," and aim for 5 to 6 tasks per teammate so the lead can reassign work if someone gets stuck.
- Keep the lead from doing the work. The docs say the lead sometimes starts implementing instead of waiting. Tell it: "Wait for your teammates to complete their tasks before proceeding."
- Plan before risky changes. Put the lead in plan mode first and its new teammates plan before editing. Claude Code approves those plans automatically unless you changed the teammate's permission mode, so read them yourself when it matters.
To end a teammate, ask by name: "Ask the researcher teammate to shut down." It finishes its current tool call first, so shutdown can be slow.
What do Claude Code agent teams cost?
A team costs roughly one session per active teammate, plus the messages between them. On a subscription you hit your usage limits sooner; on the API the bill grows.
Heeki Park's walkthrough shows the floor:
"If I have a team lead and three teammates, each loading 10k as initialization context, that's 40k token usage over what would have been just 10k in a single session."
That is startup context alone. The costs doc gives the one official multiplier:
"Agent teams use approximately 7x more tokens than standard sessions when teammates run in plan mode, because each teammate maintains its own context window and runs as a separate Claude instance." (Claude Code costs doc)
Two details change the math:
- Cache lifetime. An in-process teammate's prompt cache holds for 5 minutes by default, even on a Claude subscription. A teammate that sits idle longer pays to rebuild its context. Setting
subagentPromptCacheTtlto1hkeeps it longer, at a higher cache-write rate on the API. - Idle teammates still cost. The costs doc says each active teammate "continues consuming tokens until it exits or the session ends." Shut them down when their tasks are done.
Quick estimate you can reuse
team tokens ≈ (1 + N) × startup context
+ Σ per-teammate work (files read, tool output, replies)
+ messages × average message size
For model rates and plan limits, see our Claude Code pricing breakdown.
When should you not use an agent team?
Skip a team when the work is sequential, when workers would edit the same files, or when subagents could finish in about the same time. A team pays off only when parallel workers need to talk.
Jose Parreo Garcia's guide puts it bluntly: "Most people who reach for agent teams are solving the wrong problem." Even Heeki Park, who built a workflow around teams, wrote that a main agent with subagents could probably have "completed in comparable overall time."
Claude Code has five ways to run work in parallel, plus a single session, compared on the docs' Run agents in parallel page. The short version:
| Option | Use it when | Skip it when |
|---|---|---|
| One session | The task is sequential or touches the same files | It floods your context with logs you will not reread |
| Subagents | A side job (search, read, test run) only needs to return a result | Workers need to debate or hand off to each other |
Agent view (claude agents) |
You have several independent tasks and want to check in on each | The tasks depend on each other |
| Agent teams | Parallel work where workers must share findings: multi-lens review, competing bug theories, front end plus back end plus tests | You need claude -p, worktree isolation, resumable sessions or nested teams |
| Dynamic workflows | A big job (hundreds of files, a full audit) needs a scripted plan and cross-checked results | A handful of subagents would do |
| Projects | Work spans days, should keep running while your machine is off, and you work at claude.ai/code or in the desktop app | You want everything local in one terminal |
Know the limits before a long run: in-process teammates do not come back after /resume or /rewind, there is one team per session, no nested teams, and the lead cannot hand over leadership.
How do you run agent teams with git worktrees?
Run one team per worktree, not one teammate per worktree. The docs say "Agent teams don't isolate teammates in worktrees, so partition the work," which means teammates inside a team share one checkout. Heeki Park's workflow scales across features by starting each team's lead in its own worktree with claude --worktree <issue-name>, one feature branch per team. Each team ends at a pull request held for review. He reviewed them serially: merge one into main, then rebase the next from main. On his monolithic codebase that still meant merge conflicts, which Claude Code resolved during the rebase.
What goes wrong with agent teams, and how do you fix it?
Most problems are setup issues from the docs' troubleshooting list or coordination failures any multi-agent system has; the last three rows are failure modes Jose Parreo Garcia names.
| Problem | Fix |
|---|---|
| Teammates not appearing | In in-process mode they sit in the agent panel below the prompt; idle rows hide 30 seconds after the whole panel goes idle. For split panes, check which tmux, or the it2 CLI and Python API in iTerm2. Make sure the task was complex enough to warrant a team. |
| Too many permission prompts | Teammate requests bubble up to the lead. Pre-approve common operations in your permission settings before spawning. |
| Teammates or the lead stopping early | Open the teammate and give it more instructions, or spawn a replacement. If the lead decides the team is done too soon, tell it to keep going. |
| The lead implements instead of waiting | Tell it: "Wait for your teammates to complete their tasks before proceeding." |
| Task stuck as in progress | Check whether the work is done, then update the status or have the lead nudge the teammate. |
| Orphaned tmux session | Run tmux ls, then tmux kill-session -t <session-name> for the one the team created. |
| Coordination drift | Workers duplicate each other. Name an owner and a file set per teammate in the spawn prompt. |
| Hallucinated ownership | One agent assumes another checked something. Require a proof file per task with the TaskCompleted hook below. |
| Cost explosion | Keep teams to 3 to 5, use Sonnet for teammates and shut down idle ones. |
How do you keep quality and a record when a team works?
Use the three team hooks as gates, pre-approve permissions before you spawn, and copy each finished task to a durable record. The team config is deleted when the session ends and the task list only lasts until Claude Code's cleanup period, so the team's own files are not an audit trail.
The hooks reference gives you TeammateIdle, TaskCreated and TaskCompleted. Each one can block with exit code 2 and send its stderr back to the agent as feedback. TaskCompleted receives task_id, task_subject and, when present, task_description and teammate_name.
Copy this: a proof gate and task log
Save as .claude/hooks/task-completed.sh and make it executable:
#!/bin/bash
input=$(cat)
id=$(echo "$input" | jq -r '.task_id')
subject=$(echo "$input" | jq -r '.task_subject')
who=$(echo "$input" | jq -r '.teammate_name // "lead"')
proof=".team/proof/${id}.md"
if [ ! -s "$proof" ]; then
echo "No proof for task $id. Write $proof with what changed, the test command and its result, then complete the task again." >&2
exit 2
fi
mkdir -p .team
jq -nc --arg id "$id" --arg s "$subject" --arg w "$who" \
--arg t "$(date -u +%FT%TZ)" --arg p "$proof" \
'{time:$t, task:$id, subject:$s, teammate:$w, proof:$p}' >> .team/log.jsonl
exit 0
Then register it in .claude/settings.json. Team hooks do not take matchers:
{
"hooks": {
"TaskCompleted": [
{ "hooks": [ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/task-completed.sh" } ] }
]
}
}
Two permission details catch people out. Teammates start in the lead's permission mode, including bypassPermissions (if the lead is in dontAsk mode, they start in Manual mode instead), and you cannot set a different mode per teammate at spawn. Their permission prompts also bubble up to the lead, so pre-approve the commands they need. For split-pane teammates, --allowedTools is not passed on; put the rules under permissions.allow in --settings instead.
Copy this: pre-flight checklist
- [ ] The task really has parallel parts that need to talk. If not, use subagents.
- [ ] Each teammate owns a separate set of files, written in the spawn prompt.
- [ ] Team size is 3 to 5, with about 5 to 6 tasks per teammate.
- [ ] Teammate model is named in the prompt (Sonnet unless the task needs more).
- [ ] Permissions for tests, linters and git are pre-approved; the lead is not in bypass mode.
- [ ] A
TaskCompletedhook requires proof and writes a log outside~/.claude. - [ ] The lead is told to wait for teammates and to stop at a draft PR.
- [ ] You know how you will stop: shut down each teammate, then end the session.
- [ ] For long runs,
subagentPromptCacheTtlis set if teammates will sit idle over 5 minutes.
What did our own multi-agent work show?
We have not run the experimental agent-teams feature on tracked work. These numbers come from the closest thing we run daily: a lead Claude Code session handing parts of a ticket to subagents, each clocking in on the ticket with its agent name and model.
As of 2026-11-18, our workspace has 429 clocked AI sessions across 216 tickets, 7,546 minutes in total. 155 of those sessions were subagents, 1,508 minutes between them. 70 tickets had two or more sessions, 64 had at least one subagent session, and 37 mixed models on the same ticket. The typical shape is an Opus 5.5 lead with Sonnet 5.5 helpers, which is the same split the costs doc recommends for teammates.
What this taught us about multi-agent work in general:
- The record has to live outside the session. A week later the question is "which run changed this, on which model, for how long", and a transcript does not answer it.
- Most tickets need one agent. 146 of 216 tickets had a single session. Helpers paid off on research-heavy, multi-part tickets.
Where does a ticket tracker fit with an agent team?
A team's task list coordinates one session. A tracker holds the record after it: which agent and model did each part, how long, at what cost, with what proof. Our guide to Claude Code tasks covers the task-list side.
Jenzo is a ticket tracker built for teams where AI agents do much of the work, and it is the tracker we use. Agents open, update and close tickets themselves over MCP or the API. Each agent session on a ticket records its agent name, model, active minutes and tokens, and the work trail logs files, branch, PR, commits and cost. Because teammates share one checkout, one detail matters: when another open ticket touched the same files, Jenzo warns that a parallel agent may be editing them. A ticket can't close without proof (a link or a real closing report), and a parent ticket can't close while its sub-tickets are open. For the wider picture of watching agent runs, see AI agent observability.
Who should use Claude Code agent teams?
- Pick agent teams if your parallel workers must share findings and each can own separate files.
- Pick subagents if you mostly need searches, reads and test runs that return a result, or you run Claude headless.
- Pick agent view or dynamic workflows if your tasks are unrelated (agent view) or one job is too big for a handful of subagents (dynamic workflows).
- Pick one session if the work is sequential or keeps returning to the same few files.
FAQ
Does Claude Code support agent teams?
Yes. Agent teams are a built-in Claude Code feature, marked experimental and disabled by default. Once you set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, a lead session can spawn teammates that share a task list and message each other. The docs list known limitations around session resumption, task status and shutdown, so treat it as a preview.
How do you turn on agent teams in Claude Code?
Add "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" under env in ~/.claude/settings.json, or export it in your shell, then start claude interactively and ask for teammates. Add "teammateMode": "auto" to get split panes inside tmux or iTerm2. Teams do not form in claude -p or Agent SDK sessions.
Can Claude Code run as an agent?
Yes. Claude Code is itself an agent: it plans, edits files and runs commands in a loop. You can run it headless with claude -p, build on it with the Agent SDK, delegate to subagents, or dispatch background sessions from agent view. Only agent teams need an interactive session, because the lead has to stay open to coordinate.
How good are Claude agent teams?
Good for parallel work that needs discussion and overkill for most other tasks. The docs name four strong uses: research and review, new modules each owned by one teammate, debugging with competing hypotheses, and changes across front end, back end and tests. The price is about 7x the tokens of a standard session in plan mode, and practitioners report subagents often finish in comparable time.
Where are Claude Code agent teams stored?
Locally. The team config lives in ~/.claude/teams/{team-name}/config.json and is removed when the session ends. The task list lives in ~/.claude/tasks/{team-name}/ and stays on disk until Claude Code's cleanup period passes. Do not edit the config by hand; Claude Code overwrites it.
From our own experience
Our agents split work across an Opus lead and cheaper Sonnet helpers every day, and the pattern that held up was simple: an expensive model plans and checks, cheap models fetch and draft. Agent teams make that split easier to run, but also easier to overspend on. What surprised us was how rarely we needed more than one agent: two thirds of our tracked tickets finished with a single session.
Let your agents keep the board.
Claude Code, Codex and Cursor open their own tickets, log hours and tokens, and close them with the commit.
Connect your agent