Enabling coordinator mode
cc-query crate’s agent_tool.rs and takes on the orchestrator role for the session.
The four-phase workflow
Coordinator mode structures every complex task into four distinct phases:
The coordinator never writes code itself during implementation — it delegates to workers and reads their output before issuing precise instructions.
Parallelism principle
The coordinator system prompt makes this explicit:“Parallelism is your superpower. Workers are async. Launch independent workers concurrently whenever possible — don’t serialize work that can run simultaneously.”Independent research tasks, parallel file investigations, and concurrent test runs should all be dispatched simultaneously rather than one at a time.
Worker communication
Workers communicate back to the coordinator using<task-notification> XML messages. These structured messages carry status updates, findings, and results that the coordinator reads and acts upon during the Synthesis phase.
Shared scratchpad
Thetengu_scratch feature gate enables a shared scratchpad directory for cross-worker durable knowledge sharing. Workers can write intermediate findings here so that later workers (or the coordinator itself) can read accumulated context without re-running expensive operations.
Agent swarm mode
Beyond the four-phase workflow, Claurst supports an agent swarm mode (gated by thetengu_amber_flint feature) with two teammate models:
- In-process teammates — share the same process using
AsyncLocalStoragefor context isolation, with color assignments for visual distinction in the terminal. - Process-based teammates — run as separate processes managed via tmux or iTerm2 panes, enabling full isolation with independent working directories and tool access.
Spawning sub-agents programmatically
TheAgentTool (exposed as "Task" in the tool registry) lets the coordinator spawn sub-agents directly from a tool call:
AgentTool creates a dedicated AnthropicClient, filters the tool list to the specified subset (always excluding AgentTool itself to prevent unbounded recursion), and runs an independent run_query_loop. The final assistant message is returned as the tool result.
Background task management
For longer-running work, the coordinator uses the task management tools backed by the globalTASK_STORE in cc-tools:
Tasks move through states:
Pending → InProgress → Completed (or Failed). The coordinator polls task state to know when workers have finished before entering the Synthesis phase.
Example: coordinator session
1
Enable coordinator mode
2
Describe the high-level task
Give Claurst a complex, multi-file task. It will automatically enter coordinator mode and plan the worker dispatch strategy.
3
Research phase runs in parallel
The coordinator spawns multiple workers simultaneously via
AgentTool, each investigating a different aspect of the codebase. Workers write findings to the shared scratchpad.4
Coordinator synthesizes
After all research workers complete, the coordinator reads every finding and crafts precise implementation specs — specifying exact files, line numbers, and changes required.
5
Implementation workers execute
Workers receive deterministic specs and make targeted changes. Because the coordinator read the actual findings, there is no ambiguity in the instructions.
6
Verification workers confirm
A final wave of workers runs tests and checks to confirm all changes are correct before the coordinator reports completion.