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:| Phase | Who | Purpose |
|---|---|---|
| Research | Workers (parallel) | Investigate codebase, find files, understand the problem |
| Synthesis | Coordinator | Read findings, understand the problem, craft specs |
| Implementation | Workers | Make targeted changes per spec, commit |
| Verification | Workers | Test changes work |
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:
| Tool | What it does |
|---|---|
TaskCreateTool | Creates a background task with a UUID, subject, and description |
TaskGetTool | Returns the current state of a task by ID |
TaskListTool | Lists all non-deleted tasks with optional status filter |
TaskUpdateTool | Updates task fields; setting status=deleted removes it |
Pending → InProgress → Completed (or Failed). The coordinator polls task state to know when workers have finished before entering the Synthesis phase.
Example: coordinator session
Describe the high-level task
Give Claurst a complex, multi-file task. It will automatically enter coordinator mode and plan the worker dispatch strategy.
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.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.
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.