coordinator

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: MIT Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func IsTaskNotification(text string) bool

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

func MatchSessionMode(sessionMode string) string

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

func UserContext(mcpServerNames []string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL