From 99a17144ee285b892a0801acb6abcc9af68879af Mon Sep 17 00:00:00 2001 From: Nourrisse Florian <3023852+Flo5k5@users.noreply.github.com> Date: Mon, 13 Apr 2026 15:19:57 +0200 Subject: [PATCH] feat: activate coordinator mode in open build (#647) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 (#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 (#639). --- scripts/build.ts | 3 ++- src/coordinator/workerAgent.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/coordinator/workerAgent.ts diff --git a/scripts/build.ts b/scripts/build.ts index 2982f1f8..52b7953c 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -29,7 +29,8 @@ const featureFlags: Record = { ABLATION_BASELINE: false, DUMP_SYSTEM_PROMPT: false, CACHED_MICROCOMPACT: false, - COORDINATOR_MODE: false, + COORDINATOR_MODE: true, + BUILTIN_EXPLORE_PLAN_AGENTS: true, CONTEXT_COLLAPSE: false, COMMIT_ATTRIBUTION: false, TEAMMEM: false, diff --git a/src/coordinator/workerAgent.ts b/src/coordinator/workerAgent.ts new file mode 100644 index 00000000..8e65cf9c --- /dev/null +++ b/src/coordinator/workerAgent.ts @@ -0,0 +1,18 @@ +import type { BuiltInAgentDefinition } from '../tools/AgentTool/loadAgentsDir.js' +import { EXPLORE_AGENT } from '../tools/AgentTool/built-in/exploreAgent.js' +import { GENERAL_PURPOSE_AGENT } from '../tools/AgentTool/built-in/generalPurposeAgent.js' +import { PLAN_AGENT } from '../tools/AgentTool/built-in/planAgent.js' + +// The coordinator system prompt instructs the model to spawn workers with +// subagent_type: "worker". This agent definition matches that type so +// AgentTool.tsx can resolve it. It reuses GENERAL_PURPOSE_AGENT's capabilities. +const WORKER_AGENT: BuiltInAgentDefinition = { + ...GENERAL_PURPOSE_AGENT, + agentType: 'worker', + whenToUse: + 'Worker agent for coordinator mode. Executes tasks autonomously — research, implementation, or verification.', +} + +export function getCoordinatorAgents(): BuiltInAgentDefinition[] { + return [WORKER_AGENT, GENERAL_PURPOSE_AGENT, EXPLORE_AGENT, PLAN_AGENT] +}