Skip to main content

Module coordinator

Module coordinator 

Source
Expand description

Coordinator mode gate and tool-set allow-list.

§What is coordinator mode?

When a recursive process is launched with both:

  • the env var RECURSIVE_COORDINATOR_MODE=1, AND
  • the cargo feature coordinator-mode

the process runs as a coordinator — a higher-level agent that dispatches work to teammates via the team_*, task_*, and send_message tools, but is itself restricted to a curated allow-list of tools. In particular, the coordinator must NOT have direct Edit / Write / Bash access; otherwise it would short-circuit the team and do the work itself.

§Allow-list

The set of tools available in coordinator mode is additive over the standard toolset: all non-mutating read-only tools are kept, plus a handful of “meta” tools. Tools that let the coordinator reach into the filesystem or shell are excluded.

This is intentionally conservative. A real product would also exclude MultiEdit, NotebookEdit, etc.; we mirror that intent below for completeness even if those tools don’t exist in the current kernel.

Functions§

coordinator_deny_list
Tools that the coordinator mode MUST NOT have access to, even if they otherwise pass the read-only filter. This is a defense-in-depth list — the primary filter is coordinator_tool_set(), but if a future change accidentally broadens that list, the deny list here will still keep these out.
coordinator_tool_set
The set of tool names available in coordinator mode.
filter_registry
Prune a ToolRegistry down to the coordinator allow-list when the process is running in coordinator mode. No-op otherwise. This is the wiring point that the kernel calls right after build_tools() — see src/cli/builder.rs.
is_allowed_in_coordinator_mode
Sanity check: a tool name is allowed in coordinator mode iff it is in the allow-list AND not in the deny-list. The deny-list exists to catch accidental future additions; the allow-list is the source of truth.
is_coordinator_mode
Returns true iff this process is running in coordinator mode.
is_coordinator_tool
Returns true if tool_name is allowed in coordinator mode.