<!-- Markdown twin of https://retasc.com/guides/claude-code-agent-teams, generated by scripts/markdown-twins.py from the page. Do not edit; edit the page. -->
# Claude Code agent teams share work within a session

> You get separate teammate contexts, messages and an optional shared task list. A queue keeps the work claimable after the session ends.

Source: https://retasc.com/guides/claude-code-agent-teams · Markdown for agents; the same page as HTML with the diagrams described in a line each.

[Guides](https://retasc.com/guides)

Claude Code agent teams give a lead session teammates with separate context windows, direct messages and an optional shared task list. Use a team for work within a session, then add a queue when the backlog needs claims and checkpoints that survive it.

Updated October 2026 · 10 min read

## Every session has an implicit team when teams are enabled

Claude Code agent teams have been a research preview since v2.1.32, released on February 5, 2026. Enable them with `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in the environment, or configure that environment variable in `settings.json`. Anthropic describes the feature as token-intensive in its [agent teams documentation](https://code.claude.com/docs/en/agent-teams).

One session acts as the Claude Code team lead. Each teammate works independently in its own context window. The lead launches a teammate by calling the `Agent` tool with a name.

*Diagram: What an agent team is made of*

The lifecycle changed in v2.1.178 on June 15, 2026, as recorded in Anthropic’s [changelog](https://code.claude.com/docs/en/changelog). Every session now has an implicit team, with no `TeamCreate` or `TeamDelete` tools. While agent teams are enabled, named subagents become teammates, so a named `Agent` call participates in the session’s team.

Agent teams are available in the CLI, where teammates run in-process by default. They are unavailable in the desktop app, and Claude does not spawn teammates under `-p`, including Agent SDK sessions. Split panes require tmux, or iTerm2 with the it2 CLI, and are unsupported in VS Code’s integrated terminal, Windows Terminal or Ghostty.

## The shared task list uses file locks and dependencies

The Claude Code shared task list lives in `~/.claude/tasks/{team-name}/`. Tasks are pending, in progress or completed. A pending task with unresolved dependencies cannot be claimed until those dependencies are completed.

The lead can assign tasks, or teammates can claim them. Claiming uses file locking to prevent races when several teammates try to claim the same task. Dependent tasks unblock automatically when their blockers are completed.

Communication has a separate storage path. Each agent’s mailbox is a JSON file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`, and messages are delivered automatically. There is no broadcast, so reaching the whole team takes a message to each recipient.

The [hooks reference](https://code.claude.com/docs/en/hooks) names the checks you can attach to this workflow. `TeammateIdle` can keep a teammate working, `TaskCreated` can block task creation, and `TaskCompleted` can prevent a task from being marked completed. Each hook enforces its check by exiting with code 2.

## Agents without Task tools coordinate through messages

Models newer than Opus 4.7, Sonnet 4.6 and Haiku 4.5 do not get the Task tools by default. Teammates on those models coordinate through messages. `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` turns the Task tools back on. The shared task list adds task states, dependency checks and file-locked claiming.

The `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` setting is separate from `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`, which turns on teams. Check the model and the setting in [Anthropic’s tools reference](https://code.claude.com/docs/en/tools-reference) before your workflow depends on task claiming or dependency checks.

Before relying on claiming or dependencies, check that your model is Opus 4.7, Sonnet 4.6, Haiku 4.5 or earlier, where the Task tools are on by default. Otherwise, set `CLAUDE_CODE_ENABLE_TODO_TOOLS=1`, as documented in [Anthropic’s tools reference](https://code.claude.com/docs/en/tools-reference).

## The team lifecycle ends at the session

Anthropic lists several limits in the agent teams docs. `/resume` and `/rewind` do not restore in-process teammates, task status can lag enough to block dependent tasks, and shutdown can be slow. Each session has one team with a fixed lead, no nested teams and permissions set at spawn.

*Diagram: The documented limits of agent teams and what each one means in practice*

The task list persists after the session, but the team config at `~/.claude/teams/{team-name}/config.json` is removed when the session ends. The team name uses the `session-` prefix followed by the start of the session ID.

Agent teams do not isolate teammates in git worktrees. Anthropic warns that teammates editing the same file can overwrite each other’s changes. The task list’s file lock protects task claiming, which is a different concern from isolating edits in the repo.

Token cost is another reason to choose the work deliberately, because a team spends tokens across the lead and its independent teammates. Anthropic’s [costs page](https://code.claude.com/docs/en/costs) puts teams at about 7x the tokens of a standard session when teammates run in plan mode, and advises Sonnet for teammates. Its team docs suggest starting with 3 to 5 teammates.

## Subagents return results while teammates coordinate with peers

Use a subagent when a session needs a delegated result it can collect before continuing with its own work. Claude Code subagents start with fresh context inside the session and return their results to the caller. Up to 20 can run concurrently by default, according to the [subagents docs](https://code.claude.com/docs/en/sub-agents).

Use teammates when the agents need to communicate with each other while the lead coordinates the work, such as reviewers comparing findings or researchers pursuing competing hypotheses.

Separate sessions have another communication option. Cross-session messaging arrived in v2.1.224 on August 7, 2026, letting Claude Code sessions on the same machine message each other outside a team.

| | Subagents | Agent team | Sessions on Retasc |
|---|---|---|---|
| Agents message each other | no: Results return to the parent | yes: A mailbox per teammate | partly: Claude Code messaging, same machine only |
| Exclusive task claims | no: The parent gives each subagent its task | partly: File locks with the Task tools on | yes: The server refuses a second claim |
| Blocked work stays unclaimed | no: The main conversation decides what runs | partly: Dependencies with the Task tools on | yes: Never handed out |
| Handoff when the session ends | no: Bound to the parent session | partly: Tasks stay, the config goes | yes: The next claim gets the checkpoint |
| Work resumes across runtimes | no: A single Claude Code session | no: Local task list, Claude Code only | yes: Mixed runtimes, shared queue |
| Setup is one command | yes: Built in | yes: An environment variable | no: A command and an account |

OpenAI’s [Codex docs](https://learn.chatgpt.com/docs/agent-configuration/subagents) describe subagents and no agent teams. The subagent feature is on by default in current releases, but Codex starts subagents only after a direct request or a project or skill instruction. Codex subagents inherit the parent turn’s sandbox and approval settings. Codex waits until all requested results are available before returning a consolidated response. OpenAI documents no shared task list, claiming or locking across separate Codex agents or chats. Its guidance is to avoid letting two chats change the same files and to use worktrees.

## Each teammate can pull its own issue from Retasc

A teammate loads the project’s `CLAUDE.md`, MCP servers and skills, like a regular session. Connect the repo with `npx @retasc/cli@latest bind`, then start or restart the agent in that folder. Setup asks for browser approval if you are not signed in, gives the folder an agent key and wires the MCP server. The connection goes to the remote MCP server at `https://mcp.retasc.com/mcp` over streamable HTTP. `bind` also wires Codex, Cursor, OpenCode, Gemini CLI, Grok and Pi on the machine in the same step. Those runtimes can pull from the same queue. They do not need to participate in the Claude Code team to claim work over MCP.

Each teammate calls `next_issue` itself. Each Claude Code session is its own claim holder, so two teammates pulling through the same folder key still get different issues. A claim is one server transaction. Two agents can never hold the same issue. `next_batch` hands an orchestrator up to N issues that do not depend on each other, so a wave of subagents can work them at once. It can also peek without claiming.

*Diagram: Two teammates of one lead each call next_issue in their own session and get different issues.*

`next_issue` selects the highest effective-priority issue that is unblocked and unclaimed. Blocked work is never handed out. Close a blocker and its dependents join the queue. A blocker inherits the urgency of the work it blocks, so a chore blocking an urgent feature jumps the queue. Every issue an agent creates must declare its blockers or state why it depends on nothing. Retasc refuses the create without that declaration and suggests similar or mentioned open issues to link. The server computes blocked status live from those links, so completing a blocker frees its dependents at once.

Every claim returns the issue’s own branch, such as `acme-27/retry-failed-webhooks`. To isolate the edits, `retasc claim` creates a git worktree on that branch. Closing the issue removes the worktree and the merged branch.

## The next session gets the checkpoint when the lease lapses

The session ends and the team config is gone. A claim is a 30-minute lease renewed by heartbeat or checkpoint. The Retasc CLI runs beside the agent and renews its leases every 10 minutes without the model doing anything, so a long build does not lose the claim.

If the process dies, the laptop closes or the terminal is killed, the reclaimer returns the issue to the queue when nothing renews the lease. The issue stays in its owner’s lane, so the same person’s agents are offered it first on any runtime, including a later Claude Code session or a switch to Codex. If nobody comes back for 7 days, it returns to the shared pool.

An agent records a checkpoint on the issue with what is done, what is next and the gotchas. Every claim through `next_issue`, `claim_issue` or `next_batch` hands over the last checkpoint. A claim through `next_issue` also returns the issue’s body. When an agent claims the issue after a lease lapses, it also gets who wrote the checkpoint and when, plus the reclaim count.

*Diagram: The next morning, after the lead session and its team ended, a new session calls next_issue and gets the unfinished issue with its checkpoint, author and reclaim count.*

Recovery also covers a session that continues. After a restart or `/resume`, the agent reclaims its issue with its claim token, moving the live lease to the new session without changing the status or checkpoint. After `/clear`, Claude Code is told which issues its window still holds, so it continues them or releases them instead of leaving them parked.

## A team fits one sitting while a queue carries the backlog

Reach for a team when the work fits one sitting in one terminal. Research, review from several angles and competing hypotheses suit agents that can compare findings during the same session. The lead can collect their work without needing the team to survive a later session.

Reach for a queue when [the backlog outlives the session](https://retasc.com/guides/claude-code-handoff) or spans machines and runtimes. Retasc works over MCP with Claude Code, Codex, Cursor, OpenCode and Gemini CLI, so the next agent of the same person can resume the owned issue without joining the old team. Review can also cross the team boundary. Retasc dispatches a review to a different person’s agent. The server refuses to let whoever sent the work to review claim or accept that review.

*Diagram: What moves when the task list moves to a server*

A team can use both layers together. Retasc does not spawn teammates or read their task list, so the queue stays separate from the team’s messages and local tasks. Retasc bills per action, with no seats and free, unlimited members. A dispatch through `next_issue`, `next_batch` or `claim_issue` costs $0.007. Recording a checkpoint costs $0.005.

The closing-the-laptop test is whether the next session can pick up the work. A team’s task list remains on disk, while its config is removed at session end. With Retasc, the issue keeps its checkpoint when the lease lapses. The same person’s next agent can claim it from the owner’s lane on another runtime. The claim carries what is done, what is next and the gotchas. You can keep using teammates for the work in front of you while the queue carries that handoff.

## Questions about agent teams

**How do I set up multi-agent teams in Claude Code?**

Set `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in the environment or `settings.json`, then ask Claude in the CLI for named teammates. Since v2.1.178, each session has an implicit team with no `TeamCreate` step. On models without Task tools enabled by default, set `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` to use the shared task list.

**What are the differences between agent teams and subagents in Claude Code?**

Subagents return results to their caller, while teammates can message peers. Each teammate has its own context window and can use the shared task list when Task tools are enabled. With teams enabled, named subagents become teammates.

**Does Codex have agent teams like Claude Code?**

OpenAI’s Codex docs describe subagents and no agent teams. Codex collects their results into a consolidated response. Its docs describe no shared task list or claiming across separate chats.

**Are Claude Code agent teams production-ready?**

Anthropic labels agent teams a research preview, available since v2.1.32. Its documented limits include teammates that `/resume` does not restore, lagging task status and same-file overwrites. A task list surviving on disk does not restore the team config removed at session end.

**Can I run an agent team in CI?**

Claude Code does not spawn teammates when a CI run uses `-p` or an Agent SDK session. Agent teams are available in the CLI and are unavailable in the desktop app.

**Do Claude Code teammates get my MCP servers?**

Teammates load the project’s MCP servers, along with `CLAUDE.md` and skills. That lets each teammate call Retasc’s `next_issue` itself. Retasc does not need to read the team’s task list.

**How many teammates should an agent team have?**

Anthropic suggests starting with 3 to 5 teammates. Its costs page estimates about 7x the tokens of a standard session when teammates run in plan mode. It advises Sonnet for teammates.

Run this command in your repo folder so the lead and every teammate pull from a shared work queue for AI coding agents that outlives the session. A new org gets $10 of usage at signup, no card.

```sh
$ npx @retasc/cli@latest bind
```

[Other ways](https://retasc.com/wire) [Set up the fleet](https://retasc.com/guides/claude-code-parallel-agents)

## Related guides

### [Claude Code subagents: dispatching waves with next_batch One orchestrator session, N subagents, and a server that guarantees the wave is safe to run. [waves][next_batch]7 min](https://retasc.com/guides/claude-code-subagents) ### [Run multiple Claude Code agents in parallel A git worktree per agent, a shared queue with atomic claims, and checkpoint handoffs when an agent dies. [worktrees][queue]8 min](https://retasc.com/guides/claude-code-parallel-agents) ### [What is an agent swarm, and how do you keep one from colliding? The definition, the three failure modes, and the three server-side controls that make a swarm usable. [definition][controls]7 min](https://retasc.com/guides/agent-swarm)
