Skip to main content
Claude Code can orchestrate multiple agents working in parallel on different aspects of a task. The coordinator system manages agent teams, inter-agent communication, and task lifecycle. Source location: src/coordinator/, src/tasks/

How it works

The coordinator spawns sub-agents via AgentTool, organizes them into teams, and routes messages between agents and back to the primary session. Each agent runs its own Query Engine instance with access to the full tool set.
The coordinator is gated behind the COORDINATOR_MODE feature flag. Proactive scheduling behavior is separately controlled by the PROACTIVE flag.

Core tools

AgentTool

Spawns a sub-agent to work on a specific task. The sub-agent runs with its own context and reports results back to the coordinator.

TeamCreateTool

Creates a named team of agents for coordinated parallel work.

TeamDeleteTool

Dissolves a team and cleans up its associated agents and resources.

SendMessageTool

Sends a message to a specific agent or team, enabling inter-agent communication.

SleepTool

Pauses an agent for a specified duration — useful in polling loops or when waiting for external events.

Task types

The task system (src/tasks/) underpins multi-agent execution. Each task type maps to a different execution environment:
Task typeLocationPurpose
LocalShellTaskLocalShellTask/Background shell command execution
LocalAgentTaskLocalAgentTask/Sub-agent running locally in a separate process
RemoteAgentTaskRemoteAgentTask/Agent running on a remote machine
InProcessTeammateTaskInProcessTeammateTask/Parallel teammate agent running in the same process
DreamTaskDreamTask/Background ideation or planning process
LocalMainSessionTaskLocalMainSessionTask.tsThe main session itself represented as a task

Task management tools

ToolPurpose
TaskCreateToolCreate a new background task
TaskUpdateToolUpdate task status or metadata
TaskGetToolRetrieve details of a specific task
TaskListToolList all active and completed tasks
TaskOutputToolGet the output produced by a task
TaskStopToolStop a running task

Coordinator mode

coordinatorMode.ts manages the coordinator lifecycle. When COORDINATOR_MODE is enabled, the primary session acts as an orchestrator rather than a direct executor — it delegates work to sub-agents and synthesizes their results.
1

Task decomposition

The coordinator analyzes the user’s request and breaks it into parallel subtasks.
2

Team creation

TeamCreateTool assembles a team of agents sized to the workload.
3

Work distribution

The coordinator assigns subtasks to agents via AgentTool and SendMessageTool.
4

Progress monitoring

Active tasks are tracked via TaskListTool and TaskGetTool. The coordinator polls or awaits completion signals.
5

Result synthesis

Once all agents complete their work, the coordinator aggregates results and delivers a unified response to the user.

Proactive mode

When the PROACTIVE flag is enabled, the coordinator can initiate work without an explicit user prompt — for example, picking up scheduled tasks, reacting to file system changes, or acting on remote agent messages.
Proactive mode allows Claude Code to take actions autonomously. Ensure appropriate permission rules are configured before enabling this flag.

Remote agents

RemoteAgentTask and the scheduleRemoteAgents skill allow tasks to be dispatched to agents running on remote machines. This is useful for distributing work across a fleet or for running tasks in isolated environments.
# Use the scheduleRemoteAgents skill to dispatch work remotely
/skills scheduleRemoteAgents

Build docs developers (and LLMs) love