Welcome to the Coordinator project! In this first chapter, we are going to explore the core philosophy behind this system: the Coordinator Role.
Imagine you are building a house. If you try to lay the bricks, install the plumbing, wire the electricity, and paint the walls all by yourself, at the exact same time, you will likely make mistakes or get exhausted.
Standard AI coding assistants often act like this "solo developer." They try to hold the entire context of a complex project in one thread, executing tasks sequentially. This leads to:
The Coordinator Role changes the AI's job description. Instead of being the solo developer, the AI becomes the Project Manager.
The Coordinator's job is to:
Let's say a user reports: "There is a null pointer error in the authentication module."
Without Coordinator: The AI reads the code, tries to reproduce it, writes a fix, and runs testsβall in one long, messy conversation.
With Coordinator:
auth/."The Coordinator does not write files or run shell commands directly (unless they are trivial). Its primary "tools" are management tools. It thinks in terms of delegation.
Because the Coordinator delegates work, it can run multiple tasks at once. It can research a bug while simultaneously checking documentation.
The Coordinator is the only one who talks to the User. Workers report to the Coordinator, and the Coordinator translates that technical data into a helpful summary for the User.
How does the AI know it's a Coordinator? It all starts with the System Prompt. When the session begins, we inject specific instructions that define this persona.
Here is what happens when you ask the Coordinator a question:
The logic relies on checking if "Coordinator Mode" is active and then supplying the correct "System Prompt" (the AI's core instructions).
File: coordinatorMode.ts
// Checks if the Coordinator feature flag is on
export function isCoordinatorMode(): boolean {
if (feature('COORDINATOR_MODE')) {
// Returns true if the env var is set to '1'
return isEnvTruthy(process.env.CLAUDE_CODE_COORDINATOR_MODE)
}
return false
}
If this returns true, we generate the special System Prompt:
export function getCoordinatorSystemPrompt(): string {
// We define the specific role clearly
return `You are Claude Code, an AI assistant that orchestrates software engineering tasks...
## 1. Your Role
You are a **coordinator**. Your job is to:
- Direct workers to research, implement and verify code changes
- Synthesize results and communicate with the user`
}
To act as a manager, the Coordinator needs specific tools. These are defined in the prompt instructions so the AI knows they exist.
/*
Inside getCoordinatorSystemPrompt(), we list the tools.
Notice the Coordinator creates workers via AGENT_TOOL_NAME.
*/
// ...
// ## 2. Your Tools
// - **AgentTool** - Spawn a new worker
// - **SendMessageTool** - Continue an existing worker
// - **TaskStopTool** - Stop a running worker
// ...
The Coordinator uses AgentTool to create a worker. We will cover the lifecycle of these workers in detail in Worker Lifecycle Management.
One of the biggest advantages of the Coordinator is Context Hygiene. The Coordinator doesn't need to see every line of code read by a worker.
// From coordinatorMode.ts
export function getCoordinatorUserContext(...): { [k: string]: string } {
if (!isCoordinatorMode()) {
return {}
}
// We tell the Coordinator what tools its WORKERS have access to.
// The Coordinator doesn't use these tools directly, but needs to know
// what its employees can do (e.g., "Workers have access to Bash...").
return {
workerToolsContext: `Workers spawned via the AgentTool have access to...`
}
}
By separating the "Manager" context from the "Worker" context, we keep the main conversation clean and focused on high-level goals.
In this chapter, we learned:
AgentTool).Now that we understand who the Coordinator is, we need to learn how it hires and manages its team.
Next Chapter: Worker Lifecycle Management
Generated by Code IQ