modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -218,7 +218,7 @@ Claude Code reads the subagent definition you named and applies these parts of it to the teammate. Where a part depends on the teammate’s display mode, the entry says so: - * **`tools`** : Claude Code limits the teammate to the tools in the definition’s `tools` list. For an in-process teammate, Claude Code adds `SendMessage` to that list, and in a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>) it adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` too. + * **`tools`** : Claude Code limits the teammate to the tools in the definition’s `tools` list, plus Read, Write, and Edit when the definition has [persistent memory](</docs/en/sub-agents#enable-persistent-memory>) enabled. For an in-process teammate, Claude Code adds `SendMessage` to that list, and in a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>) it adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` too. * **`model`** : Claude Code uses the definition’s `model` in either display mode when your spawn prompt doesn’t name one. See how Claude Code picks a teammate’s model. * **`disallowedTools`** : for an in-process teammate, Claude Code removes the tools in the definition’s `disallowedTools` from the teammate’s set. `SendMessage` and the Task tools it adds stay available even when the list names them. * **`effort`** : for an in-process teammate, Claude Code applies the definition’s [`effort`](</docs/en/sub-agents#supported-frontmatter-fields>) under the [frontmatter effort rules](</docs/en/model-config#set-the-effort-level>). @@ -244,7 +244,7 @@ #### Messages between agents -When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate can’t approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action can’t relay it to another teammate to bypass the check. The same rules apply to a message that arrives from [one of your other Claude Code sessions](</docs/en/cross-session-messaging#how-a-session-treats-an-incoming-message>), outside the team entirely. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier applies two checks to messages between agents: +A message that a teammate or [one of your other Claude Code sessions](</docs/en/cross-session-messaging#how-a-session-treats-an-incoming-message>) sends with `SendMessage` can’t answer a permission prompt on your behalf. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier applies two checks to messages between agents: * It treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. * It reviews `SendMessage` messages before Claude Code delivers them, including structured protocol messages such as a shutdown request. A message it blocks isn’t delivered. Before you rely on this review, check [which messages skip it](</docs/en/permission-modes#how-the-classifier-evaluates-actions>).
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -130,7 +130,7 @@ `teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead. -Claude Code checks the model it selects for a teammate against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: +Claude Code checks the model it selects for a teammate against any [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate, or one whose family has no permitted version** : Claude Code runs the teammate on the lead’s model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -67,7 +67,7 @@ Agent teams support two display modes: - * **In-process** : all teammates run inside your main terminal. Use the up and down arrow keys in the agent panel to select a teammate, then press Enter to view it and type to message it directly. Works in any terminal, no extra setup required. + * **In-process** : all teammates run inside your main terminal. Use the up and down arrow keys in the agent panel to select a teammate, then press Enter to view it and type to message it directly. Works in any terminal. * **Split panes** : each teammate gets its own pane. You can see everyone’s output at once and click into a pane to interact directly. Requires tmux, or iTerm2. `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. @@ -253,7 +253,7 @@ Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. If you start the lead with [`--setting-sources`](</docs/en/cli-reference#cli-flags>), teammates load from the same restricted list of sources. Before v2.1.281, split-pane teammates loaded every settings source. A teammate also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** - * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. + * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead and includes its final answer in the notification. A teammate whose turn ends on an API error notifies the lead that it failed and includes the error text. * **Shared task list** : [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) can see task status and claim available work. * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -247,7 +247,7 @@ When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate can’t approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action can’t relay it to another teammate to bypass the check. The same rules apply to a message that arrives from [one of your other Claude Code sessions](</docs/en/cross-session-messaging#how-a-session-treats-an-incoming-message>), outside the team entirely. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier applies two checks to messages between agents: * It treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. - * It reviews messages before Claude Code delivers them, including structured protocol messages such as a shutdown request. A message it blocks isn’t delivered. Before you rely on this review, check [which messages skip it](</docs/en/permission-modes#how-the-classifier-evaluates-actions>). + * It reviews `SendMessage` messages before Claude Code delivers them, including structured protocol messages such as a shutdown request. A message it blocks isn’t delivered. Before you rely on this review, check [which messages skip it](</docs/en/permission-modes#how-the-classifier-evaluates-actions>). ### Context and communication
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -247,7 +247,7 @@ When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate can’t approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action can’t relay it to another teammate to bypass the check. The same rules apply to a message that arrives from [one of your other Claude Code sessions](</docs/en/cross-session-messaging#how-a-session-treats-an-incoming-message>), outside the team entirely. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier applies two checks to messages between agents: * It treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. - * It reviews each message before Claude Code delivers it, whether a plain message or a structured protocol message such as a shutdown request or plan approval response. A message it blocks never reaches the recipient. + * It reviews messages before Claude Code delivers them, including structured protocol messages such as a shutdown request. A message it blocks isn’t delivered. Before you rely on this review, check [which messages skip it](</docs/en/permission-modes#how-the-classifier-evaluates-actions>). ### Context and communication
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -72,20 +72,45 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. Set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: +With agent teams enabled, follow these steps to give each teammate its own pane: + +1 + +Install tmux or set up iTerm2 + +Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). Set up the one you’ll run Claude Code in: + + * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions. + * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 > Settings > General > Magic > Enable Python API**. + +2 + +Turn on split panes + +Teammates run in-process until you change the [`teammateMode`](</docs/en/settings-reference#teammatemode>) setting.Set it to `"auto"` in `~/.claude/settings.json`: { "teammateMode": "auto" } +With `"auto"`, teammates open in split panes when you run Claude Code inside tmux or iTerm2, and run in-process in other terminals. + +3 + +Start Claude Code and spawn teammates + +Run `claude` inside tmux or in iTerm2, then ask Claude to spawn teammates.If a setup prompt for `it2` appears in iTerm2, select **Install it2 now** to open the panes in your iTerm2 window. + +If you run Claude Code outside tmux and iTerm2, or the panes don’t open in your iTerm2 window, change `teammateMode` again: + + * **Outside tmux and iTerm2** : with tmux installed, set `teammateMode` to `"tmux"`. The panes open in a separate tmux session. To watch them, copy the command from the `View teammates` line at the Claude Code prompt and run that command in a second terminal. + * **Panes don’t open in your iTerm2 window** : set `teammateMode` to `"iterm2"` to use iTerm2’s own panes. Teammates then start only when you run Claude Code in iTerm2 with `it2` set up. + To set the mode for a single session, pass it as a flag: claude --teammate-mode auto -The `--teammate-mode` flag is experimental and doesn’t appear in `claude --help`. Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually: - - * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions. - * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 → Settings → General → Magic → Enable Python API**. +The `--teammate-mode` flag is experimental and doesn’t appear in `claude --help`. ### Specify teammates and models @@ -379,7 +404,7 @@ * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **No per-teammate permission modes at spawn** : teammates start with the permission mode described under Permissions. - * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty. + * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. ## Next steps
modified
Show diff (459 lines)
--- a/agent-teams.md +++ b/agent-teams.md @@ -2,11 +2,7 @@ Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. You can also talk to any teammate directly without going through the lead. Before you set up a team, check whether a lighter option does the job. [Subagents](</docs/en/sub-agents>) work within a single session, and with [cross-session messaging](</docs/en/cross-session-messaging>) Claude can pass findings between the sessions you run yourself. -## - -​ - -When to use agent teams +## When to use agent teams Agent teams are most effective for tasks where parallel exploration adds real value. See use case examples for full scenarios. The strongest use cases are: @@ -17,11 +13,7 @@ Agent teams add coordination overhead and use significantly more tokens than a single session. They work best when teammates can operate independently. For sequential tasks, same-file edits, or work with many dependencies, a single session or [subagents](</docs/en/sub-agents>) are more effective. -### - -​ - -Compare with subagents +### Compare with subagents Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. For separate sessions that pass messages to each other without a team, see [cross-session messaging](</docs/en/cross-session-messaging>). @@ -37,11 +29,7 @@ Use subagents when you need quick, focused workers that report back. Use agent teams when teammates need to share findings, challenge each other, and coordinate on their own. -## - -​ - -Enable agent teams +## Enable agent teams Agent teams are disabled by default. Enable them by setting the `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` environment variable to `1`, either in your shell environment or through [settings.json](</docs/en/settings>): @@ -55,11 +43,7 @@ Enabling agent teams also changes ordinary delegation. Claude may [name a subagent](</docs/en/sub-agents#subagent-names>) on its own, and while agent teams are enabled, a subagent that Claude names launches as a teammate, so teams can form even when you didn’t ask for one. For more, see How Claude starts agent teams; to turn the behavior off, see Claude spawns teammates instead of subagents. Spawning teammates also requires an interactive session. In [non-interactive mode](</docs/en/headless>) with the `-p` flag, including Agent SDK sessions, Claude doesn’t spawn teammates, and a subagent that Claude names runs as an ordinary [subagent](</docs/en/sub-agents>) even with agent teams enabled. -## - -​ - -Start your first agent team +## Start your first agent team After enabling agent teams, describe the task and the teammates you want in natural language. Claude spawns them and coordinates work based on your prompt. This example works well because the three roles are independent and can explore the problem without waiting on each other: @@ -75,19 +59,11 @@ An idle teammate’s row stays in the panel while any teammate or subagent is still working, so you can select it to review its transcript or send it more work. Once every agent in the panel is idle, idle rows hide after 30 seconds and reappear on the teammate’s next turn; the teammate stays running and addressable while hidden. When more than three teammates are idle at once, the rows beyond the first three collapse into a single row that counts the collapsed teammates, such as `2 idle agents` when five are idle. Select it and press Enter to expand the collapsed rows, or press Esc to collapse them again. Working teammates, failed teammates, and the teammate you’re viewing always keep their own rows. If you want each teammate in its own split pane, see Choose a display mode. -## - -​ - -Control your agent team +## Control your agent team Tell the lead what you want in natural language. It handles team coordination, task assignment, and delegation based on your instructions. -### - -​ - -Choose a display mode +### Choose a display mode Agent teams support two display modes: @@ -111,11 +87,7 @@ * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions. * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 → Settings → General → Magic → Enable Python API**. -### - -​ - -Specify teammates and models +### Specify teammates and models Claude decides the number of teammates to spawn based on your task, or you can specify exactly what you want: @@ -140,11 +112,7 @@ By default, a teammate on the lead’s model inherits the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. For a teammate on another model, see [Effort level of subagents and teammates](</docs/en/model-config#effort-level-of-subagents-and-teammates>). -### - -​ - -Have teammates plan before implementing +### Have teammates plan before implementing For complex or risky tasks, you can have teammates plan before implementing. A teammate that Claude spawns while the lead is in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) also works in plan mode until its plan is ready. Switch the lead into plan mode first, then ask for the teammate: @@ -152,11 +120,7 @@ When that teammate finishes planning, it sends a plan approval request to the lead. If you haven’t changed that teammate’s permission mode since it was spawned, Claude Code approves the plan as soon as the request arrives, without the lead reviewing it. Once approved, the teammate exits plan mode and begins implementation. Claude Code passes it the lead’s current permission mode, or Manual if that’s plan mode. If you put a running in-process teammate in plan mode by pressing [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>) while viewing its session, the lead reviews that run’s plan instead of Claude Code approving it. You aren’t asked to approve it; the lead approves it or sends it back for revision. -### - -​ - -Talk to teammates directly +### Talk to teammates directly Each teammate is a full, independent Claude Code session. You can message any teammate directly to give additional instructions, ask follow-up questions, or redirect their approach. @@ -170,11 +134,7 @@ A teammate’s model and fast mode are fixed when it spawns. -### - -​ - -Assign and claim tasks +### Assign and claim tasks The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. A task can also depend on other tasks and shows as blocked in the task list until they’re completed. Teammates don’t self-claim a blocked task, but you or the lead can still assign it. Agents [without the Task tools](</docs/en/tools-reference#task-tool-availability>) coordinate through messages instead of the shared task list. The lead can assign tasks explicitly, or teammates can self-claim: @@ -183,11 +143,7 @@ Task claiming uses file locking to prevent race conditions when multiple teammates try to claim the same task simultaneously. -### - -​ - -Shut down teammates +### Shut down teammates To gracefully end a teammate’s session, refer to it by name. For example, with a teammate named researcher: @@ -195,11 +151,7 @@ The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. The team’s shared directories are cleaned up automatically when the session ends, so there’s no separate cleanup step. See Architecture for which directories are removed and which stay on disk. -### - -​ - -Enforce quality gates with hooks +### Enforce quality gates with hooks Use [hooks](</docs/en/hooks>) to enforce rules when teammates finish work or tasks are created or completed: @@ -207,27 +159,15 @@ * [`TaskCreated`](</docs/en/hooks#taskcreated>): runs when a task is being created. Exit with code 2 to prevent creation and send feedback. * [`TaskCompleted`](</docs/en/hooks#taskcompleted>): runs when a task is being marked complete. Exit with code 2 to prevent completion and send feedback. -## - -​ - -How agent teams work +## How agent teams work This section covers the architecture and mechanics behind agent teams. If you want to start using them, see Control your agent team above. -### - -​ - -How Claude starts agent teams +### How Claude starts agent teams To start a team, ask Claude for teammates. Claude launches a teammate when it calls the [Agent tool](</docs/en/tools-reference>) with a [`name`](</docs/en/sub-agents#subagent-names>) while agent teams are enabled, unless the call is a [fork](</docs/en/sub-agents#fork-the-current-conversation>) or passes `isolation` on the call itself. Claude Code doesn’t ask you to confirm the launch. Claude also names ordinary subagents on its own so it can message them later. Those calls follow the same rule, so teams can form even when you didn’t ask for one. If you want subagents instead, turn agent teams off. -### - -​ - -Architecture +### Architecture An agent team consists of: @@ -245,11 +185,7 @@ Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. -### - -​ - -Use subagent definitions for teammates +### Use subagent definitions for teammates When spawning a teammate in either display mode, you can reference a [subagent](</docs/en/sub-agents>) type from the project, user, managed, or plugin [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>). This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, name it when you ask Claude to spawn the teammate: @@ -268,11 +204,7 @@ When Claude messages an in-process teammate that is no longer running, Claude Code brings it back in the same session, restores any conversation saved for it, and gives it the message as its next prompt. After you resume a session, teammates aren’t brought back this way, per the resume limitation. For a teammate it brings back, Claude Code re-applies a definition that came from a project’s `.claude/agents/` directory or an `--add-dir` directory only if you’ve [trusted the folder the agent file is in](</docs/en/permissions#what-runs-before-you-trust-a-folder>). Trusting a parent folder doesn’t count. Until then, the teammate comes back with none of the definition’s tools or instructions, keeping only the tools Claude Code adds to every in-process teammate. See [the teammate’s agent definition was not restored](</docs/en/errors#teammate-agent-definition-not-restored>) for the notice text. -### - -​ - -Permissions +### Permissions To cycle a running teammate’s permission mode, press [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>), though an in-process teammate can run in the lead’s mode instead. For a split-pane teammate, press it in its pane. For an in-process teammate, press it while viewing its session, and the teammate checks its mode when it starts its next turn. @@ -285,22 +217,14 @@ Teammate permission prompts appear in the lead session, so approve them there yourself. You don’t need to approve a teammate’s plan. -#### - -​ - -Messages between agents +#### Messages between agents When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate can’t approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action can’t relay it to another teammate to bypass the check. The same rules apply to a message that arrives from [one of your other Claude Code sessions](</docs/en/cross-session-messaging#how-a-session-treats-an-incoming-message>), outside the team entirely. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier applies two checks to messages between agents: * It treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. * It reviews each message before Claude Code delivers it, whether a plain message or a structured protocol message such as a shutdown request or plan approval response. A message it blocks never reaches the recipient. -### - -​ - -Context and communication +### Context and communication Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. If you start the lead with [`--setting-sources`](</docs/en/cli-reference#cli-flags>), teammates load from the same restricted list of sources. Before v2.1.281, split-pane teammates loaded every settings source. A teammate also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** @@ -311,27 +235,15 @@ The lead assigns every teammate a name when it spawns them, and any teammate can message any other by that name. To get predictable names you can reference in later prompts, tell the lead what to call each teammate in your spawn instruction. -### - -​ - -Token usage +### Token usage Agent teams use significantly more tokens than a single session. Each teammate has its own context window, and token usage scales with the number of active teammates. For research, review, and new feature work, the extra tokens are usually worthwhile. For routine tasks, a single session is more cost-effective. See [agent team token costs](</docs/en/costs#agent-team-token-costs>) for usage guidance. An in-process teammate’s requests fall outside the main conversation’s [cache TTL bucket](</docs/en/prompt-caching#which-ttl-each-request-gets>), so its cache holds for five minutes by default, including on a Claude subscription. To keep it for an hour, set [`subagentPromptCacheTtl`](</docs/en/settings-reference#subagentpromptcachettl>) to `1h`. The API bills 1-hour cache writes at a higher rate. -## - -​ - -Use case examples +## Use case examples These examples show how agent teams handle tasks where parallel exploration adds value. -### - -​ - -Run a parallel code review +### Run a parallel code review A single reviewer tends to gravitate toward one type of issue at a time. Splitting review criteria into independent domains means security, performance, and test coverage all get thorough attention simultaneously. The prompt assigns each teammate a distinct lens so they don’t overlap: @@ -343,11 +255,7 @@ Each reviewer works from the same PR but applies a different filter. The lead synthesizes findings across all three after they finish. -### - -​ - -Investigate with competing hypotheses +### Investigate with competing hypotheses When the root cause is unclear, a single agent tends to find one plausible explanation and stop looking. The prompt fights this by making teammates explicitly adversarial: each one’s job is not only to investigate its own theory but to challenge the others’. @@ -358,17 +266,9 @@ The debate structure is the key mechanism here. Sequential investigation suffers from anchoring: once one theory is explored, subsequent investigation is biased toward it. With multiple independent investigators actively trying to disprove each other, the theory that survives is much more likely to be the actual root cause. -## - -​ - -Best practices - -### - -​ - -Give teammates enough context +## Best practices + +### Give teammates enough context Teammates load project context automatically, including CLAUDE.md, MCP servers, and skills, but they don’t inherit the lead’s conversation history. See Context and communication for details. Include task-specific details in the spawn prompt: @@ -377,11 +277,7 @@ management, and input validation. The app uses JWT tokens stored in httpOnly cookies. Report any issues with severity ratings." -### - -​ - -Choose an appropriate team size +### Choose an appropriate team size There’s no hard limit on the number of teammates, but practical constraints apply: @@ -391,11 +287,7 @@ Start with 3-5 teammates for most workflows. This balances parallel work with manageable coordination. If you have 15 independent tasks, 3 teammates is a good starting point. Scale up only when the work benefits from having teammates work simultaneously. Three focused teammates often outperform five scattered ones. -### - -​ - -Size tasks appropriately +### Size tasks appropriately * **Too small** : coordination overhead exceeds the benefit * **Too large** : teammates work too long without check-ins, increasing risk of wasted effort @@ -403,51 +295,27 @@ The lead breaks work into tasks and assigns them to teammates automatically. If it isn’t creating enough tasks, ask it to split the work into smaller pieces. Having 5-6 tasks per teammate keeps everyone productive and lets the lead reassign work if someone gets stuck. -### - -​ - -Wait for teammates to finish +### Wait for teammates to finish Sometimes the lead starts implementing tasks itself instead of waiting for teammates. If you notice this: Wait for your teammates to complete their tasks before proceeding -### - -​ - -Start with research and review +### Start with research and review If you’re new to agent teams, start with tasks that have clear boundaries and don’t require writing code: reviewing a PR, researching a library, or investigating a bug. These tasks show the value of parallel exploration without the coordination challenges that come with parallel implementation. -### - -​ - -Avoid file conflicts +### Avoid file conflicts Two teammates editing the same file leads to overwrites. Break the work so each teammate owns a different set of files. -### - -​ - -Monitor and steer +### Monitor and steer Check in on teammates’ progress, redirect approaches that aren’t working, and synthesize findings as they come in. Letting a team run unattended for too long increases the risk of wasted effort. -## - -​ - -Troubleshooting - -### - -​ - -Teammates not appearing +## Troubleshooting + +### Teammates not appearing If teammates aren’t appearing after you ask Claude to spawn them: @@ -460,11 +328,7 @@ * For iTerm2, verify the `it2` CLI is installed and the Python API is enabled in iTerm2 preferences. -### - -​ - -Claude spawns teammates instead of subagents +### Claude spawns teammates instead of subagents While agent teams are enabled, a subagent that Claude names in the lead’s session launches as a teammate. Claude can name subagents on its own, so this can happen during delegation you never framed as team work. To make named subagents launch as subagents again, turn agent teams off by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to `0`: @@ -483,19 +347,11 @@ After the change, Claude may still name subagents, and the name keeps working as a [`SendMessage` address](</docs/en/sub-agents#resume-subagents>). Claude receives each subagent’s result when it completes. -### - -​ - -Too many permission prompts +### Too many permission prompts Teammate permission requests bubble up to the lead, which can create friction. Pre-approve common operations in your [permission settings](</docs/en/permissions>) before spawning teammates to reduce interruptions. -### - -​ - -Agents stopping early +### Agents stopping early Teammates may stop after encountering errors instead of recovering. Check their output by selecting the teammate in the agent panel and pressing Enter in in-process mode, or by clicking the pane in split mode, then either: @@ -504,22 +360,14 @@ A message from the lead or another teammate wakes an in-process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. The lead can stop early too, deciding the team is finished before all tasks are actually complete. If that happens, tell it to keep going. -### - -​ - -Orphaned tmux sessions +### Orphaned tmux sessions If a tmux session persists after the Claude Code session ends, it may not have been fully cleaned up. List sessions and end the one created by the team: tmux ls tmux kill-session -t <session-name> -## - -​ - -Limitations +## Limitations Agent teams are experimental. Current limitations to be aware of: @@ -533,11 +381,7 @@ * **No per-teammate permission modes at spawn** : teammates start with the permission mode described under Permissions. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty. -## - -​ - -Next steps +## Next steps Explore related approaches for parallel work and delegation:
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,4 +1,4 @@ -Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. +Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. You can also talk to any teammate directly without going through the lead. Before you set up a team, check whether a lighter option does the job. [Subagents](</docs/en/sub-agents>) work within a single session, and with [cross-session messaging](</docs/en/cross-session-messaging>) Claude can pass findings between the sessions you run yourself.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -278,7 +278,7 @@ An in-process teammate that isn’t in plan mode runs in the lead’s mode while the lead is in [`acceptEdits`](</docs/en/permission-modes#auto-approve-file-edits-with-acceptedits-mode>), [`auto`](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), or [`bypassPermissions`](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) mode. Switching the teammate to Manual doesn’t change that, even if its status bar shows Manual.To have it ask before it edits, press Enter on the `main` row in the agent panel and switch the lead to Manual mode too. The lead then asks too, as does any other teammate in Manual mode. -You can’t set per-teammate permission modes at spawn time. A new teammate starts with the lead’s mode, including `bypassPermissions` mode, which `--dangerously-skip-permissions` turns on. If the lead is in [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), the teammate starts in [Manual mode](</docs/en/permission-modes#available-modes>) instead. An in-process teammate runs under the lead’s live allow and deny rules, so [`--disallowedTools`](</docs/en/cli-reference#cli-flags>), `--tools`, and `--allowedTools` all apply to it. For a split-pane teammate, check each flag: +You can’t set per-teammate permission modes at spawn time. A new teammate starts with the lead’s mode, including `bypassPermissions` mode, which `--dangerously-skip-permissions` turns on. If the lead is in [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), the teammate starts in [Manual mode](</docs/en/permission-modes#available-modes>) instead. For a split-pane teammate of a lead in Manual or `dontAsk` mode, this requires Claude Code v2.1.317 or later. An in-process teammate runs under the lead’s live allow and deny rules, so [`--disallowedTools`](</docs/en/cli-reference#cli-flags>), `--tools`, and `--allowedTools` all apply to it. For a split-pane teammate, check each flag: * **`--disallowedTools` and `--tools`**: the teammate starts with the lead’s command-line deny rules and tool list. Requires Claude Code v2.1.309 or later. * **`--allowedTools`** : Claude Code doesn’t pass this flag to a split-pane teammate, so an action you allowed with it alone isn’t pre-approved there. To approve those actions ahead of time, put the rules under `permissions.allow` in [`--settings`](</docs/en/settings#change-a-setting-for-one-session>) when you start the lead. For example, run `claude --settings '{"permissions":{"allow":["Bash(npm *)"]}}'` in your shell. The rules apply to the lead and each split-pane teammate for that session.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -138,7 +138,7 @@ * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate, or one whose family has no permitted version** : Claude Code runs the teammate on the lead’s model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules -By default, teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. +By default, a teammate on the lead’s model inherits the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. For a teammate on another model, see [Effort level of subagents and teammates](</docs/en/model-config#effort-level-of-subagents-and-teammates>). ### @@ -146,11 +146,11 @@ Have teammates plan before implementing -For complex or risky tasks, you can have teammates plan before implementing. A teammate that Claude spawns while the lead is in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) works in read-only plan mode until its plan is ready. Switch the lead into plan mode first, then ask for the teammate: +For complex or risky tasks, you can have teammates plan before implementing. A teammate that Claude spawns while the lead is in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) also works in plan mode until its plan is ready. Switch the lead into plan mode first, then ask for the teammate: Spawn an architect teammate to refactor the authentication module. -When that teammate finishes planning, it sends a plan approval request to the lead. If you haven’t changed that teammate’s permission mode since it was spawned, Claude Code approves the plan as soon as the request arrives, without the lead reviewing it. The teammate’s edits and commands still go through the permission prompts described in Permissions. Once approved, the teammate exits plan mode and begins implementation. If you put a running in-process teammate in plan mode by pressing [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>) while viewing its session, the lead reviews that run’s plan instead of Claude Code approving it. You aren’t asked to approve it; the lead approves it or sends it back for revision. +When that teammate finishes planning, it sends a plan approval request to the lead. If you haven’t changed that teammate’s permission mode since it was spawned, Claude Code approves the plan as soon as the request arrives, without the lead reviewing it. Once approved, the teammate exits plan mode and begins implementation. Claude Code passes it the lead’s current permission mode, or Manual if that’s plan mode. If you put a running in-process teammate in plan mode by pressing [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>) while viewing its session, the lead reviews that run’s plan instead of Claude Code approving it. You aren’t asked to approve it; the lead approves it or sends it back for revision. ### @@ -274,7 +274,11 @@ Permissions -Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. An in-process teammate runs under the lead’s live allow and deny rules, so [`--disallowedTools`](</docs/en/cli-reference#cli-flags>), `--tools`, and `--allowedTools` all apply to it. For a split-pane teammate, check each flag: +To cycle a running teammate’s permission mode, press [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>), though an in-process teammate can run in the lead’s mode instead. For a split-pane teammate, press it in its pane. For an in-process teammate, press it while viewing its session, and the teammate checks its mode when it starts its next turn. + +An in-process teammate that isn’t in plan mode runs in the lead’s mode while the lead is in [`acceptEdits`](</docs/en/permission-modes#auto-approve-file-edits-with-acceptedits-mode>), [`auto`](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), or [`bypassPermissions`](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) mode. Switching the teammate to Manual doesn’t change that, even if its status bar shows Manual.To have it ask before it edits, press Enter on the `main` row in the agent panel and switch the lead to Manual mode too. The lead then asks too, as does any other teammate in Manual mode. + +You can’t set per-teammate permission modes at spawn time. A new teammate starts with the lead’s mode, including `bypassPermissions` mode, which `--dangerously-skip-permissions` turns on. If the lead is in [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), the teammate starts in [Manual mode](</docs/en/permission-modes#available-modes>) instead. An in-process teammate runs under the lead’s live allow and deny rules, so [`--disallowedTools`](</docs/en/cli-reference#cli-flags>), `--tools`, and `--allowedTools` all apply to it. For a split-pane teammate, check each flag: * **`--disallowedTools` and `--tools`**: the teammate starts with the lead’s command-line deny rules and tool list. Requires Claude Code v2.1.309 or later. * **`--allowedTools`** : Claude Code doesn’t pass this flag to a split-pane teammate, so an action you allowed with it alone isn’t pre-approved there. To approve those actions ahead of time, put the rules under `permissions.allow` in [`--settings`](</docs/en/settings#change-a-setting-for-one-session>) when you start the lead. For example, run `claude --settings '{"permissions":{"allow":["Bash(npm *)"]}}'` in your shell. The rules apply to the lead and each split-pane teammate for that session. @@ -526,7 +530,7 @@ * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. - * **Permissions set at spawn** : teammates start with the permission mode described under Permissions. You can change an individual teammate’s permission mode after spawning, but you can’t set per-teammate permission modes at spawn time. + * **No per-teammate permission modes at spawn** : teammates start with the permission mode described under Permissions. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty. ##
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -176,7 +176,7 @@ Assign and claim tasks -The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed. Agents [without the Task tools](</docs/en/tools-reference#task-tool-availability>) coordinate through messages instead of the shared task list. The lead can assign tasks explicitly, or teammates can self-claim: +The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. A task can also depend on other tasks and shows as blocked in the task list until they’re completed. Teammates don’t self-claim a blocked task, but you or the lead can still assign it. Agents [without the Task tools](</docs/en/tools-reference#task-tool-availability>) coordinate through messages instead of the shared task list. The lead can assign tasks explicitly, or teammates can self-claim: * **Lead assigns** : tell the lead which task to give to which teammate * **Self-claim** : after finishing a task, a teammate picks up the next unassigned, unblocked task on its own
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -274,7 +274,12 @@ Permissions -Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. You don’t need to approve a teammate’s plan. +Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. An in-process teammate runs under the lead’s live allow and deny rules, so [`--disallowedTools`](</docs/en/cli-reference#cli-flags>), `--tools`, and `--allowedTools` all apply to it. For a split-pane teammate, check each flag: + + * **`--disallowedTools` and `--tools`**: the teammate starts with the lead’s command-line deny rules and tool list. Requires Claude Code v2.1.309 or later. + * **`--allowedTools`** : Claude Code doesn’t pass this flag to a split-pane teammate, so an action you allowed with it alone isn’t pre-approved there. To approve those actions ahead of time, put the rules under `permissions.allow` in [`--settings`](</docs/en/settings#change-a-setting-for-one-session>) when you start the lead. For example, run `claude --settings '{"permissions":{"allow":["Bash(npm *)"]}}'` in your shell. The rules apply to the lead and each split-pane teammate for that session. + +Teammate permission prompts appear in the lead session, so approve them there yourself. You don’t need to approve a teammate’s plan. ####
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -30,7 +30,7 @@ | Subagents| Agent teams ---|---|--- **Context**| Own context window; results return to the caller| Own context window; fully independent -**Communication**| Return a result to the caller. Subagents that Claude named when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>)| Teammates message each other directly +**Communication**| Return a result to the caller. Subagents that Claude [named](</docs/en/sub-agents#subagent-names>) when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>)| Teammates message each other directly **Coordination**| Main agent manages all work| Self-coordination through messages, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) **Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration **Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance @@ -150,7 +150,7 @@ Spawn an architect teammate to refactor the authentication module. -When a teammate finishes planning, it sends a plan approval request to the lead. Claude Code approves the plan in the lead’s session as soon as the request arrives, without the lead reviewing it. The teammate’s edits and commands still go through the permission prompts described in Permissions. Once approved, the teammate exits plan mode and begins implementation. +When that teammate finishes planning, it sends a plan approval request to the lead. If you haven’t changed that teammate’s permission mode since it was spawned, Claude Code approves the plan as soon as the request arrives, without the lead reviewing it. The teammate’s edits and commands still go through the permission prompts described in Permissions. Once approved, the teammate exits plan mode and begins implementation. If you put a running in-process teammate in plan mode by pressing [`Shift+Tab`](</docs/en/permission-modes#switch-permission-modes>) while viewing its session, the lead reviews that run’s plan instead of Claude Code approving it. You aren’t asked to approve it; the lead approves it or sends it back for revision. ### @@ -274,7 +274,7 @@ Permissions -Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. +Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. You don’t need to approve a teammate’s plan. ####
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -519,7 +519,7 @@ * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. * **One team per session** : a session has exactly one team, scoped to that session. You can’t create additional named teams or share a team across sessions. * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. - * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground, as described in [how Claude Code picks foreground or background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). + * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **Permissions set at spawn** : teammates start with the permission mode described under Permissions. You can change an individual teammate’s permission mode after spawning, but you can’t set per-teammate permission modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -193,7 +193,7 @@ Ask the researcher teammate to shut down -The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. The team’s shared directories are cleaned up automatically when the session ends, so there’s no separate cleanup step. See Architecture for which directories are removed and which persist for resumed sessions. +The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. The team’s shared directories are cleaned up automatically when the session ends, so there’s no separate cleanup step. See Architecture for which directories are removed and which stay on disk. ### @@ -240,10 +240,10 @@ Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Claude Code reports a message as sent only when the write to the recipient’s mailbox file succeeds, whether the message is plain text or a structured protocol message such as a plan approval or shutdown request. When the write fails, for example because the disk is full or the mailbox directory isn’t writable, the sending agent receives an error and nothing is sent. See [Failed to write to a teammate’s inbox](</docs/en/errors#failed-to-write-to-a-teammate-inbox>) for the error messages and recovery steps. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: - * **Team config** : `~/.claude/teams/{team-name}/config.json` - * **Task list** : `~/.claude/tasks/{team-name}/` - -Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) you already control for session transcripts, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. + * **Team config** : `~/.claude/teams/{team-name}/config.json`. Claude Code removes the team config directory when the session ends. + * **Task list** : `~/.claude/tasks/{team-name}/`. This directory stays on disk after the session ends. To change [how long Claude Code keeps it](</docs/en/claude-directory#cleaned-up-automatically>), set [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>). + +Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -261,6 +261,7 @@ * **`model`** : Claude Code uses the definition’s `model` in either display mode when your spawn prompt doesn’t name one. See how Claude Code picks a teammate’s model. * **`disallowedTools`** : for an in-process teammate, Claude Code removes the tools in the definition’s `disallowedTools` from the teammate’s set. `SendMessage` and the Task tools it adds stay available even when the list names them. * **`effort`** : for an in-process teammate, Claude Code applies the definition’s [`effort`](</docs/en/sub-agents#supported-frontmatter-fields>) under the [frontmatter effort rules](</docs/en/model-config#set-the-effort-level>). + * **`autoCompactWindow`** : for an in-process teammate, Claude Code applies the definition’s [`autoCompactWindow`](</docs/en/sub-agents#supported-frontmatter-fields>) under [that field’s rules](</docs/en/sub-agents#subagent-auto-compact-window>). A split-pane teammate ignores the field. Requires Claude Code v2.1.296 or later. * **Body** : for an in-process teammate, Claude Code appends the definition’s body to its default system prompt as additional instructions. For a split-pane teammate, Claude Code uses the body in place of its default system prompt. * **`skills`** : Claude Code doesn’t apply the definition’s `skills` to a teammate in either display mode. The teammate loads skills from your project and user settings. * **`mcpServers`** : for a split-pane teammate, Claude Code applies the definition’s `mcpServers` under the [rules for that field](</docs/en/sub-agents#scope-mcp-servers-to-a-subagent>), which cover a session started with `--agent` as well. An in-process teammate ignores the field and loads MCP servers from your project and user settings.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -238,7 +238,7 @@ **Task list**| Shared list of work items that teammates claim and complete **Mailbox**| Messaging system for communication between agents -Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. Claude Code reports a message as sent only when the write to the recipient’s mailbox file succeeds, whether the message is plain text or a structured protocol message such as a plan approval or shutdown request. When the write fails, for example because the disk is full or the mailbox directory isn’t writable, the sending agent receives an error and nothing is sent. See [Failed to write to a teammate’s inbox](</docs/en/errors#failed-to-write-to-a-teammate-inbox>) for the error messages and recovery steps. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: +Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Claude Code reports a message as sent only when the write to the recipient’s mailbox file succeeds, whether the message is plain text or a structured protocol message such as a plan approval or shutdown request. When the write fails, for example because the disk is full or the mailbox directory isn’t writable, the sending agent receives an error and nothing is sent. See [Failed to write to a teammate’s inbox](</docs/en/errors#failed-to-write-to-a-teammate-inbox>) for the error messages and recovery steps. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/`
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -129,7 +129,7 @@ 3. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. 4. The lead’s current model. -If you set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1`](</docs/en/sub-agents#run-every-subagent-on-one-model>), the first two sources don’t apply. Claude Code picks every teammate’s model from `CLAUDE_CODE_SUBAGENT_MODEL` when it’s set to anything other than `inherit`, and from the lead’s current model otherwise. Requires Claude Code v2.1.257 or later. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. +If an installed [mod](</docs/en/plugins/mods/overview>) sets a model in its [`agent.spawn`](</docs/en/plugins/mods/reference#subagents>) hook, Claude Code uses that model in place of the first source. If you set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1`](</docs/en/sub-agents#run-every-subagent-on-one-model>), the first two sources don’t apply. Claude Code picks every teammate’s model from `CLAUDE_CODE_SUBAGENT_MODEL` when it’s set to anything other than `inherit`, and from the lead’s current model otherwise. Requires Claude Code v2.1.257 or later. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. `teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -138,7 +138,7 @@ * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate, or one whose family has no permitted version** : Claude Code runs the teammate on the lead’s model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules -Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. +By default, teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. ### @@ -168,7 +168,7 @@ * `/compact`, `/clear`, and `/rewind` act on the lead’s conversation, so Claude Code asks you to confirm before running one of them from this view. * `/model` and `/fast` set the lead’s model and fast mode, not the teammate’s, so they don’t run from this view. A notice tells you why. -A teammate’s model and fast mode are fixed when it spawns. `/effort` still applies to the viewed teammate’s later turns, because teammates follow the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). +A teammate’s model and fast mode are fixed when it spawns. ### @@ -251,7 +251,7 @@ Use subagent definitions for teammates -When spawning a teammate in either display mode, you can reference a [subagent](</docs/en/sub-agents>) type from the project, user, or managed [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>). This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, name it when you ask Claude to spawn the teammate: +When spawning a teammate in either display mode, you can reference a [subagent](</docs/en/sub-agents>) type from the project, user, managed, or plugin [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>). This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, name it when you ask Claude to spawn the teammate: Spawn a teammate using the security-reviewer agent type to audit the auth module. @@ -259,6 +259,8 @@ * **`tools`** : Claude Code limits the teammate to the tools in the definition’s `tools` list. For an in-process teammate, Claude Code adds `SendMessage` to that list, and in a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>) it adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` too. * **`model`** : Claude Code uses the definition’s `model` in either display mode when your spawn prompt doesn’t name one. See how Claude Code picks a teammate’s model. + * **`disallowedTools`** : for an in-process teammate, Claude Code removes the tools in the definition’s `disallowedTools` from the teammate’s set. `SendMessage` and the Task tools it adds stay available even when the list names them. + * **`effort`** : for an in-process teammate, Claude Code applies the definition’s [`effort`](</docs/en/sub-agents#supported-frontmatter-fields>) under the [frontmatter effort rules](</docs/en/model-config#set-the-effort-level>). * **Body** : for an in-process teammate, Claude Code appends the definition’s body to its default system prompt as additional instructions. For a split-pane teammate, Claude Code uses the body in place of its default system prompt. * **`skills`** : Claude Code doesn’t apply the definition’s `skills` to a teammate in either display mode. The teammate loads skills from your project and user settings. * **`mcpServers`** : for a split-pane teammate, Claude Code applies the definition’s `mcpServers` under the [rules for that field](</docs/en/sub-agents#scope-mcp-servers-to-a-subagent>), which cover a session started with `--agent` as well. An in-process teammate ignores the field and loads MCP servers from your project and user settings.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -73,7 +73,7 @@ * **Enter** : open the selected teammate’s transcript and message it directly * **Escape** : clear the selection. While you’re viewing a teammate’s transcript, Escape interrupts that teammate’s current turn -As of v2.1.199, an idle teammate’s row stays in the panel while any teammate or subagent is still working, so you can select it to review its transcript or send it more work. Once every agent in the panel is idle, idle rows hide after 30 seconds and reappear on the teammate’s next turn; the teammate stays running and addressable while hidden. In v2.1.181 through v2.1.198, an idle row hid 30 seconds after its own turn ended, even while other teammates were still working; idle rows are not hidden on versions before v2.1.181. When more than three teammates are idle at once, the rows beyond the first three collapse into a single row that counts the collapsed teammates, such as `2 idle agents` when five are idle. Select it and press Enter to expand the collapsed rows, or press Esc to collapse them again. Working teammates, failed teammates, and the teammate you’re viewing always keep their own rows. If you want each teammate in its own split pane, see Choose a display mode. +An idle teammate’s row stays in the panel while any teammate or subagent is still working, so you can select it to review its transcript or send it more work. Once every agent in the panel is idle, idle rows hide after 30 seconds and reappear on the teammate’s next turn; the teammate stays running and addressable while hidden. When more than three teammates are idle at once, the rows beyond the first three collapse into a single row that counts the collapsed teammates, such as `2 idle agents` when five are idle. Select it and press Enter to expand the collapsed rows, or press Esc to collapse them again. Working teammates, failed teammates, and the teammate you’re viewing always keep their own rows. If you want each teammate in its own split pane, see Choose a display mode. ##
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -163,7 +163,12 @@ * **In-process mode** : use the up and down arrow keys in the agent panel to select a teammate, then press Enter to view its session and type to send it a message. Press `x` on a selected teammate to stop it. Press Ctrl+T to toggle the task list. * **Split-pane mode** : click into a teammate’s pane to interact with their session directly. Each teammate has a full view of their own terminal. -While you’re viewing an in-process teammate, plain text and [skills](</docs/en/skills>) go to that teammate, but built-in commands still run in the lead’s session. A teammate’s model and fast mode are fixed when it spawns, so `/model` and `/fast` only change the lead’s settings. As of v2.1.199, typing either command while viewing a teammate shows a notice that the change applies to the lead; earlier versions applied it to the lead with no indication. `/effort` still applies to the viewed teammate’s later turns, because teammates follow the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). +While you’re viewing an in-process teammate, plain text and [skills](</docs/en/skills>) go to that teammate, and built-in commands go to the lead’s session, with these safeguards: + + * `/compact`, `/clear`, and `/rewind` act on the lead’s conversation, so Claude Code asks you to confirm before running one of them from this view. + * `/model` and `/fast` set the lead’s model and fast mode, not the teammate’s, so they don’t run from this view. A notice tells you why. + +A teammate’s model and fast mode are fixed when it spawns. `/effort` still applies to the viewed teammate’s later turns, because teammates follow the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -285,7 +285,7 @@ Context and communication -Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. It also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** +Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. If you start the lead with [`--setting-sources`](</docs/en/cli-reference#cli-flags>), teammates load from the same restricted list of sources. Before v2.1.281, split-pane teammates loaded every settings source. A teammate also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead and includes its final answer in the notification. A teammate whose turn ends on an API error notifies the lead that it failed and includes the error text.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -96,7 +96,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: +The default is `"in-process"`. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. Set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: { "teammateMode": "auto"
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,8 +1,6 @@ Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. You can also talk to any teammate directly without going through the lead. Before you set up a team, check whether a lighter option does the job. [Subagents](</docs/en/sub-agents>) work within a single session, and with [cross-session messaging](</docs/en/cross-session-messaging>) Claude can pass findings between the sessions you run yourself. - -This page describes agent teams as of v2.1.178. With `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set, spawning a teammate no longer needs a setup step, and cleanup happens automatically when the session exits. Before v2.1.178, you asked Claude to create and name a team first, and Claude used the `TeamCreate` and `TeamDelete` tools to set it up and remove it. Both tools no longer exist. The `team_name` input on the Agent tool is accepted but ignored, and the `team_name` field in `TaskCreated`, `TaskCompleted`, and `TeammateIdle` [hook payloads](</docs/en/hooks#taskcreated>) carries the session-derived name and is deprecated. ##
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -259,6 +259,8 @@ * **Body** : for an in-process teammate, Claude Code appends the definition’s body to its default system prompt as additional instructions. For a split-pane teammate, Claude Code uses the body in place of its default system prompt. * **`skills`** : Claude Code doesn’t apply the definition’s `skills` to a teammate in either display mode. The teammate loads skills from your project and user settings. * **`mcpServers`** : for a split-pane teammate, Claude Code applies the definition’s `mcpServers` under the [rules for that field](</docs/en/sub-agents#scope-mcp-servers-to-a-subagent>), which cover a session started with `--agent` as well. An in-process teammate ignores the field and loads MCP servers from your project and user settings. + +When Claude messages an in-process teammate that is no longer running, Claude Code brings it back in the same session, restores any conversation saved for it, and gives it the message as its next prompt. After you resume a session, teammates aren’t brought back this way, per the resume limitation. For a teammate it brings back, Claude Code re-applies a definition that came from a project’s `.claude/agents/` directory or an `--add-dir` directory only if you’ve [trusted the folder the agent file is in](</docs/en/permissions#what-runs-before-you-trust-a-folder>). Trusting a parent folder doesn’t count. Until then, the teammate comes back with none of the definition’s tools or instructions, keeping only the tools Claude Code adds to every in-process teammate. See [the teammate’s agent definition was not restored](</docs/en/errors#teammate-agent-definition-not-restored>) for the notice text. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -98,7 +98,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: +The default is `"in-process"`. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: { "teammateMode": "auto"
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -218,7 +218,7 @@ How Claude starts agent teams -To start a team, ask Claude for teammates. Claude launches a teammate when it calls the [Agent tool](</docs/en/tools-reference>) with a [`name`](</docs/en/sub-agents#subagent-names>) while agent teams are enabled, and Claude Code doesn’t ask you to confirm. Claude also names ordinary subagents on its own so it can message them later, and while agent teams are enabled, a named subagent launches as a teammate, so teams can form even when you didn’t ask for one. If you want subagents instead, turn agent teams off. +To start a team, ask Claude for teammates. Claude launches a teammate when it calls the [Agent tool](</docs/en/tools-reference>) with a [`name`](</docs/en/sub-agents#subagent-names>) while agent teams are enabled, unless the call is a [fork](</docs/en/sub-agents#fork-the-current-conversation>) or passes `isolation` on the call itself. Claude Code doesn’t ask you to confirm the launch. Claude also names ordinary subagents on its own so it can message them later. Those calls follow the same rule, so teams can form even when you didn’t ask for one. If you want subagents instead, turn agent teams off. ### @@ -248,7 +248,7 @@ Use subagent definitions for teammates -When spawning a teammate, you can reference a [subagent](</docs/en/sub-agents>) type from any [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>): project, user, plugin, or CLI-defined. This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, name it when you ask Claude to spawn the teammate: +When spawning a teammate in either display mode, you can reference a [subagent](</docs/en/sub-agents>) type from the project, user, or managed [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>). This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, name it when you ask Claude to spawn the teammate: Spawn a teammate using the security-reviewer agent type to audit the auth module. @@ -266,7 +266,7 @@ Permissions -Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. +Teammates start with the lead’s permission mode, except [`dontAsk` mode](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>), which they don’t inherit. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change an individual teammate’s permission mode, but you can’t set per-teammate permission modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. #### @@ -513,7 +513,7 @@ * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground, as described in [how Claude Code picks foreground or background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. - * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time. + * **Permissions set at spawn** : teammates start with the permission mode described under Permissions. You can change an individual teammate’s permission mode after spawning, but you can’t set per-teammate permission modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty. ##
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -131,7 +131,7 @@ 3. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. 4. The lead’s current model. -[`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>) applies to teammates as well as to subagents. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. +If you set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1`](</docs/en/sub-agents#run-every-subagent-on-one-model>), the first two sources don’t apply. Claude Code picks every teammate’s model from `CLAUDE_CODE_SUBAGENT_MODEL` when it’s set to anything other than `inherit`, and from the lead’s current model otherwise. Requires Claude Code v2.1.257 or later. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. `teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -131,7 +131,7 @@ 3. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. 4. The lead’s current model. -[`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#choose-a-model>) applies to teammates as well as to subagents. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. +[`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>) applies to teammates as well as to subagents. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. `teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -131,7 +131,7 @@ 3. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. 4. The lead’s current model. -Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. +[`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#choose-a-model>) applies to teammates as well as to subagents. Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. `teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -126,17 +126,19 @@ Claude Code picks each teammate’s model from the first of these that applies: - 1. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. - 2. The model your spawn prompt names for that teammate. - 3. For an in-process teammate spawned from a subagent definition, the definition’s `model`. + 1. The model your spawn prompt names for that teammate. + 2. For a teammate spawned from a subagent definition, the definition’s `model`, where `inherit` selects the lead’s model. + 3. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. 4. The lead’s current model. -`teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt or set `CLAUDE_CODE_SUBAGENT_MODEL` instead. - -Claude Code checks the model your prompt requests for a teammate, or the one `CLAUDE_CODE_SUBAGENT_MODEL` supplies, against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: +Before v2.1.251, `CLAUDE_CODE_SUBAGENT_MODEL` came first in this order. + +`teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt instead. + +Claude Code checks the model it selects for a teammate against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet - * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate or whose family has no permitted version** : Claude Code runs the teammate on the lead’s model + * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate, or one whose family has no permitted version** : Claude Code runs the teammate on the lead’s model instead. If you set `CLAUDE_CODE_SUBAGENT_MODEL`, Claude Code tries that model first, under these same rules Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. @@ -253,7 +255,7 @@ Claude Code reads the subagent definition you named and applies these parts of it to the teammate. Where a part depends on the teammate’s display mode, the entry says so: * **`tools`** : Claude Code limits the teammate to the tools in the definition’s `tools` list. For an in-process teammate, Claude Code adds `SendMessage` to that list, and in a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>) it adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` too. - * **`model`** : for an in-process teammate, Claude Code uses the definition’s `model` when neither `CLAUDE_CODE_SUBAGENT_MODEL` nor your spawn prompt names a model. A split-pane teammate doesn’t use the definition’s `model`. See how Claude Code picks a teammate’s model. + * **`model`** : Claude Code uses the definition’s `model` in either display mode when your spawn prompt doesn’t name one. See how Claude Code picks a teammate’s model. * **Body** : for an in-process teammate, Claude Code appends the definition’s body to its default system prompt as additional instructions. For a split-pane teammate, Claude Code uses the body in place of its default system prompt. * **`skills`** : Claude Code doesn’t apply the definition’s `skills` to a teammate in either display mode. The teammate loads skills from your project and user settings. * **`mcpServers`** : for a split-pane teammate, Claude Code applies the definition’s `mcpServers` under the [rules for that field](</docs/en/sub-agents#scope-mcp-servers-to-a-subagent>), which cover a session started with `--agent` as well. An in-process teammate ignores the field and loads MCP servers from your project and user settings.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -286,7 +286,7 @@ Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. It also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. - * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. The notification doesn’t carry the teammate’s output; a teammate shares results by messaging the lead or updating the shared task list. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. + * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead and includes its final answer in the notification. A teammate whose turn ends on an API error notifies the lead that it failed and includes the error text. * **Shared task list** : [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) can see task status and claim available work. * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient. @@ -370,7 +370,7 @@ * **Coordination overhead increases** : more teammates means more communication, task coordination, and potential for conflicts * **Diminishing returns** : beyond a certain point, additional teammates don’t speed up work proportionally -Start with 3-5 teammates for most workflows. This balances parallel work with manageable coordination. If you have 15 independent tasks, 3 teammates is a good starting point. Scale up only when the work genuinely benefits from having teammates work simultaneously. Three focused teammates often outperform five scattered ones. +Start with 3-5 teammates for most workflows. This balances parallel work with manageable coordination. If you have 15 independent tasks, 3 teammates is a good starting point. Scale up only when the work benefits from having teammates work simultaneously. Three focused teammates often outperform five scattered ones. ### @@ -447,12 +447,7 @@ Claude spawns teammates instead of subagents -While agent teams are enabled, a subagent that Claude names in the lead’s session launches as a teammate. Claude can name subagents on its own, so this can happen during delegation you never framed as team work. Subagents and teammates report back differently: - - * **Subagents** : Claude receives the subagent’s result when it completes. - * **Teammates** : the idle notification reports that the teammate stopped, without its output. - -An orchestration flow that waits on subagent results can stall. To make named subagents launch as subagents again, turn agent teams off by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to `0`: +While agent teams are enabled, a subagent that Claude names in the lead’s session launches as a teammate. Claude can name subagents on its own, so this can happen during delegation you never framed as team work. To make named subagents launch as subagents again, turn agent teams off by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to `0`: settings.json
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,6 +1,6 @@ Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. -Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session, you can also interact with individual teammates directly without going through the lead. +Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. You can also talk to any teammate directly without going through the lead. Before you set up a team, check whether a lighter option does the job. [Subagents](</docs/en/sub-agents>) work within a single session, and with [cross-session messaging](</docs/en/cross-session-messaging>) Claude can pass findings between the sessions you run yourself. This page describes agent teams as of v2.1.178. With `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set, spawning a teammate no longer needs a setup step, and cleanup happens automatically when the session exits. Before v2.1.178, you asked Claude to create and name a team first, and Claude used the `TeamCreate` and `TeamDelete` tools to set it up and remove it. Both tools no longer exist. The `team_name` input on the Agent tool is accepted but ignored, and the `team_name` field in `TaskCreated`, `TaskCompleted`, and `TeammateIdle` [hook payloads](</docs/en/hooks#taskcreated>) carries the session-derived name and is deprecated. @@ -73,7 +73,7 @@ * **Up and down arrows** : select a teammate * **Enter** : open the selected teammate’s transcript and message it directly - * **Escape** : interrupt the selected teammate’s current turn + * **Escape** : clear the selection. While you’re viewing a teammate’s transcript, Escape interrupts that teammate’s current turn As of v2.1.199, an idle teammate’s row stays in the panel while any teammate or subagent is still working, so you can select it to review its transcript or send it more work. Once every agent in the panel is idle, idle rows hide after 30 seconds and reappear on the teammate’s next turn; the teammate stays running and addressable while hidden. In v2.1.181 through v2.1.198, an idle row hid 30 seconds after its own turn ended, even while other teammates were still working; idle rows are not hidden on versions before v2.1.181. When more than three teammates are idle at once, the rows beyond the first three collapse into a single row that counts the collapsed teammates, such as `2 idle agents` when five are idle. Select it and press Enter to expand the collapsed rows, or press Esc to collapse them again. Working teammates, failed teammates, and the teammate you’re viewing always keep their own rows. If you want each teammate in its own split pane, see Choose a display mode. @@ -124,7 +124,12 @@ Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. -When your prompt doesn’t name a model for a teammate, Claude Code runs the teammate on the lead’s current model, unless [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>) is set. +Claude Code picks each teammate’s model from the first of these that applies: + + 1. [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>), when it’s set to anything other than `inherit`. + 2. The model your spawn prompt names for that teammate. + 3. For an in-process teammate spawned from a subagent definition, the definition’s `model`. + 4. The lead’s current model. `teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt or set `CLAUDE_CODE_SUBAGENT_MODEL` instead. @@ -139,14 +144,13 @@ ​ -Require plan approval for teammates - -For complex or risky tasks, you can require teammates to plan before implementing. The teammate works in read-only plan mode until the lead approves their approach: +Have teammates plan before implementing + +For complex or risky tasks, you can have teammates plan before implementing. A teammate that Claude spawns while the lead is in [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) works in read-only plan mode until its plan is ready. Switch the lead into plan mode first, then ask for the teammate: Spawn an architect teammate to refactor the authentication module. - Require plan approval before they make any changes. - -When a teammate finishes planning, it sends a plan approval request to the lead. The lead reviews the plan and either approves it or rejects it with feedback. If rejected, the teammate stays in plan mode, revises based on the feedback, and resubmits. Once approved, the teammate exits plan mode and begins implementation. The lead makes approval decisions autonomously. To influence the lead’s judgment, give it criteria in your prompt, such as “only approve plans that include test coverage” or “reject plans that modify the database schema.” + +When a teammate finishes planning, it sends a plan approval request to the lead. Claude Code approves the plan in the lead’s session as soon as the request arrives, without the lead reviewing it. The teammate’s edits and commands still go through the permission prompts described in Permissions. Once approved, the teammate exits plan mode and begins implementation. ### @@ -242,13 +246,17 @@ Use subagent definitions for teammates -When spawning a teammate, you can reference a [subagent](</docs/en/sub-agents>) type from any [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>): project, user, plugin, or CLI-defined. This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, mention it by name when asking Claude to spawn the teammate: +When spawning a teammate, you can reference a [subagent](</docs/en/sub-agents>) type from any [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>): project, user, plugin, or CLI-defined. This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, name it when you ask Claude to spawn the teammate: Spawn a teammate using the security-reviewer agent type to audit the auth module. -The teammate honors that definition’s `tools` allowlist and `model`, and the definition’s body is appended to the teammate’s system prompt as additional instructions rather than replacing it. For an in-process teammate, Claude Code adds `SendMessage` to that allowlist. In a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>), Claude Code adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` to it too. - -The `skills` and `mcpServers` frontmatter fields in a subagent definition are not applied when that definition runs as a teammate. Teammates load skills and MCP servers from your project and user settings, the same as a regular session. +Claude Code reads the subagent definition you named and applies these parts of it to the teammate. Where a part depends on the teammate’s display mode, the entry says so: + + * **`tools`** : Claude Code limits the teammate to the tools in the definition’s `tools` list. For an in-process teammate, Claude Code adds `SendMessage` to that list, and in a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>) it adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` too. + * **`model`** : for an in-process teammate, Claude Code uses the definition’s `model` when neither `CLAUDE_CODE_SUBAGENT_MODEL` nor your spawn prompt names a model. A split-pane teammate doesn’t use the definition’s `model`. See how Claude Code picks a teammate’s model. + * **Body** : for an in-process teammate, Claude Code appends the definition’s body to its default system prompt as additional instructions. For a split-pane teammate, Claude Code uses the body in place of its default system prompt. + * **`skills`** : Claude Code doesn’t apply the definition’s `skills` to a teammate in either display mode. The teammate loads skills from your project and user settings. + * **`mcpServers`** : for a split-pane teammate, Claude Code applies the definition’s `mcpServers` under the [rules for that field](</docs/en/sub-agents#scope-mcp-servers-to-a-subagent>), which cover a session started with `--agent` as well. An in-process teammate ignores the field and loads MCP servers from your project and user settings. ### @@ -520,4 +528,5 @@ Explore related approaches for parallel work and delegation: * **Lightweight delegation** : [subagents](</docs/en/sub-agents>) spawn helper agents for research or verification within your session, better for tasks that don’t need inter-agent coordination + * **Messaging between your own sessions** : [cross-session messaging](</docs/en/cross-session-messaging>) lets Claude pass findings between the sessions you run yourself * **Manual parallel sessions** : [Git worktrees](</docs/en/worktrees>) let you run multiple Claude Code sessions yourself without automated team coordination
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -290,7 +290,7 @@ Token usage -Agent teams use significantly more tokens than a single session. Each teammate has its own context window, and token usage scales with the number of active teammates. For research, review, and new feature work, the extra tokens are usually worthwhile. For routine tasks, a single session is more cost-effective. See [agent team token costs](</docs/en/costs#agent-team-token-costs>) for usage guidance. +Agent teams use significantly more tokens than a single session. Each teammate has its own context window, and token usage scales with the number of active teammates. For research, review, and new feature work, the extra tokens are usually worthwhile. For routine tasks, a single session is more cost-effective. See [agent team token costs](</docs/en/costs#agent-team-token-costs>) for usage guidance. An in-process teammate’s requests fall outside the main conversation’s [cache TTL bucket](</docs/en/prompt-caching#which-ttl-each-request-gets>), so its cache holds for five minutes by default, including on a Claude subscription. To keep it for an hour, set [`subagentPromptCacheTtl`](</docs/en/settings-reference#subagentpromptcachettl>) to `1h`. The API bills 1-hour cache writes at a higher rate. ##
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,6 +1,6 @@ Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. -Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead. +Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session, you can also interact with individual teammates directly without going through the lead. This page describes agent teams as of v2.1.178. With `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set, spawning a teammate no longer needs a setup step, and cleanup happens automatically when the session exits. Before v2.1.178, you asked Claude to create and name a team first, and Claude used the `TeamCreate` and `TeamDelete` tools to set it up and remove it. Both tools no longer exist. The `team_name` input on the Agent tool is accepted but ignored, and the `team_name` field in `TaskCreated`, `TaskCompleted`, and `TeammateIdle` [hook payloads](</docs/en/hooks#taskcreated>) carries the session-derived name and is deprecated. @@ -25,14 +25,14 @@ Compare with subagents -Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. Choose based on whether your workers need to communicate with each other. For separate sessions that pass messages to each other without a team, see [cross-session messaging](</docs/en/cross-session-messaging>). - -Subagents only report results back to the main agent and never talk to each other. In agent teams, teammates share a task list, claim work, and communicate directly with each other. +Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. For separate sessions that pass messages to each other without a team, see [cross-session messaging](</docs/en/cross-session-messaging>). + +Subagents report results back to the main agent. In agent teams, teammates share a task list, claim work, and communicate directly with each other. | Subagents| Agent teams ---|---|--- **Context**| Own context window; results return to the caller| Own context window; fully independent -**Communication**| Report results back to the main agent only| Teammates message each other directly +**Communication**| Return a result to the caller. Subagents that Claude named when it spawned them can also [message each other](</docs/en/sub-agents#what-loads-at-startup>)| Teammates message each other directly **Coordination**| Main agent manages all work| Self-coordination through messages, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) **Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration **Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance @@ -98,7 +98,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: +The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings-reference#teammatemode>) in `~/.claude/settings.json`: { "teammateMode": "auto" @@ -234,7 +234,7 @@ * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. +Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings-reference#cleanupperioddays>) you already control for session transcripts, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ### @@ -521,4 +521,3 @@ * **Lightweight delegation** : [subagents](</docs/en/sub-agents>) spawn helper agents for research or verification within your session, better for tasks that don’t need inter-agent coordination * **Manual parallel sessions** : [Git worktrees](</docs/en/worktrees>) let you run multiple Claude Code sessions yourself without automated team coordination - * **Compare approaches** : see the [subagent vs agent team](</docs/en/features-overview#compare-similar-features>) comparison for a side-by-side breakdown
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -506,7 +506,7 @@ * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. * **One team per session** : a session has exactly one team, scoped to that session. You can’t create additional named teams or share a team across sessions. * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. - * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground. Asking for a background one, whether with `run_in_background` or a subagent definition that sets `background: true`, returns an error, because a teammate’s background work can’t outlive the lead’s process. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). + * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground, because a teammate’s background work can’t outlive the lead’s process. Claude Code returns an error when a teammate spawns a subagent whose definition sets `background: true`. A teammate’s `run_in_background: true` request also fails, either with an error or by running silently in the foreground, as described in [how Claude Code picks foreground or background](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -124,10 +124,14 @@ Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. -Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. Claude Code checks each teammate’s model, whether requested in your prompt or set through **Default teammate model** , against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: +When your prompt doesn’t name a model for a teammate, Claude Code runs the teammate on the lead’s current model, unless [`CLAUDE_CODE_SUBAGENT_MODEL`](</docs/en/model-config#environment-variables>) is set. + +`teammateDefaultModel` was removed in v2.1.234; Claude Code ignores a leftover value. Name the model in your prompt or set `CLAUDE_CODE_SUBAGENT_MODEL` instead. + +Claude Code checks the model your prompt requests for a teammate, or the one `CLAUDE_CODE_SUBAGENT_MODEL` supplies, against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet - * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate or whose family has no permitted version** : Claude Code uses the default teammate model. When the blocked value is the **Default teammate model** setting itself, Claude Code uses your provider’s default Opus model, or the lead’s model when the allowlist blocks that too + * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate or whose family has no permitted version** : Claude Code runs the teammate on the lead’s model Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -69,7 +69,7 @@ their codebase. Spawn three teammates to explore this from different angles: one on UX, one on technical architecture, one playing devil's advocate. -From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. Claude may sometimes use [subagents](</docs/en/sub-agents>) instead of creating a team. Subagents appear in the same agent panel as teammates, so the panel alone doesn’t confirm a team formed. If Claude spawned subagents instead, ask again and explicitly request an agent team. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel: +From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>) in a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. Claude may sometimes use [subagents](</docs/en/sub-agents>) instead of creating a team. Subagents appear in the same agent panel as teammates, so the panel alone doesn’t confirm a team formed. If Claude spawned subagents instead, ask again and explicitly request an agent team. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel: * **Up and down arrows** : select a teammate * **Enter** : open the selected teammate’s transcript and message it directly @@ -275,7 +275,7 @@ * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. The notification doesn’t carry the teammate’s output; a teammate shares results by messaging the lead or updating the shared task list. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. - * **Shared task list** : all agents can see task status and claim available work. + * **Shared task list** : [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) can see task status and claim available work. * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient. The lead assigns every teammate a name when it spawns them, and any teammate can message any other by that name. To get predictable names you can reference in later prompts, tell the lead what to call each teammate in your spawn instruction.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -33,7 +33,7 @@ ---|---|--- **Context**| Own context window; results return to the caller| Own context window; fully independent **Communication**| Report results back to the main agent only| Teammates message each other directly -**Coordination**| Main agent manages all work| Shared task list with self-coordination +**Coordination**| Main agent manages all work| Self-coordination through messages, plus a shared task list for [agents that have the Task tools](</docs/en/tools-reference#task-tool-availability>) **Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration **Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance @@ -55,6 +55,8 @@ } } +Enabling agent teams also changes ordinary delegation. Claude may [name a subagent](</docs/en/sub-agents#subagent-names>) on its own, and while agent teams are enabled, a subagent that Claude names launches as a teammate, so teams can form even when you didn’t ask for one. For more, see How Claude starts agent teams; to turn the behavior off, see Claude spawns teammates instead of subagents. Spawning teammates also requires an interactive session. In [non-interactive mode](</docs/en/headless>) with the `-p` flag, including Agent SDK sessions, Claude doesn’t spawn teammates, and a subagent that Claude names runs as an ordinary [subagent](</docs/en/sub-agents>) even with agent teams enabled. + ## ​ @@ -161,7 +163,7 @@ Assign and claim tasks -The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed. The lead can assign tasks explicitly, or teammates can self-claim: +The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed. Agents [without the Task tools](</docs/en/tools-reference#task-tool-availability>) coordinate through messages instead of the shared task list. The lead can assign tasks explicitly, or teammates can self-claim: * **Lead assigns** : tell the lead which task to give to which teammate * **Self-claim** : after finishing a task, a teammate picks up the next unassigned, unblocked task on its own @@ -206,12 +208,7 @@ How Claude starts agent teams -An agent team forms when the first teammate is spawned, with the main session acting as the lead. There are two ways teammates get spawned: - - * **You request teammates** : give Claude a task that benefits from parallel work and explicitly ask for teammates. Claude spawns them based on your instructions. - * **Claude proposes teammates** : if Claude determines your task would benefit from parallel work, it may suggest spawning teammates. You confirm before it proceeds. - -In both cases, you stay in control. Claude won’t spawn teammates without your approval. +To start a team, ask Claude for teammates. Claude launches a teammate when it calls the [Agent tool](</docs/en/tools-reference>) with a [`name`](</docs/en/sub-agents#subagent-names>) while agent teams are enabled, and Claude Code doesn’t ask you to confirm. Claude also names ordinary subagents on its own so it can message them later, and while agent teams are enabled, a named subagent launches as a teammate, so teams can form even when you didn’t ask for one. If you want subagents instead, turn agent teams off. ### @@ -245,7 +242,7 @@ Spawn a teammate using the security-reviewer agent type to audit the auth module. -The teammate honors that definition’s `tools` allowlist and `model`, and the definition’s body is appended to the teammate’s system prompt as additional instructions rather than replacing it. Team coordination tools such as `SendMessage` and the task management tools are always available to a teammate even when `tools` restricts other tools. +The teammate honors that definition’s `tools` allowlist and `model`, and the definition’s body is appended to the teammate’s system prompt as additional instructions rather than replacing it. For an in-process teammate, Claude Code adds `SendMessage` to that allowlist. In a [session that has the Task tools](</docs/en/tools-reference#task-tool-availability>), Claude Code adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` to it too. The `skills` and `mcpServers` frontmatter fields in a subagent definition are not applied when that definition runs as a teammate. Teammates load skills and MCP servers from your project and user settings, the same as a regular session. @@ -277,7 +274,7 @@ Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. It also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. - * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. + * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. The notification doesn’t carry the teammate’s output; a teammate shares results by messaging the lead or updating the shared task list. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. * **Shared task list** : all agents can see task status and claim available work. * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient. @@ -431,6 +428,34 @@ which tmux * For iTerm2, verify the `it2` CLI is installed and the Python API is enabled in iTerm2 preferences. + +### + +​ + +Claude spawns teammates instead of subagents + +While agent teams are enabled, a subagent that Claude names in the lead’s session launches as a teammate. Claude can name subagents on its own, so this can happen during delegation you never framed as team work. Subagents and teammates report back differently: + + * **Subagents** : Claude receives the subagent’s result when it completes. + * **Teammates** : the idle notification reports that the teammate stopped, without its output. + +An orchestration flow that waits on subagent results can stall. To make named subagents launch as subagents again, turn agent teams off by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to `0`: + +settings.json + + { + "env": { + "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "0" + } + } + +You don’t need to start a new session: Claude Code reapplies settings-file `env` values to the running session when you save, and rereads the variable each time Claude spawns a subagent, so the next subagent Claude names launches as a subagent. Setting the variable to `0` in your user `settings.json` overrides a shell export. Other settings sources can still enable agent teams: + + * **Higher-precedence settings files** : project settings, local settings, and a `--settings` payload apply after user settings, so an `env` entry that sets the variable to `1` in any of them wins. See [Settings precedence](</docs/en/settings#settings-precedence>). + * **Managed settings** : [managed settings](</docs/en/server-managed-settings>) apply after every other source. If your organization enables agent teams there, ask your administrator to change the managed value. + +After the change, Claude may still name subagents, and the name keeps working as a [`SendMessage` address](</docs/en/sub-agents#resume-subagents>). Claude receives each subagent’s result when it completes. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -228,7 +228,7 @@ **Task list**| Shared list of work items that teammates claim and complete **Mailbox**| Messaging system for communication between agents -See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. Claude Code reports a message as sent only when the write to the recipient’s mailbox file succeeds, whether the message is plain text or a structured protocol message such as a plan approval or shutdown request. When the write fails, for example because the disk is full or the mailbox directory isn’t writable, the sending agent receives an error and nothing is sent. See [Failed to write to a teammate’s inbox](</docs/en/errors#failed-to-write-to-a-teammate-inbox>) for the error messages and recovery steps. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: +Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. Claude Code reports a message as sent only when the write to the recipient’s mailbox file succeeds, whether the message is plain text or a structured protocol message such as a plan approval or shutdown request. When the write fails, for example because the disk is full or the mailbox directory isn’t writable, the sending agent receives an error and nothing is sent. See [Failed to write to a teammate’s inbox](</docs/en/errors#failed-to-write-to-a-teammate-inbox>) for the error messages and recovery steps. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` @@ -451,7 +451,7 @@ * Give them additional instructions directly * Spawn a replacement teammate to continue the work -As of v2.1.198, a message from the lead or another teammate wakes an in-process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. The lead can stop early too, deciding the team is finished before all tasks are actually complete. If that happens, tell it to keep going. +A message from the lead or another teammate wakes an in-process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. The lead can stop early too, deciding the team is finished before all tasks are actually complete. If that happens, tell it to keep going. ### @@ -482,8 +482,6 @@ * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty. -**`CLAUDE.md` works normally**: teammates read `CLAUDE.md` files from their working directory. Use this to provide project-specific guidance to all teammates. - ## ​
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -228,12 +228,12 @@ **Task list**| Shared list of work items that teammates claim and complete **Mailbox**| Messaging system for communication between agents -See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: +See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. Claude Code reports a message as sent only when the write to the recipient’s mailbox file succeeds, whether the message is plain text or a structured protocol message such as a plan approval or shutdown request. When the write fails, for example because the disk is full or the mailbox directory isn’t writable, the sending agent receives an error and nothing is sent. See [Failed to write to a teammate’s inbox](</docs/en/errors#failed-to-write-to-a-teammate-inbox>) for the error messages and recovery steps. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. +Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts, following the [retention sweep rules](</docs/en/claude-directory#cleaned-up-automatically>). The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -25,7 +25,7 @@ Compare with subagents -Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. Choose based on whether your workers need to communicate with each other: +Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. Choose based on whether your workers need to communicate with each other. For separate sessions that pass messages to each other without a team, see [cross-session messaging](</docs/en/cross-session-messaging>). Subagents only report results back to the main agent and never talk to each other. In agent teams, teammates share a task list, claim work, and communicate directly with each other. @@ -263,7 +263,10 @@ Messages between agents -When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. The classifier also reviews each message an agent sends before Claude Code delivers it, whether a plain message or a structured protocol message such as a shutdown request or plan approval response. A message the classifier blocks never reaches the recipient. +When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate can’t approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action can’t relay it to another teammate to bypass the check. The same rules apply to a message that arrives from [one of your other Claude Code sessions](</docs/en/cross-session-messaging#how-a-session-treats-an-incoming-message>), outside the team entirely. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier applies two checks to messages between agents: + + * It treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. + * It reviews each message before Claude Code delivers it, whether a plain message or a structured protocol message such as a shutdown request or plan approval response. A message it blocks never reaches the recipient. ### @@ -358,7 +361,7 @@ * **Coordination overhead increases** : more teammates means more communication, task coordination, and potential for conflicts * **Diminishing returns** : beyond a certain point, additional teammates don’t speed up work proportionally -Start with 3-5 teammates for most workflows. This balances parallel work with manageable coordination. The examples in this guide use 3-5 teammates because that range works well across different task types. Having 5-6 [tasks](</docs/en/agent-teams#architecture>) per teammate keeps everyone productive without excessive context switching. If you have 15 independent tasks, 3 teammates is a good starting point. Scale up only when the work genuinely benefits from having teammates work simultaneously. Three focused teammates often outperform five scattered ones. +Start with 3-5 teammates for most workflows. This balances parallel work with manageable coordination. If you have 15 independent tasks, 3 teammates is a good starting point. Scale up only when the work genuinely benefits from having teammates work simultaneously. Three focused teammates often outperform five scattered ones. ### @@ -441,22 +444,14 @@ ​ -Teammates stopping on errors +Agents stopping early Teammates may stop after encountering errors instead of recovering. Check their output by selecting the teammate in the agent panel and pressing Enter in in-process mode, or by clicking the pane in split mode, then either: * Give them additional instructions directly * Spawn a replacement teammate to continue the work -As of v2.1.198, a message from the lead or another teammate wakes an in-process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. - -### - -​ - -Lead shuts down before work is done - -The lead may decide the team is finished before all tasks are actually complete. If this happens, tell it to keep going. You can also tell the lead to wait for teammates to finish before proceeding if it starts doing work instead of delegating. +As of v2.1.198, a message from the lead or another teammate wakes an in-process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. The lead can stop early too, deciding the team is finished before all tasks are actually complete. If that happens, tell it to keep going. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -122,7 +122,12 @@ Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. -Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. +Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. Claude Code checks each teammate’s model, whether requested in your prompt or set through **Default teammate model** , against your organization’s [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist. When the allowlist blocks a value, Claude Code substitutes another model: + + * **Family alias such as`opus`**: On the Anthropic API and Claude Platform on AWS, Claude Code runs the teammate on the newest version of that family the allowlist permits. On providers with provider-specific model IDs, where the [substitution doesn’t operate](</docs/en/model-config#restrict-model-selection>), a blocked alias falls back like any other blocked value per the next bullet + * **Any other blocked value, including a family alias on providers where the substitution doesn’t operate or whose family has no permitted version** : Claude Code uses the default teammate model. When the blocked value is the **Default teammate model** setting itself, Claude Code uses your provider’s default Opus model, or the lead’s model when the allowlist blocks that too + +Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. ### @@ -250,7 +255,15 @@ Permissions -Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. When one agent sends another a message over `SendMessage`, the receiving agent is told it came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. +Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. + +#### + +​ + +Messages between agents + +When one agent sends another a message over `SendMessage`, Claude Code tells the receiving agent the message came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. The classifier also reviews each message an agent sends before Claude Code delivers it, whether a plain message or a structured protocol message such as a shutdown request or plan approval response. A message the classifier blocks never reaches the recipient. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -223,7 +223,7 @@ **Task list**| Shared list of work items that teammates claim and complete **Mailbox**| Messaging system for communication between agents -See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. The system manages task dependencies automatically. When a teammate completes a task that other tasks depend on, blocked tasks unblock without manual intervention. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: +See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. Claude Code manages task dependencies automatically: when a teammate completes a task that other tasks depend on, it unblocks the dependent tasks without any action from you. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/`
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -228,7 +228,7 @@ * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`; a teammate’s entry includes an agent type only when the teammate was spawned from a subagent definition. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. +Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`. A teammate’s entry carries whatever agent type the lead named when spawning it, whether a [built-in type](</docs/en/sub-agents#built-in-subagents>) or a subagent definition, and omits the field when the lead named none. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -26,6 +26,8 @@ Compare with subagents Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. Choose based on whether your workers need to communicate with each other: + +Subagents only report results back to the main agent and never talk to each other. In agent teams, teammates share a task list, claim work, and communicate directly with each other. | Subagents| Agent teams ---|---|---
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,4 +1,4 @@ -Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. +Agent teams are experimental and disabled by default. Enable them by setting `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead. @@ -65,7 +65,7 @@ their codebase. Spawn three teammates to explore this from different angles: one on UX, one on technical architecture, one playing devil's advocate. -From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel: +From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. Claude may sometimes use [subagents](</docs/en/sub-agents>) instead of creating a team. Subagents appear in the same agent panel as teammates, so the panel alone doesn’t confirm a team formed. If Claude spawned subagents instead, ask again and explicitly request an agent team. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel: * **Up and down arrows** : select a teammate * **Enter** : open the selected teammate’s transcript and message it directly @@ -104,7 +104,7 @@ claude --teammate-mode auto -Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually: +The `--teammate-mode` flag is experimental and doesn’t appear in `claude --help`. Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually: * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions. * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 → Settings → General → Magic → Enable Python API**. @@ -226,7 +226,7 @@ * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. +Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each member’s name and agent ID. The lead’s entry always carries the agent type `team-lead`; a teammate’s entry includes an agent type only when the teammate was spawned from a subagent definition. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -221,7 +221,7 @@ **Task list**| Shared list of work items that teammates claim and complete **Mailbox**| Messaging system for communication between agents -See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. The system manages task dependencies automatically. When a teammate completes a task that other tasks depend on, blocked tasks unblock without manual intervention. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: +See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Claude Code validates every entry when it reads a mailbox file. Entries that don’t match the message format are reported as errors and removed from the file; the valid messages are still delivered. Before v2.1.207, a single malformed mailbox entry caused a repeated error every second and blocked delivery for that mailbox until you deleted the file manually. The system manages task dependencies automatically. When a teammate completes a task that other tasks depend on, blocked tasks unblock without manual intervention. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` @@ -248,7 +248,7 @@ Permissions -Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. When one agent sends another a message over `SendMessage`, the receiving agent is told it came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. Teammate permission prompts bubble up to the lead session, so approve them there yourself. +Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. When one agent sends another a message over `SendMessage`, the receiving agent is told it came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. Teammate permission prompts appear in the lead session, so approve them there yourself. Plan approval is the designed exception: the lead session grants teammate plan approvals without a separate prompt to you. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -71,7 +71,7 @@ * **Enter** : open the selected teammate’s transcript and message it directly * **Escape** : interrupt the selected teammate’s current turn -As of v2.1.181, an idle teammate’s row hides after 30 seconds and reappears on its next turn. The teammate stays running and addressable while hidden. If you want each teammate in its own split pane, see Choose a display mode. +As of v2.1.199, an idle teammate’s row stays in the panel while any teammate or subagent is still working, so you can select it to review its transcript or send it more work. Once every agent in the panel is idle, idle rows hide after 30 seconds and reappear on the teammate’s next turn; the teammate stays running and addressable while hidden. In v2.1.181 through v2.1.198, an idle row hid 30 seconds after its own turn ended, even while other teammates were still working; idle rows are not hidden on versions before v2.1.181. When more than three teammates are idle at once, the rows beyond the first three collapse into a single row that counts the collapsed teammates, such as `2 idle agents` when five are idle. Select it and press Enter to expand the collapsed rows, or press Esc to collapse them again. Working teammates, failed teammates, and the teammate you’re viewing always keep their own rows. If you want each teammate in its own split pane, see Choose a display mode. ## @@ -145,6 +145,8 @@ * **In-process mode** : use the up and down arrow keys in the agent panel to select a teammate, then press Enter to view its session and type to send it a message. Press `x` on a selected teammate to stop it. Press Ctrl+T to toggle the task list. * **Split-pane mode** : click into a teammate’s pane to interact with their session directly. Each teammate has a full view of their own terminal. + +While you’re viewing an in-process teammate, plain text and [skills](</docs/en/skills>) go to that teammate, but built-in commands still run in the lead’s session. A teammate’s model and fast mode are fixed when it spawns, so `/model` and `/fast` only change the lead’s settings. As of v2.1.199, typing either command while viewing a teammate shows a notice that the change applies to the lead; earlier versions applied it to the lead with no indication. `/effort` still applies to the viewed teammate’s later turns, because teammates follow the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). ### @@ -257,7 +259,7 @@ Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. It also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. - * **Idle notifications** : when a teammate finishes and stops, they automatically notify the lead. + * **Idle notifications** : when a teammate finishes and stops, it automatically notifies the lead. As of v2.1.198, a teammate whose turn ends on an API error notifies the lead that it failed and includes the error text, instead of appearing to finish normally. * **Shared task list** : all agents can see task status and claim available work. * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient. @@ -404,7 +406,7 @@ If teammates aren’t appearing after you ask Claude to spawn them: * In in-process mode, teammates appear in the agent panel below the prompt input. Use the up and down arrow keys to select one, then press Enter to view it. - * A teammate row that disappeared after sitting idle has been hidden, not stopped. Idle rows hide after 30 seconds and reappear on the teammate’s next turn. Send the teammate a message by name to bring it back. + * A teammate row that disappeared after sitting idle has been hidden, not stopped. Idle rows hide 30 seconds after the whole panel goes idle and reappear on the teammate’s next turn. When more than three teammates are idle, their surplus rows collapse into a single `N idle agents` row that Enter expands. Send the teammate a message by name to bring a hidden row back. * Check that the task you gave Claude was complex enough to warrant a team. Claude decides whether to spawn teammates based on the task. * If you explicitly requested split panes, ensure tmux is installed and available in your PATH: @@ -430,6 +432,8 @@ * Give them additional instructions directly * Spawn a replacement teammate to continue the work + +As of v2.1.198, a message from the lead or another teammate wakes an in-process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. ### @@ -463,6 +467,7 @@ * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. * **One team per session** : a session has exactly one team, scoped to that session. You can’t create additional named teams or share a team across sessions. * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. + * **No background subagents from in-process teammates** : an in-process teammate’s own subagents run in the foreground. Asking for a background one, whether with `run_in_background` or a subagent definition that sets `background: true`, returns an error, because a teammate’s background work can’t outlive the lead’s process. Subagents launched from the main conversation follow the [background default](</docs/en/sub-agents#run-subagents-in-foreground-or-background>). * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -246,7 +246,7 @@ Permissions -Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. +Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. When one agent sends another a message over `SendMessage`, the receiving agent is told it came from another Claude session, not from you. A teammate cannot approve a permission prompt or supply consent on your behalf, and a teammate that was denied an action cannot relay it to another teammate to bypass the check. In [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the classifier treats an approval claim relayed from another agent as untrusted input rather than confirmation from you. Teammate permission prompts bubble up to the lead session, so approve them there yourself. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -94,7 +94,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session or your terminal is iTerm2, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: +The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session, or when your terminal is iTerm2 with the `it2` CLI installed, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: { "teammateMode": "auto"
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -3,13 +3,6 @@ Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead. This page describes agent teams as of v2.1.178. With `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set, spawning a teammate no longer needs a setup step, and cleanup happens automatically when the session exits. Before v2.1.178, you asked Claude to create and name a team first, and Claude used the `TeamCreate` and `TeamDelete` tools to set it up and remove it. Both tools no longer exist. The `team_name` input on the Agent tool is accepted but ignored, and the `team_name` field in `TaskCreated`, `TaskCompleted`, and `TeammateIdle` [hook payloads](</docs/en/hooks#taskcreated>) carries the session-derived name and is deprecated. - -This page covers: - - * When to use agent teams, including best use cases and how they compare with subagents - * Starting a team - * Controlling teammates, including display modes, task assignment, and delegation - * Best practices for parallel work ##
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -127,7 +127,7 @@ Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. -Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. +Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. Teammates inherit the lead’s [effort level](</docs/en/model-config#adjust-effort-level>). In split-pane mode this applies from v2.1.186; earlier versions did not pass the lead’s session effort to split-pane teammates. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -101,7 +101,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session or your terminal is iTerm2, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: +The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session or your terminal is iTerm2, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. As of v2.1.186, set `"iterm2"` to use iTerm2 native split panes explicitly. This mode requires the [`it2` CLI](<https://github.com/mkusaka/it2>) and shows an error with the install command if `it2` is missing. The setup prompt that offers to install `it2` or switch to tmux appears under `"auto"` or `"tmux"` when your terminal is iTerm2 and tmux is available as a fallback. To override the default, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: { "teammateMode": "auto"
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -72,7 +72,13 @@ their codebase. Spawn three teammates to explore this from different angles: one on UX, one on technical architecture, one playing devil's advocate. -From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. The lead’s terminal lists all teammates and what they’re working on. Use Shift+Down to cycle through teammates and message them directly. After the last teammate, Shift+Down wraps back to the lead. If you want each teammate in its own split pane, see Choose a display mode. +From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. The lead’s terminal lists teammates in the agent panel below the prompt input. From the panel: + + * **Up and down arrows** : select a teammate + * **Enter** : open the selected teammate’s transcript and message it directly + * **Escape** : interrupt the selected teammate’s current turn + +As of v2.1.181, an idle teammate’s row hides after 30 seconds and reappears on its next turn. The teammate stays running and addressable while hidden. If you want each teammate in its own split pane, see Choose a display mode. ## @@ -90,20 +96,20 @@ Agent teams support two display modes: - * **In-process** : all teammates run inside your main terminal. Use Shift+Down to cycle through teammates and type to message them directly. Works in any terminal, no extra setup required. + * **In-process** : all teammates run inside your main terminal. Use the up and down arrow keys in the agent panel to select a teammate, then press Enter to view it and type to message it directly. Works in any terminal, no extra setup required. * **Split panes** : each teammate gets its own pane. You can see everyone’s output at once and click into a pane to interact directly. Requires tmux, or iTerm2. `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"auto"`, which uses split panes if you’re already running inside a tmux session or your terminal is iTerm2, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: +The default is `"in-process"`. Before v2.1.179 the default was `"auto"`, so upgraded sessions that previously opened split panes now stay in one terminal unless you set the mode explicitly. Set `"auto"` to enable split panes when you’re already running inside a tmux session or your terminal is iTerm2, falling back to in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: { - "teammateMode": "in-process" + "teammateMode": "auto" } -To force in-process mode for a single session, pass it as a flag: - - claude --teammate-mode in-process +To set the mode for a single session, pass it as a flag: + + claude --teammate-mode auto Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually: @@ -144,7 +150,7 @@ Each teammate is a full, independent Claude Code session. You can message any teammate directly to give additional instructions, ask follow-up questions, or redirect their approach. - * **In-process mode** : use Shift+Down to cycle through teammates, then type to send them a message. Press Enter to view a teammate’s session, then Escape to interrupt their current turn. Press Ctrl+T to toggle the task list. + * **In-process mode** : use the up and down arrow keys in the agent panel to select a teammate, then press Enter to view its session and type to send it a message. Press `x` on a selected teammate to stop it. Press Ctrl+T to toggle the task list. * **Split-pane mode** : click into a teammate’s pane to interact with their session directly. Each teammate has a full view of their own terminal. ### @@ -404,8 +410,9 @@ If teammates aren’t appearing after you ask Claude to spawn them: - * In in-process mode, teammates may already be running but not visible. Press Shift+Down to cycle through active teammates. - * Check that the task you gave Claude was complex enough to warrant teammates. Claude decides whether to spawn them based on the task. + * In in-process mode, teammates appear in the agent panel below the prompt input. Use the up and down arrow keys to select one, then press Enter to view it. + * A teammate row that disappeared after sitting idle has been hidden, not stopped. Idle rows hide after 30 seconds and reappear on the teammate’s next turn. Send the teammate a message by name to bring it back. + * Check that the task you gave Claude was complex enough to warrant a team. Claude decides whether to spawn teammates based on the task. * If you explicitly requested split panes, ensure tmux is installed and available in your PATH: which tmux @@ -426,7 +433,7 @@ Teammates stopping on errors -Teammates may stop after encountering errors instead of recovering. Check their output using Shift+Down in in-process mode or by clicking the pane in split mode, then either: +Teammates may stop after encountering errors instead of recovering. Check their output by selecting the teammate in the agent panel and pressing Enter in in-process mode, or by clicking the pane in split mode, then either: * Give them additional instructions directly * Spawn a replacement teammate to continue the work
modified
Show diff (150 lines)
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,8 +1,8 @@ -Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. +Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Without that variable, no team is set up at session start, no team directories are written, and Claude does not spawn or propose teammates. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead. -Agent teams require Claude Code v2.1.32 or later. Check your version with `claude --version`. +This page describes agent teams as of v2.1.178. With `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` set, spawning a teammate no longer needs a setup step, and cleanup happens automatically when the session exits. Before v2.1.178, you asked Claude to create and name a team first, and Claude used the `TeamCreate` and `TeamDelete` tools to set it up and remove it. Both tools no longer exist. The `team_name` input on the Agent tool is accepted but ignored, and the `team_name` field in `TaskCreated`, `TaskCompleted`, and `TeammateIdle` [hook payloads](</docs/en/hooks#taskcreated>) carries the session-derived name and is deprecated. This page covers: @@ -66,13 +66,13 @@ Start your first agent team -After enabling agent teams, tell Claude to create an agent team and describe the task and the team structure you want in natural language. Claude creates the team, spawns teammates, and coordinates work based on your prompt. This example works well because the three roles are independent and can explore the problem without waiting on each other: +After enabling agent teams, describe the task and the teammates you want in natural language. Claude spawns them and coordinates work based on your prompt. This example works well because the three roles are independent and can explore the problem without waiting on each other: I'm designing a CLI tool that helps developers track TODO comments across - their codebase. Create an agent team to explore this from different angles: one - teammate on UX, one on technical architecture, one playing devil's advocate. - -From there, Claude creates a team with a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, synthesizes findings, and attempts to clean up the team when finished. The lead’s terminal lists all teammates and what they’re working on. Use Shift+Down to cycle through teammates and message them directly. After the last teammate, Shift+Down wraps back to the lead. If you want each teammate in its own split pane, see Choose a display mode. + their codebase. Spawn three teammates to explore this from different angles: + one on UX, one on technical architecture, one playing devil's advocate. + +From there, Claude populates a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, and synthesizes findings when finished. The lead’s terminal lists all teammates and what they’re working on. Use Shift+Down to cycle through teammates and message them directly. After the last teammate, Shift+Down wraps back to the lead. If you want each teammate in its own split pane, see Choose a display mode. ## @@ -118,8 +118,8 @@ Claude decides the number of teammates to spawn based on your task, or you can specify exactly what you want: - Create a team with 4 teammates to refactor these modules in parallel. - Use Sonnet for each teammate. + Spawn 4 teammates to refactor these modules in parallel. Use Sonnet for + each teammate. Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. @@ -170,21 +170,7 @@ Ask the researcher teammate to shut down -The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. - -### - -​ - -Clean up the team - -When you’re done, ask the lead to clean up: - - Clean up the team - -This removes the shared team resources. When the lead runs cleanup, it checks for active teammates and fails if any are still running, so shut them down first. Claude often cleans up on its own when the team’s work is done, so a later cleanup request may report that there is nothing to clean up. - -Always use the lead to clean up. Teammates should not run cleanup because their team context may not resolve correctly, potentially leaving resources in an inconsistent state. +The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. The team’s shared directories are cleaned up automatically when the session ends, so there’s no separate cleanup step. See Architecture for which directories are removed and which persist for resumed sessions. ### @@ -212,12 +198,12 @@ How Claude starts agent teams -There are two ways agent teams get started: - - * **You request a team** : give Claude a task that benefits from parallel work and explicitly ask for an agent team. Claude creates one based on your instructions. - * **Claude proposes a team** : if Claude determines your task would benefit from parallel work, it may suggest creating a team. You confirm before it proceeds. - -In both cases, you stay in control. Claude won’t create a team without your approval. +An agent team forms when the first teammate is spawned, with the main session acting as the lead. There are two ways teammates get spawned: + + * **You request teammates** : give Claude a task that benefits from parallel work and explicitly ask for teammates. Claude spawns them based on your instructions. + * **Claude proposes teammates** : if Claude determines your task would benefit from parallel work, it may suggest spawning teammates. You confirm before it proceeds. + +In both cases, you stay in control. Claude won’t spawn teammates without your approval. ### @@ -229,17 +215,17 @@ Component| Role ---|--- -**Team lead**| The main Claude Code session that creates the team, spawns teammates, and coordinates work +**Team lead**| The main Claude Code session that spawns teammates and coordinates work **Teammates**| Separate Claude Code instances that each work on assigned tasks **Task list**| Shared list of work items that teammates claim and complete **Mailbox**| Messaging system for communication between agents -See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. The system manages task dependencies automatically. When a teammate completes a task that other tasks depend on, blocked tasks unblock without manual intervention. Teams and tasks are stored locally: +See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. The system manages task dependencies automatically. When a teammate completes a task that other tasks depend on, blocked tasks unblock without manual intervention. Teams and tasks are stored locally under a session-derived name. The name is `session-` followed by the first eight characters of the session ID: * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -Claude Code generates both of these automatically when you create a team and updates them as teammates join, go idle, or leave. Both directories exist only while the team is active: they are removed when the team is cleaned up or when the session ends. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. +Claude Code generates both of these automatically at session startup and updates them as teammates join, go idle, or leave. The team config directory is removed when the session ends. The task list directory persists locally and is never uploaded, so resumed sessions keep their tasks. Retention is governed by the same [`cleanupPeriodDays`](</docs/en/settings#available-settings>) you already control for session transcripts. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ### @@ -302,7 +288,7 @@ A single reviewer tends to gravitate toward one type of issue at a time. Splitting review criteria into independent domains means security, performance, and test coverage all get thorough attention simultaneously. The prompt assigns each teammate a distinct lens so they don’t overlap: - Create an agent team to review PR #142. Spawn three reviewers: + Spawn three teammates to review PR #142: - One focused on security implications - One checking performance impact - One validating test coverage @@ -416,10 +402,10 @@ Teammates not appearing -If teammates aren’t appearing after you ask Claude to create a team: +If teammates aren’t appearing after you ask Claude to spawn them: * In in-process mode, teammates may already be running but not visible. Press Shift+Down to cycle through active teammates. - * Check that the task you gave Claude was complex enough to warrant a team. Claude decides whether to spawn teammates based on the task. + * Check that the task you gave Claude was complex enough to warrant teammates. Claude decides whether to spawn them based on the task. * If you explicitly requested split panes, ensure tmux is installed and available in your PATH: which tmux @@ -459,7 +445,7 @@ Orphaned tmux sessions -If a tmux session persists after the team ends, it may not have been fully cleaned up. List sessions and end the one created by the team: +If a tmux session persists after the Claude Code session ends, it may not have been fully cleaned up. List sessions and end the one created by the team: tmux ls tmux kill-session -t <session-name> @@ -475,9 +461,9 @@ * **No session resumption with in-process teammates** : `/resume` and `/rewind` do not restore in-process teammates. After resuming a session, the lead may attempt to message teammates that no longer exist. If this happens, tell the lead to spawn new teammates. * **Task status can lag** : teammates sometimes fail to mark tasks as completed, which blocks dependent tasks. If a task appears stuck, check whether the work is actually done and update the task status manually or tell the lead to nudge the teammate. * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. - * **One team at a time** : a lead can only manage one team. Clean up the current team before creating a new one. - * **No nested teams** : teammates cannot spawn their own teams or teammates. Only the lead can manage the team. - * **Lead is fixed** : the session that creates the team is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. + * **One team per session** : a session has exactly one team, scoped to that session. You can’t create additional named teams or share a team across sessions. + * **No nested teams** : teammates cannot spawn their own teammates. Only the lead can manage the team. + * **Lead is fixed** : the main session is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time. * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -459,7 +459,7 @@ Orphaned tmux sessions -If a tmux session persists after the team ends, it may not have been fully cleaned up. List sessions and kill the one created by the team: +If a tmux session persists after the team ends, it may not have been fully cleaned up. List sessions and end the one created by the team: tmux ls tmux kill-session -t <session-name>
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -95,7 +95,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: +The default is `"auto"`, which uses split panes if you’re already running inside a tmux session or your terminal is iTerm2, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: { "teammateMode": "in-process" @@ -166,7 +166,7 @@ Shut down teammates -To gracefully end a teammate’s session: +To gracefully end a teammate’s session, refer to it by name. For example, with a teammate named researcher: Ask the researcher teammate to shut down @@ -182,7 +182,7 @@ Clean up the team -This removes the shared team resources. When the lead runs cleanup, it checks for active teammates and fails if any are still running, so shut them down first. +This removes the shared team resources. When the lead runs cleanup, it checks for active teammates and fails if any are still running, so shut them down first. Claude often cleans up on its own when the team’s work is done, so a later cleanup request may report that there is nothing to clean up. Always use the lead to clean up. Teammates should not run cleanup because their team context may not resolve correctly, potentially leaving resources in an inconsistent state. @@ -239,7 +239,7 @@ * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -Claude Code generates both of these automatically when you create a team and updates them as teammates join, go idle, or leave. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. +Claude Code generates both of these automatically when you create a team and updates them as teammates join, go idle, or leave. Both directories exist only while the team is active: they are removed when the team is cleaned up or when the session ends. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,9 +1,3 @@ -> ## Documentation Index -> -> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> -> -> Use this file to discover all available pages before exploring further. - Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -126,6 +126,8 @@ Create a team with 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. + +Teammates don’t inherit the lead’s `/model` selection by default. To change the model used when the prompt doesn’t specify one, set **Default teammate model** in `/config`. Pick **Default (leader’s model)** to have teammates follow the lead’s current model. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -479,7 +479,7 @@ * **No session resumption with in-process teammates** : `/resume` and `/rewind` do not restore in-process teammates. After resuming a session, the lead may attempt to message teammates that no longer exist. If this happens, tell the lead to spawn new teammates. * **Task status can lag** : teammates sometimes fail to mark tasks as completed, which blocks dependent tasks. If a task appears stuck, check whether the work is actually done and update the task status manually or tell the lead to nudge the teammate. * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. - * **One team per session** : a lead can only manage one team at a time. Clean up the current team before starting a new one. + * **One team at a time** : a lead can only manage one team. Clean up the current team before creating a new one. * **No nested teams** : teammates cannot spawn their own teams or teammates. Only the lead can manage the team. * **Lead is fixed** : the session that creates the team is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -496,5 +496,5 @@ Explore related approaches for parallel work and delegation: * **Lightweight delegation** : [subagents](</docs/en/sub-agents>) spawn helper agents for research or verification within your session, better for tasks that don’t need inter-agent coordination - * **Manual parallel sessions** : [Git worktrees](</docs/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees>) let you run multiple Claude Code sessions yourself without automated team coordination + * **Manual parallel sessions** : [Git worktrees](</docs/en/worktrees>) let you run multiple Claude Code sessions yourself without automated team coordination * **Compare approaches** : see the [subagent vs agent team](</docs/en/features-overview#compare-similar-features>) comparison for a side-by-side breakdown
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -1,3 +1,9 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -95,7 +95,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set `teammateMode` in your [global config](</docs/en/settings#global-config-settings>) at `~/.claude.json`: +The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set [`teammateMode`](</docs/en/settings#available-settings>) in `~/.claude/settings.json`: { "teammateMode": "in-process"
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -272,11 +272,7 @@ * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. * **Idle notifications** : when a teammate finishes and stops, they automatically notify the lead. * **Shared task list** : all agents can see task status and claim available work. - -**Teammate messaging:** - - * **message** : send a message to one specific teammate - * **broadcast** : send to all teammates simultaneously. Use sparingly, as costs scale with team size. + * **Teammate messaging** : send a message to one specific teammate by name. To reach everyone, send one message per recipient. The lead assigns every teammate a name when it spawns them, and any teammate can message any other by that name. To get predictable names you can reference in later prompts, tell the lead what to call each teammate in your spawn instruction.
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -245,9 +245,13 @@ Use subagent definitions for teammates -When spawning a teammate, you can reference a [subagent](</docs/en/sub-agents>) type from any [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>): project, user, plugin, or CLI-defined. The teammate inherits that subagent’s system prompt, tools, and model. This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, mention it by name when asking Claude to spawn the teammate: +When spawning a teammate, you can reference a [subagent](</docs/en/sub-agents>) type from any [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>): project, user, plugin, or CLI-defined. This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, mention it by name when asking Claude to spawn the teammate: Spawn a teammate using the security-reviewer agent type to audit the auth module. + +The teammate honors that definition’s `tools` allowlist and `model`, and the definition’s body is appended to the teammate’s system prompt as additional instructions rather than replacing it. Team coordination tools such as `SendMessage` and the task management tools are always available to a teammate even when `tools` restricts other tools. + +The `skills` and `mcpServers` frontmatter fields in a subagent definition are not applied when that definition runs as a teammate. Teammates load skills and MCP servers from your project and user settings, the same as a regular session. ### @@ -273,6 +277,8 @@ * **message** : send a message to one specific teammate * **broadcast** : send to all teammates simultaneously. Use sparingly, as costs scale with team size. + +The lead assigns every teammate a name when it spawns them, and any teammate can message any other by that name. To get predictable names you can reference in later prompts, tell the lead what to call each teammate in your spawn instruction. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -237,7 +237,17 @@ * **Team config** : `~/.claude/teams/{team-name}/config.json` * **Task list** : `~/.claude/tasks/{team-name}/` -The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. +Claude Code generates both of these automatically when you create a team and updates them as teammates join, go idle, or leave. The team config holds runtime state such as session IDs and tmux pane IDs, so don’t edit it by hand or pre-author it: your changes are overwritten on the next state update. To define reusable teammate roles, use subagent definitions instead. The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. There is no project-level equivalent of the team config. A file like `.claude/teams/teams.json` in your project directory is not recognized as configuration; Claude treats it as an ordinary file. + +### + +​ + +Use subagent definitions for teammates + +When spawning a teammate, you can reference a [subagent](</docs/en/sub-agents>) type from any [subagent scope](</docs/en/sub-agents#choose-the-subagent-scope>): project, user, plugin, or CLI-defined. The teammate inherits that subagent’s system prompt, tools, and model. This lets you define a role once, such as a security-reviewer or test-runner, and reuse it both as a delegated subagent and as an agent team teammate. To use a subagent definition, mention it by name when asking Claude to spawn the teammate: + + Spawn a teammate using the security-reviewer agent type to audit the auth module. ###
modified
--- a/agent-teams.md +++ b/agent-teams.md @@ -95,7 +95,7 @@ `tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. -The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set `teammateMode` in your [settings.json](</docs/en/settings>): +The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set `teammateMode` in your [global config](</docs/en/settings#global-config-settings>) at `~/.claude.json`: { "teammateMode": "in-process"
modified
Show diff (195 lines)
--- a/agent-teams.md +++ b/agent-teams.md @@ -54,12 +54,6 @@ settings.json -Report incorrect code - -Copy - -Ask AI - { "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" @@ -74,12 +68,6 @@ After enabling agent teams, tell Claude to create an agent team and describe the task and the team structure you want in natural language. Claude creates the team, spawns teammates, and coordinates work based on your prompt. This example works well because the three roles are independent and can explore the problem without waiting on each other: -Report incorrect code - -Copy - -Ask AI - I'm designing a CLI tool that helps developers track TODO comments across their codebase. Create an agent team to explore this from different angles: one teammate on UX, one on technical architecture, one playing devil's advocate. @@ -109,24 +97,12 @@ The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set `teammateMode` in your [settings.json](</docs/en/settings>): -Report incorrect code - -Copy - -Ask AI - { "teammateMode": "in-process" } To force in-process mode for a single session, pass it as a flag: -Report incorrect code - -Copy - -Ask AI - claude --teammate-mode in-process Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually: @@ -142,12 +118,6 @@ Claude decides the number of teammates to spawn based on your task, or you can specify exactly what you want: -Report incorrect code - -Copy - -Ask AI - Create a team with 4 teammates to refactor these modules in parallel. Use Sonnet for each teammate. @@ -159,12 +129,6 @@ For complex or risky tasks, you can require teammates to plan before implementing. The teammate works in read-only plan mode until the lead approves their approach: -Report incorrect code - -Copy - -Ask AI - Spawn an architect teammate to refactor the authentication module. Require plan approval before they make any changes. @@ -202,12 +166,6 @@ To gracefully end a teammate’s session: -Report incorrect code - -Copy - -Ask AI - Ask the researcher teammate to shut down The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. @@ -220,12 +178,6 @@ When you’re done, ask the lead to clean up: -Report incorrect code - -Copy - -Ask AI - Clean up the team This removes the shared team resources. When the lead runs cleanup, it checks for active teammates and fails if any are still running, so shut them down first. @@ -238,9 +190,10 @@ Enforce quality gates with hooks -Use [hooks](</docs/en/hooks>) to enforce rules when teammates finish work or tasks complete: +Use [hooks](</docs/en/hooks>) to enforce rules when teammates finish work or tasks are created or completed: * [`TeammateIdle`](</docs/en/hooks#teammateidle>): runs when a teammate is about to go idle. Exit with code 2 to send feedback and keep the teammate working. + * [`TaskCreated`](</docs/en/hooks#taskcreated>): runs when a task is being created. Exit with code 2 to prevent creation and send feedback. * [`TaskCompleted`](</docs/en/hooks#taskcompleted>): runs when a task is being marked complete. Exit with code 2 to prevent completion and send feedback. ## @@ -335,12 +288,6 @@ A single reviewer tends to gravitate toward one type of issue at a time. Splitting review criteria into independent domains means security, performance, and test coverage all get thorough attention simultaneously. The prompt assigns each teammate a distinct lens so they don’t overlap: -Report incorrect code - -Copy - -Ask AI - Create an agent team to review PR #142. Spawn three reviewers: - One focused on security implications - One checking performance impact @@ -357,12 +304,6 @@ When the root cause is unclear, a single agent tends to find one plausible explanation and stop looking. The prompt fights this by making teammates explicitly adversarial: each one’s job is not only to investigate its own theory but to challenge the others’. -Report incorrect code - -Copy - -Ask AI - Users report the app exits after one message instead of staying connected. Spawn 5 agent teammates to investigate different hypotheses. Have them talk to each other to try to disprove each other's theories, like a scientific @@ -384,12 +325,6 @@ Teammates load project context automatically, including CLAUDE.md, MCP servers, and skills, but they don’t inherit the lead’s conversation history. See Context and communication for details. Include task-specific details in the spawn prompt: -Report incorrect code - -Copy - -Ask AI - Spawn a security reviewer teammate with the prompt: "Review the authentication module at src/auth/ for security vulnerabilities. Focus on token handling, session management, and input validation. The app uses JWT tokens stored in @@ -429,12 +364,6 @@ Sometimes the lead starts implementing tasks itself instead of waiting for teammates. If you notice this: -Report incorrect code - -Copy - -Ask AI - Wait for your teammates to complete their tasks before proceeding ### @@ -479,12 +408,6 @@ * Check that the task you gave Claude was complex enough to warrant a team. Claude decides whether to spawn teammates based on the task. * If you explicitly requested split panes, ensure tmux is installed and available in your PATH: -Report incorrect code - -Copy - -Ask AI - which tmux * For iTerm2, verify the `it2` CLI is installed and the Python API is enabled in iTerm2 preferences. @@ -523,12 +446,6 @@ Orphaned tmux sessions If a tmux session persists after the team ends, it may not have been fully cleaned up. List sessions and kill the one created by the team: - -Report incorrect code - -Copy - -Ask AI tmux ls tmux kill-session -t <session-name>
added
Show diff (568 lines)
--- a/agent-teams.md +++ b/agent-teams.md @@ -0,0 +1,565 @@ +Agent teams are experimental and disabled by default. Enable them by adding `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` to your [settings.json](</docs/en/settings>) or environment. Agent teams have known limitations around session resumption, task coordination, and shutdown behavior. + +Agent teams let you coordinate multiple Claude Code instances working together. One session acts as the team lead, coordinating work, assigning tasks, and synthesizing results. Teammates work independently, each in its own context window, and communicate directly with each other. Unlike [subagents](</docs/en/sub-agents>), which run within a single session and can only report back to the main agent, you can also interact with individual teammates directly without going through the lead. + +Agent teams require Claude Code v2.1.32 or later. Check your version with `claude --version`. + +This page covers: + + * When to use agent teams, including best use cases and how they compare with subagents + * Starting a team + * Controlling teammates, including display modes, task assignment, and delegation + * Best practices for parallel work + +## + +​ + +When to use agent teams + +Agent teams are most effective for tasks where parallel exploration adds real value. See use case examples for full scenarios. The strongest use cases are: + + * **Research and review** : multiple teammates can investigate different aspects of a problem simultaneously, then share and challenge each other’s findings + * **New modules or features** : teammates can each own a separate piece without stepping on each other + * **Debugging with competing hypotheses** : teammates test different theories in parallel and converge on the answer faster + * **Cross-layer coordination** : changes that span frontend, backend, and tests, each owned by a different teammate + +Agent teams add coordination overhead and use significantly more tokens than a single session. They work best when teammates can operate independently. For sequential tasks, same-file edits, or work with many dependencies, a single session or [subagents](</docs/en/sub-agents>) are more effective. + +### + +​ + +Compare with subagents + +Both agent teams and [subagents](</docs/en/sub-agents>) let you parallelize work, but they operate differently. Choose based on whether your workers need to communicate with each other: + +| Subagents| Agent teams +---|---|--- +**Context**| Own context window; results return to the caller| Own context window; fully independent +**Communication**| Report results back to the main agent only| Teammates message each other directly +**Coordination**| Main agent manages all work| Shared task list with self-coordination +**Best for**| Focused tasks where only the result matters| Complex work requiring discussion and collaboration +**Token cost**| Lower: results summarized back to main context| Higher: each teammate is a separate Claude instance + +Use subagents when you need quick, focused workers that report back. Use agent teams when teammates need to share findings, challenge each other, and coordinate on their own. + +## + +​ + +Enable agent teams + +Agent teams are disabled by default. Enable them by setting the `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` environment variable to `1`, either in your shell environment or through [settings.json](</docs/en/settings>): + +settings.json + +Report incorrect code + +Copy + +Ask AI + + { + "env": { + "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" + } + } + +## + +​ + +Start your first agent team + +After enabling agent teams, tell Claude to create an agent team and describe the task and the team structure you want in natural language. Claude creates the team, spawns teammates, and coordinates work based on your prompt. This example works well because the three roles are independent and can explore the problem without waiting on each other: + +Report incorrect code + +Copy + +Ask AI + + I'm designing a CLI tool that helps developers track TODO comments across + their codebase. Create an agent team to explore this from different angles: one + teammate on UX, one on technical architecture, one playing devil's advocate. + +From there, Claude creates a team with a [shared task list](</docs/en/interactive-mode#task-list>), spawns teammates for each perspective, has them explore the problem, synthesizes findings, and attempts to clean up the team when finished. The lead’s terminal lists all teammates and what they’re working on. Use Shift+Down to cycle through teammates and message them directly. After the last teammate, Shift+Down wraps back to the lead. If you want each teammate in its own split pane, see Choose a display mode. + +## + +​ + +Control your agent team + +Tell the lead what you want in natural language. It handles team coordination, task assignment, and delegation based on your instructions. + +### + +​ + +Choose a display mode + +Agent teams support two display modes: + + * **In-process** : all teammates run inside your main terminal. Use Shift+Down to cycle through teammates and type to message them directly. Works in any terminal, no extra setup required. + * **Split panes** : each teammate gets its own pane. You can see everyone’s output at once and click into a pane to interact directly. Requires tmux, or iTerm2. + +`tmux` has known limitations on certain operating systems and traditionally works best on macOS. Using `tmux -CC` in iTerm2 is the suggested entrypoint into `tmux`. + +The default is `"auto"`, which uses split panes if you’re already running inside a tmux session, and in-process otherwise. The `"tmux"` setting enables split-pane mode and auto-detects whether to use tmux or iTerm2 based on your terminal. To override, set `teammateMode` in your [settings.json](</docs/en/settings>): + +Report incorrect code + +Copy + +Ask AI + + { + "teammateMode": "in-process" + } + +To force in-process mode for a single session, pass it as a flag: + +Report incorrect code + +Copy + +Ask AI + + claude --teammate-mode in-process + +Split-pane mode requires either [tmux](<https://github.com/tmux/tmux/wiki>) or iTerm2 with the [`it2` CLI](<https://github.com/mkusaka/it2>). To install manually: + + * **tmux** : install through your system’s package manager. See the [tmux wiki](<https://github.com/tmux/tmux/wiki/Installing>) for platform-specific instructions. + * **iTerm2** : install the [`it2` CLI](<https://github.com/mkusaka/it2>), then enable the Python API in **iTerm2 → Settings → General → Magic → Enable Python API**. + +### + +​ + +Specify teammates and models + +Claude decides the number of teammates to spawn based on your task, or you can specify exactly what you want: + +Report incorrect code + +Copy + +Ask AI + + Create a team with 4 teammates to refactor these modules in parallel. + Use Sonnet for each teammate. + +### + +​ + +Require plan approval for teammates + +For complex or risky tasks, you can require teammates to plan before implementing. The teammate works in read-only plan mode until the lead approves their approach: + +Report incorrect code + +Copy + +Ask AI + + Spawn an architect teammate to refactor the authentication module. + Require plan approval before they make any changes. + +When a teammate finishes planning, it sends a plan approval request to the lead. The lead reviews the plan and either approves it or rejects it with feedback. If rejected, the teammate stays in plan mode, revises based on the feedback, and resubmits. Once approved, the teammate exits plan mode and begins implementation. The lead makes approval decisions autonomously. To influence the lead’s judgment, give it criteria in your prompt, such as “only approve plans that include test coverage” or “reject plans that modify the database schema.” + +### + +​ + +Talk to teammates directly + +Each teammate is a full, independent Claude Code session. You can message any teammate directly to give additional instructions, ask follow-up questions, or redirect their approach. + + * **In-process mode** : use Shift+Down to cycle through teammates, then type to send them a message. Press Enter to view a teammate’s session, then Escape to interrupt their current turn. Press Ctrl+T to toggle the task list. + * **Split-pane mode** : click into a teammate’s pane to interact with their session directly. Each teammate has a full view of their own terminal. + +### + +​ + +Assign and claim tasks + +The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed. The lead can assign tasks explicitly, or teammates can self-claim: + + * **Lead assigns** : tell the lead which task to give to which teammate + * **Self-claim** : after finishing a task, a teammate picks up the next unassigned, unblocked task on its own + +Task claiming uses file locking to prevent race conditions when multiple teammates try to claim the same task simultaneously. + +### + +​ + +Shut down teammates + +To gracefully end a teammate’s session: + +Report incorrect code + +Copy + +Ask AI + + Ask the researcher teammate to shut down + +The lead sends a shutdown request. The teammate can approve, exiting gracefully, or reject with an explanation. + +### + +​ + +Clean up the team + +When you’re done, ask the lead to clean up: + +Report incorrect code + +Copy + +Ask AI + + Clean up the team + +This removes the shared team resources. When the lead runs cleanup, it checks for active teammates and fails if any are still running, so shut them down first. + +Always use the lead to clean up. Teammates should not run cleanup because their team context may not resolve correctly, potentially leaving resources in an inconsistent state. + +### + +​ + +Enforce quality gates with hooks + +Use [hooks](</docs/en/hooks>) to enforce rules when teammates finish work or tasks complete: + + * [`TeammateIdle`](</docs/en/hooks#teammateidle>): runs when a teammate is about to go idle. Exit with code 2 to send feedback and keep the teammate working. + * [`TaskCompleted`](</docs/en/hooks#taskcompleted>): runs when a task is being marked complete. Exit with code 2 to prevent completion and send feedback. + +## + +​ + +How agent teams work + +This section covers the architecture and mechanics behind agent teams. If you want to start using them, see Control your agent team above. + +### + +​ + +How Claude starts agent teams + +There are two ways agent teams get started: + + * **You request a team** : give Claude a task that benefits from parallel work and explicitly ask for an agent team. Claude creates one based on your instructions. + * **Claude proposes a team** : if Claude determines your task would benefit from parallel work, it may suggest creating a team. You confirm before it proceeds. + +In both cases, you stay in control. Claude won’t create a team without your approval. + +### + +​ + +Architecture + +An agent team consists of: + +Component| Role +---|--- +**Team lead**| The main Claude Code session that creates the team, spawns teammates, and coordinates work +**Teammates**| Separate Claude Code instances that each work on assigned tasks +**Task list**| Shared list of work items that teammates claim and complete +**Mailbox**| Messaging system for communication between agents + +See Choose a display mode for display configuration options. Teammate messages arrive at the lead automatically. The system manages task dependencies automatically. When a teammate completes a task that other tasks depend on, blocked tasks unblock without manual intervention. Teams and tasks are stored locally: + + * **Team config** : `~/.claude/teams/{team-name}/config.json` + * **Task list** : `~/.claude/tasks/{team-name}/` + +The team config contains a `members` array with each teammate’s name, agent ID, and agent type. Teammates can read this file to discover other team members. + +### + +​ + +Permissions + +Teammates start with the lead’s permission settings. If the lead runs with `--dangerously-skip-permissions`, all teammates do too. After spawning, you can change individual teammate modes, but you can’t set per-teammate modes at spawn time. + +### + +​ + +Context and communication + +Each teammate has its own context window. When spawned, a teammate loads the same project context as a regular session: CLAUDE.md, MCP servers, and skills. It also receives the spawn prompt from the lead. The lead’s conversation history does not carry over. **How teammates share information:** + + * **Automatic message delivery** : when teammates send messages, they’re delivered automatically to recipients. The lead doesn’t need to poll for updates. + * **Idle notifications** : when a teammate finishes and stops, they automatically notify the lead. + * **Shared task list** : all agents can see task status and claim available work. + +**Teammate messaging:** + + * **message** : send a message to one specific teammate + * **broadcast** : send to all teammates simultaneously. Use sparingly, as costs scale with team size. + +### + +​ + +Token usage + +Agent teams use significantly more tokens than a single session. Each teammate has its own context window, and token usage scales with the number of active teammates. For research, review, and new feature work, the extra tokens are usually worthwhile. For routine tasks, a single session is more cost-effective. See [agent team token costs](</docs/en/costs#agent-team-token-costs>) for usage guidance. + +## + +​ + +Use case examples + +These examples show how agent teams handle tasks where parallel exploration adds value. + +### + +​ + +Run a parallel code review + +A single reviewer tends to gravitate toward one type of issue at a time. Splitting review criteria into independent domains means security, performance, and test coverage all get thorough attention simultaneously. The prompt assigns each teammate a distinct lens so they don’t overlap: + +Report incorrect code + +Copy + +Ask AI + + Create an agent team to review PR #142. Spawn three reviewers: + - One focused on security implications + - One checking performance impact + - One validating test coverage + Have them each review and report findings. + +Each reviewer works from the same PR but applies a different filter. The lead synthesizes findings across all three after they finish. + +### + +​ + +Investigate with competing hypotheses + +When the root cause is unclear, a single agent tends to find one plausible explanation and stop looking. The prompt fights this by making teammates explicitly adversarial: each one’s job is not only to investigate its own theory but to challenge the others’. + +Report incorrect code + +Copy + +Ask AI + + Users report the app exits after one message instead of staying connected. + Spawn 5 agent teammates to investigate different hypotheses. Have them talk to + each other to try to disprove each other's theories, like a scientific + debate. Update the findings doc with whatever consensus emerges. + +The debate structure is the key mechanism here. Sequential investigation suffers from anchoring: once one theory is explored, subsequent investigation is biased toward it. With multiple independent investigators actively trying to disprove each other, the theory that survives is much more likely to be the actual root cause. + +## + +​ + +Best practices + +### + +​ + +Give teammates enough context + +Teammates load project context automatically, including CLAUDE.md, MCP servers, and skills, but they don’t inherit the lead’s conversation history. See Context and communication for details. Include task-specific details in the spawn prompt: + +Report incorrect code + +Copy + +Ask AI + + Spawn a security reviewer teammate with the prompt: "Review the authentication module + at src/auth/ for security vulnerabilities. Focus on token handling, session + management, and input validation. The app uses JWT tokens stored in + httpOnly cookies. Report any issues with severity ratings." + +### + +​ + +Choose an appropriate team size + +There’s no hard limit on the number of teammates, but practical constraints apply: + + * **Token costs scale linearly** : each teammate has its own context window and consumes tokens independently. See [agent team token costs](</docs/en/costs#agent-team-token-costs>) for details. + * **Coordination overhead increases** : more teammates means more communication, task coordination, and potential for conflicts + * **Diminishing returns** : beyond a certain point, additional teammates don’t speed up work proportionally + +Start with 3-5 teammates for most workflows. This balances parallel work with manageable coordination. The examples in this guide use 3-5 teammates because that range works well across different task types. Having 5-6 [tasks](</docs/en/agent-teams#architecture>) per teammate keeps everyone productive without excessive context switching. If you have 15 independent tasks, 3 teammates is a good starting point. Scale up only when the work genuinely benefits from having teammates work simultaneously. Three focused teammates often outperform five scattered ones. + +### + +​ + +Size tasks appropriately + + * **Too small** : coordination overhead exceeds the benefit + * **Too large** : teammates work too long without check-ins, increasing risk of wasted effort + * **Just right** : self-contained units that produce a clear deliverable, such as a function, a test file, or a review + +The lead breaks work into tasks and assigns them to teammates automatically. If it isn’t creating enough tasks, ask it to split the work into smaller pieces. Having 5-6 tasks per teammate keeps everyone productive and lets the lead reassign work if someone gets stuck. + +### + +​ + +Wait for teammates to finish + +Sometimes the lead starts implementing tasks itself instead of waiting for teammates. If you notice this: + +Report incorrect code + +Copy + +Ask AI + + Wait for your teammates to complete their tasks before proceeding + +### + +​ + +Start with research and review + +If you’re new to agent teams, start with tasks that have clear boundaries and don’t require writing code: reviewing a PR, researching a library, or investigating a bug. These tasks show the value of parallel exploration without the coordination challenges that come with parallel implementation. + +### + +​ + +Avoid file conflicts + +Two teammates editing the same file leads to overwrites. Break the work so each teammate owns a different set of files. + +### + +​ + +Monitor and steer + +Check in on teammates’ progress, redirect approaches that aren’t working, and synthesize findings as they come in. Letting a team run unattended for too long increases the risk of wasted effort. + +## + +​ + +Troubleshooting + +### + +​ + +Teammates not appearing + +If teammates aren’t appearing after you ask Claude to create a team: + + * In in-process mode, teammates may already be running but not visible. Press Shift+Down to cycle through active teammates. + * Check that the task you gave Claude was complex enough to warrant a team. Claude decides whether to spawn teammates based on the task. + * If you explicitly requested split panes, ensure tmux is installed and available in your PATH: + +Report incorrect code + +Copy + +Ask AI + + which tmux + + * For iTerm2, verify the `it2` CLI is installed and the Python API is enabled in iTerm2 preferences. + +### + +​ + +Too many permission prompts + +Teammate permission requests bubble up to the lead, which can create friction. Pre-approve common operations in your [permission settings](</docs/en/permissions>) before spawning teammates to reduce interruptions. + +### + +​ + +Teammates stopping on errors + +Teammates may stop after encountering errors instead of recovering. Check their output using Shift+Down in in-process mode or by clicking the pane in split mode, then either: + + * Give them additional instructions directly + * Spawn a replacement teammate to continue the work + +### + +​ + +Lead shuts down before work is done + +The lead may decide the team is finished before all tasks are actually complete. If this happens, tell it to keep going. You can also tell the lead to wait for teammates to finish before proceeding if it starts doing work instead of delegating. + +### + +​ + +Orphaned tmux sessions + +If a tmux session persists after the team ends, it may not have been fully cleaned up. List sessions and kill the one created by the team: + +Report incorrect code + +Copy + +Ask AI + + tmux ls + tmux kill-session -t <session-name> + +## + +​ + +Limitations + +Agent teams are experimental. Current limitations to be aware of: + + * **No session resumption with in-process teammates** : `/resume` and `/rewind` do not restore in-process teammates. After resuming a session, the lead may attempt to message teammates that no longer exist. If this happens, tell the lead to spawn new teammates. + * **Task status can lag** : teammates sometimes fail to mark tasks as completed, which blocks dependent tasks. If a task appears stuck, check whether the work is actually done and update the task status manually or tell the lead to nudge the teammate. + * **Shutdown can be slow** : teammates finish their current request or tool call before shutting down, which can take time. + * **One team per session** : a lead can only manage one team at a time. Clean up the current team before starting a new one. + * **No nested teams** : teammates cannot spawn their own teams or teammates. Only the lead can manage the team. + * **Lead is fixed** : the session that creates the team is the lead for its lifetime. You can’t promote a teammate to lead or transfer leadership. + * **Permissions set at spawn** : all teammates start with the lead’s permission mode. You can change individual teammate modes after spawning, but you can’t set per-teammate modes at spawn time. + * **Split panes require tmux or iTerm2** : the default in-process mode works in any terminal. Split-pane mode isn’t supported in VS Code’s integrated terminal, Windows Terminal, or Ghostty. + +**`CLAUDE.md` works normally**: teammates read `CLAUDE.md` files from their working directory. Use this to provide project-specific guidance to all teammates. + +## + +​ + +Next steps + +Explore related approaches for parallel work and delegation: + + * **Lightweight delegation** : [subagents](</docs/en/sub-agents>) spawn helper agents for research or verification within your session, better for tasks that don’t need inter-agent coordination + * **Manual parallel sessions** : [Git worktrees](</docs/en/common-workflows#run-parallel-claude-code-sessions-with-git-worktrees>) let you run multiple Claude Code sessions yourself without automated team coordination + * **Compare approaches** : see the [subagent vs agent team](</docs/en/features-overview#compare-similar-features>) comparison for a side-by-side breakdown