Documentation
¶
Overview ¶
Package coordinator implements coordinator mode — the orchestrator persona that manages sub-agent workers. Mirrors src/coordinator/coordinatorMode.ts.
Coordinator mode is activated by setting CLAUDE_CODE_COORDINATOR_MODE=1 in the environment (or via the /coordinator command, which toggles the env var). When active, the coordinator system prompt is injected as an additional system block, and RunSubAgent results are wrapped in <task-notification> XML before being surfaced to the model.
Index ¶
- Variables
- func IsActive() bool
- func IsTaskNotification(text string) bool
- func MatchSessionMode(sessionMode string) string
- func SetActive(active bool)
- func SystemPrompt() string
- func TaskNotification(agentID, status, summary, result string, totalTokens, toolUses int, ...) string
- func UserContext(mcpServerNames []string) string
Constants ¶
This section is empty.
Variables ¶
var WorkerTools = []string{
"Bash",
"Edit",
"EnterPlanMode",
"EnterWorktree",
"ExitPlanMode",
"ExitWorktree",
"Glob",
"Grep",
"ListMcpResources",
"NotebookEdit",
"Read",
"ReadMcpResource",
"REPL",
"SkillTool",
"Sleep",
"Task",
"TaskCreate",
"TaskGet",
"TaskList",
"TaskOutput",
"TaskStop",
"TaskUpdate",
"TodoWrite",
"ToolSearch",
"WebFetch",
"WebSearch",
"Write",
}
WorkerTools is the set of tools available to sub-agent workers when in coordinator mode. Mirrors ASYNC_AGENT_ALLOWED_TOOLS from tools.js minus internal-only tools (SyntheticOutput, SendMessage, TeamCreate, TeamDelete).
Functions ¶
func IsActive ¶
func IsActive() bool
IsActive reports whether coordinator mode is currently enabled.
func IsTaskNotification ¶
IsTaskNotification reports whether a message text starts with a <task-notification> block (used by the coordinator to distinguish worker results from real user messages).
func MatchSessionMode ¶
MatchSessionMode ensures the running mode matches the stored session mode. If they differ, it flips the env var and returns a notice string. Returns "" when no switch was needed. Mirrors matchSessionMode() in coordinatorMode.ts.
func SetActive ¶
func SetActive(active bool)
SetActive enables or disables coordinator mode by setting/unsetting the env var.
func SystemPrompt ¶
func SystemPrompt() string
SystemPrompt returns the coordinator system prompt to be injected as an additional system block when coordinator mode is active. Mirrors getCoordinatorSystemPrompt() in coordinatorMode.ts.
func TaskNotification ¶
func TaskNotification(agentID, status, summary, result string, totalTokens, toolUses int, durationMs int64) string
TaskNotification builds the <task-notification> XML message that wraps a completed sub-agent result. This is injected into the conversation as a user message so the coordinator model can see it.
func UserContext ¶
UserContext returns the "workerToolsContext" system-reminder injected into each coordinator turn, listing what tools workers can use. mcpServerNames is the list of connected MCP server names. Mirrors getCoordinatorUserContext() in coordinatorMode.ts.
Types ¶
This section is empty.