Skip to content

feat: activate coordinator mode in open build - #647

Merged
kevincodex1 merged 3 commits into
Twigpine:mainfrom
Flo5k5:feat/activate-coordinator-mode
Apr 13, 2026
Merged

kevincodex1 merged 3 commits into
Twigpine:mainfrom
Flo5k5:feat/activate-coordinator-mode

Conversation

@Flo5k5

@Flo5k5 Flo5k5 commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Activate the full multi-agent system in the open build: coordinator mode, worker agents, and built-in Explore/Plan agents.

Highlight: agent nesting unlocked

The most impactful change is a single line removed in src/constants/tools.ts:41 (PR #644):

...(process.env.USER_TYPE === 'ant' ? [] : [AGENT_TOOL_NAME]),

This line added AGENT_TOOL_NAME to the disallowed tools list for sub-agents, preventing non-ant users from using recursive agent workflows. Removing it unlocks recursive agent spawning: a sub-agent can now spawn its own sub-agents. This enables complex coordination patterns (agent teams, hierarchical delegation) that were previously reserved for Anthropic employees.

Changes (3 commits)

1. Coordinator mode activated (scripts/build.ts, src/coordinator/workerAgent.ts)

  • Enable COORDINATOR_MODE: true build flag
  • Create workerAgent.ts — the only missing module from the source snapshot
  • Includes WORKER_AGENT with agentType: 'worker' to match the coordinator system prompt's subagent_type: "worker" instructions

2. Explore and Plan agents activated (scripts/build.ts)

  • Enable BUILTIN_EXPLORE_PLAN_AGENTS: true build flag
  • Makes Explore (fast, haiku, read-only) and Plan (architect, read-only) agents available in both normal and coordinator modes
  • Resolves the inconsistency where coordinator workers had these agents but normal sessions did not

What is coordinator mode?

A multi-agent orchestration system:

  • A coordinator receives the user's task and decomposes it into sub-tasks
  • It spawns workers via AgentTool that execute in parallel
  • Workers communicate back via SendMessageTool, coordinator can stop them with TaskStopTool
  • A 252-line system prompt guides the coordinator's orchestration strategy
  • Session mode persists across restarts

Runtime activation

Coordinator mode is opt-in at runtime:

export CLAUDE_CODE_COORDINATOR_MODE=1

Explore and Plan agents are always available (no env var needed).

Optional scratchpad for cross-worker knowledge sharing:

// ~/.claude/feature-flags.json (requires #639)
{ "tengu_scratch": true }

Relationship to other PRs

Test plan

  • bun run build — compiles successfully
  • bun run smoke — smoke tests pass
  • Set CLAUDE_CODE_COORDINATOR_MODE=1, verify coordinator system prompt loads
  • Spawn a worker agent with subagent_type: "worker", verify it resolves
  • Verify Explore and Plan agents appear in /agent list
  • Test session resume preserves coordinator mode
  • Verify coordinator mode is inactive by default (no env var = normal mode)

Enable the COORDINATOR_MODE feature flag and create the missing
src/coordinator/workerAgent.ts module that provides worker agent
definitions for the coordinator.

Coordinator mode is a multi-agent system where a coordinator agent
orchestrates independent workers via AgentTool, SendMessageTool,
and TaskStopTool. The implementation was already 99% complete
(19KB coordinatorMode.ts, 26 gate sites across 15 files) — only
the workerAgent module was missing from the source snapshot.

Workers get the standard built-in agents (general-purpose, explore,
plan). The coordinator system prompt (252 lines) handles all
orchestration logic.

Activate at runtime: CLAUDE_CODE_COORDINATOR_MODE=1
Optional scratchpad: set {"tengu_scratch": true} in
~/.claude/feature-flags.json (Twigpine#639)
Copilot AI review requested due to automatic review settings April 12, 2026 22:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables the open-build COORDINATOR_MODE feature flag and adds the missing coordinator worker agent module so coordinator-mode wiring can resolve at build/runtime.

Changes:

  • Added src/coordinator/workerAgent.ts to supply coordinator-mode agent definitions.
  • Enabled COORDINATOR_MODE: true in scripts/build.ts so coordinator-mode code is included in open builds.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/coordinator/workerAgent.ts Adds getCoordinatorAgents() used by builtInAgents.ts when coordinator mode is active.
scripts/build.ts Flips the open-build flag to include coordinator-mode code paths in the bundled output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/coordinator/workerAgent.ts Outdated
Flo5k5 added 2 commits April 13, 2026 00:22
The coordinator system prompt instructs the model to spawn workers with
subagent_type: "worker", but no agent had agentType === 'worker'.
This caused AgentTool to throw "Agent type 'worker' not found" on
every coordinator spawn attempt.

Add a WORKER_AGENT definition that spreads GENERAL_PURPOSE_AGENT with
agentType: 'worker'. Also use the narrower BuiltInAgentDefinition type.
Enable BUILTIN_EXPLORE_PLAN_AGENTS so Explore (fast, haiku, read-only)
and Plan (architect, read-only) agents are available to all users in
both normal and coordinator modes.

This resolves the inconsistency flagged in code review: coordinator
workers had access to Explore/Plan agents while normal sessions did not.

The GrowthBook A/B test gate (tengu_amber_stoat) defaults to true via
the no-telemetry stub. Users can disable via feature-flags.json (Twigpine#639).
Copilot AI review requested due to automatic review settings April 12, 2026 22:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/build.ts
Flo5k5 added a commit to Flo5k5/openclaude that referenced this pull request Apr 13, 2026
With KAIROS=true, MONITOR_TOOL=true, and COORDINATOR_MODE=true, the build
system's auto-generated noop stubs are truthy — causing runtime crashes when
included in tool/task arrays. Add proper null-export stubs so conditional
checks (?:) correctly exclude them.

Stubs added:
- MonitorTool, MonitorMcpTask, MonitorMcpDetailDialog, MonitorPermissionRequest
  (will be replaced by PR Twigpine#649's full implementation)
- SendUserFileTool, PushNotificationTool (internal tools, no open-build impl)
- coordinator/workerAgent (will be replaced by PR Twigpine#647's implementation)
Flo5k5 added a commit to Flo5k5/openclaude that referenced this pull request Apr 13, 2026
…ent (Twigpine#647)

Replace null stubs with full implementations from PRs Twigpine#649 and Twigpine#647:

- MonitorTool: streaming shell output tool with bash permission delegation,
  background task spawning, and 30min timeout (PR Twigpine#649)
- MonitorMcpTask: task registry entry with agent-scoped cleanup for
  monitor-kind shell tasks (PR Twigpine#649)
- MonitorPermissionRequest: permission UI with "don't ask again" support,
  delegates rules to Bash toolName for correct matching (PR Twigpine#649)
- workerAgent: WORKER_AGENT definition + getCoordinatorAgents() returning
  worker, general-purpose, explore, and plan agents (PR Twigpine#647)

MonitorMcpDetailDialog remains a null stub (not in PR Twigpine#649's scope).
@kevincodex1
kevincodex1 merged commit 99a1714 into Twigpine:main Apr 13, 2026
4 of 5 checks passed
C1ph3r404 pushed a commit to C1ph3r404/openclaude that referenced this pull request Apr 29, 2026
* feat: activate coordinator mode in open build

Enable the COORDINATOR_MODE feature flag and create the missing
src/coordinator/workerAgent.ts module that provides worker agent
definitions for the coordinator.

Coordinator mode is a multi-agent system where a coordinator agent
orchestrates independent workers via AgentTool, SendMessageTool,
and TaskStopTool. The implementation was already 99% complete
(19KB coordinatorMode.ts, 26 gate sites across 15 files) — only
the workerAgent module was missing from the source snapshot.

Workers get the standard built-in agents (general-purpose, explore,
plan). The coordinator system prompt (252 lines) handles all
orchestration logic.

Activate at runtime: CLAUDE_CODE_COORDINATOR_MODE=1
Optional scratchpad: set {"tengu_scratch": true} in
~/.claude/feature-flags.json (Twigpine#639)

* fix: add worker agent type for coordinator mode

The coordinator system prompt instructs the model to spawn workers with
subagent_type: "worker", but no agent had agentType === 'worker'.
This caused AgentTool to throw "Agent type 'worker' not found" on
every coordinator spawn attempt.

Add a WORKER_AGENT definition that spreads GENERAL_PURPOSE_AGENT with
agentType: 'worker'. Also use the narrower BuiltInAgentDefinition type.

* feat: activate built-in explore and plan agents in open build

Enable BUILTIN_EXPLORE_PLAN_AGENTS so Explore (fast, haiku, read-only)
and Plan (architect, read-only) agents are available to all users in
both normal and coordinator modes.

This resolves the inconsistency flagged in code review: coordinator
workers had access to Explore/Plan agents while normal sessions did not.

The GrowthBook A/B test gate (tengu_amber_stoat) defaults to true via
the no-telemetry stub. Users can disable via feature-flags.json (Twigpine#639).
The-FOOL-00 pushed a commit to The-FOOL-00/openclaude that referenced this pull request May 24, 2026
* feat: activate coordinator mode in open build

Enable the COORDINATOR_MODE feature flag and create the missing
src/coordinator/workerAgent.ts module that provides worker agent
definitions for the coordinator.

Coordinator mode is a multi-agent system where a coordinator agent
orchestrates independent workers via AgentTool, SendMessageTool,
and TaskStopTool. The implementation was already 99% complete
(19KB coordinatorMode.ts, 26 gate sites across 15 files) — only
the workerAgent module was missing from the source snapshot.

Workers get the standard built-in agents (general-purpose, explore,
plan). The coordinator system prompt (252 lines) handles all
orchestration logic.

Activate at runtime: CLAUDE_CODE_COORDINATOR_MODE=1
Optional scratchpad: set {"tengu_scratch": true} in
~/.claude/feature-flags.json (Twigpine#639)

* fix: add worker agent type for coordinator mode

The coordinator system prompt instructs the model to spawn workers with
subagent_type: "worker", but no agent had agentType === 'worker'.
This caused AgentTool to throw "Agent type 'worker' not found" on
every coordinator spawn attempt.

Add a WORKER_AGENT definition that spreads GENERAL_PURPOSE_AGENT with
agentType: 'worker'. Also use the narrower BuiltInAgentDefinition type.

* feat: activate built-in explore and plan agents in open build

Enable BUILTIN_EXPLORE_PLAN_AGENTS so Explore (fast, haiku, read-only)
and Plan (architect, read-only) agents are available to all users in
both normal and coordinator modes.

This resolves the inconsistency flagged in code review: coordinator
workers had access to Explore/Plan agents while normal sessions did not.

The GrowthBook A/B test gate (tengu_amber_stoat) defaults to true via
the no-telemetry stub. Users can disable via feature-flags.json (Twigpine#639).
discopops pushed a commit to discopops/openclaude that referenced this pull request May 28, 2026
* feat: activate coordinator mode in open build

Enable the COORDINATOR_MODE feature flag and create the missing
src/coordinator/workerAgent.ts module that provides worker agent
definitions for the coordinator.

Coordinator mode is a multi-agent system where a coordinator agent
orchestrates independent workers via AgentTool, SendMessageTool,
and TaskStopTool. The implementation was already 99% complete
(19KB coordinatorMode.ts, 26 gate sites across 15 files) — only
the workerAgent module was missing from the source snapshot.

Workers get the standard built-in agents (general-purpose, explore,
plan). The coordinator system prompt (252 lines) handles all
orchestration logic.

Activate at runtime: CLAUDE_CODE_COORDINATOR_MODE=1
Optional scratchpad: set {"tengu_scratch": true} in
~/.claude/feature-flags.json (Twigpine#639)

* fix: add worker agent type for coordinator mode

The coordinator system prompt instructs the model to spawn workers with
subagent_type: "worker", but no agent had agentType === 'worker'.
This caused AgentTool to throw "Agent type 'worker' not found" on
every coordinator spawn attempt.

Add a WORKER_AGENT definition that spreads GENERAL_PURPOSE_AGENT with
agentType: 'worker'. Also use the narrower BuiltInAgentDefinition type.

* feat: activate built-in explore and plan agents in open build

Enable BUILTIN_EXPLORE_PLAN_AGENTS so Explore (fast, haiku, read-only)
and Plan (architect, read-only) agents are available to all users in
both normal and coordinator modes.

This resolves the inconsistency flagged in code review: coordinator
workers had access to Explore/Plan agents while normal sessions did not.

The GrowthBook A/B test gate (tengu_amber_stoat) defaults to true via
the no-telemetry stub. Users can disable via feature-flags.json (Twigpine#639).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants