orchestrator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Orchestrator - Automated Multi-Agent Coordinator

Orchestrator - 自动化多Agent协调器

When to use

适用场景

  • Complex feature requires multiple specialized agents working in parallel
  • User wants automated execution without manually spawning agents
  • Full-stack implementation spanning backend, frontend, mobile, and QA
  • User says "run it automatically", "run in parallel", or similar automation requests
  • 复杂功能需要多个专业Agent并行工作
  • 用户希望自动执行任务,无需手动启动Agent
  • 涉及后端、前端、移动端和QA的全栈实现
  • 用户提出“自动运行”、“并行运行”或类似自动化需求

When NOT to use

不适用场景

  • Simple single-domain task -> use the specific agent directly
  • User wants step-by-step manual control -> use workflow-guide
  • Quick bug fixes or minor changes
  • 简单的单领域任务 → 直接使用特定Agent即可
  • 用户希望分步手动控制 → 使用工作流向导(workflow-guide)
  • 快速bug修复或小改动

Important

注意事项

This skill orchestrates CLI subagents via
gemini -p "..." --approval-mode=yolo
. It uses MCP Memory tools as a shared state bus. Each subagent runs as an independent process.
本技能通过
gemini -p "..." --approval-mode=yolo
编排CLI子Agent,使用MCP Memory工具作为共享状态总线。每个子Agent作为独立进程运行。

Configuration

配置

SettingDefaultDescription
MAX_PARALLEL3Max concurrent subagents
MAX_RETRIES2Retry attempts per failed task
POLL_INTERVAL30sStatus check interval
MAX_TURNS (impl)20Turn limit for backend/frontend/mobile
MAX_TURNS (review)15Turn limit for qa/debug
MAX_TURNS (plan)10Turn limit for pm
设置项默认值描述
MAX_PARALLEL3最大并发子Agent数量
MAX_RETRIES2每个失败任务的重试次数
POLL_INTERVAL30s状态检查间隔
MAX_TURNS (impl)20后端/前端/移动端的交互轮次上限
MAX_TURNS (review)15QA/调试的交互轮次上限
MAX_TURNS (plan)10产品经理(pm)的交互轮次上限

Memory Configuration

内存配置

Memory provider and tool names are configurable via
mcp.json
:
json
{
  "memoryConfig": {
    "provider": "serena",
    "basePath": ".serena/memories",
    "tools": {
      "read": "read_memory",
      "write": "write_memory",
      "edit": "edit_memory"
    }
  }
}
内存提供商和工具名称可通过
mcp.json
配置:
json
{
  "memoryConfig": {
    "provider": "serena",
    "basePath": ".serena/memories",
    "tools": {
      "read": "read_memory",
      "write": "write_memory",
      "edit": "edit_memory"
    }
  }
}

Workflow Phases

工作流阶段

PHASE 1 - Plan: Analyze request -> decompose tasks -> generate session ID PHASE 2 - Setup: Use memory write tool to create
orchestrator-session.md
+
task-board.md
PHASE 3 - Execute: Spawn agents by priority tier (never exceed MAX_PARALLEL) PHASE 4 - Monitor: Poll every POLL_INTERVAL; handle completed/failed/crashed agents PHASE 4.5 - Verify: Run
../_shared/verify.sh {agent-type} {workspace}
per completed agent PHASE 5 - Collect: Read all
result-{agent}.md
, compile summary, cleanup progress files
See
resources/subagent-prompt-template.md
for prompt construction. See
resources/memory-schema.md
for memory file formats.
阶段1 - 规划:分析请求→分解任务→生成会话ID 阶段2 - 准备:使用内存写入工具创建
orchestrator-session.md
task-board.md
阶段3 - 执行:按优先级层级启动Agent(绝不超过MAX_PARALLEL上限) 阶段4 - 监控:每隔POLL_INTERVAL轮询一次;处理已完成/失败/崩溃的Agent 阶段4.5 - 验证:针对每个已完成的Agent运行
../_shared/verify.sh {agent-type} {workspace}
阶段5 - 汇总:读取所有
result-{agent}.md
文件,编译汇总报告,清理进度文件
提示词构建可参考
resources/subagent-prompt-template.md
。 内存文件格式可参考
resources/memory-schema.md

Memory File Ownership

内存文件归属

FileOwnerOthers
orchestrator-session.md
orchestratorread-only
task-board.md
orchestratorread-only
progress-{agent}.md
that agentorchestrator reads
result-{agent}.md
that agentorchestrator reads
文件归属方其他角色权限
orchestrator-session.md
编排器只读
task-board.md
编排器只读
progress-{agent}.md
对应Agent编排器可读取
result-{agent}.md
对应Agent编排器可读取

Verification Gate (PHASE 4.5)

验证环节(阶段4.5)

After each agent completes, run automated verification before accepting the result:
bash
bash .agent/skills/_shared/verify.sh {agent-type} {workspace}
  • PASS (exit 0): Accept result, advance to next task
  • FAIL (exit 1): Treat as failure → enter Retry Logic with verify output as error context
  • This is mandatory. Never skip verification even if the agent reports success.
每个Agent完成任务后,需先运行自动化验证才能接受结果:
bash
bash .agent/skills/_shared/verify.sh {agent-type} {workspace}
  • 通过(退出码0):接受结果,推进至下一任务
  • 失败(退出码1):判定为任务失败→进入重试逻辑,将验证输出作为错误上下文
  • 此环节为必填项,即使Agent报告成功也绝不能跳过验证

Retry Logic

重试逻辑

  • 1st retry: Wait 30s, re-spawn with error context (include verify.sh output)
  • 2nd retry: Wait 60s, add "Try a different approach"
  • Final failure: Report to user, ask whether to continue or abort
  • 第1次重试:等待30秒,携带错误上下文重新启动Agent(包含verify.sh输出)
  • 第2次重试:等待60秒,添加“尝试不同方法”提示
  • 最终失败:向用户报告情况,询问是否继续或终止任务

Serena Memory (CLI Mode)

Serena内存(CLI模式)

See
../_shared/memory-protocol.md
.
详情请参考
../_shared/memory-protocol.md

References

参考资料

  • Prompt template:
    resources/subagent-prompt-template.md
  • Memory schema:
    resources/memory-schema.md
  • Config:
    config/cli-config.yaml
  • Scripts:
    scripts/spawn-agent.sh
    ,
    scripts/parallel-run.sh
  • Task templates:
    templates/
  • Skill routing:
    ../_shared/skill-routing.md
  • Verification:
    ../_shared/verify.sh
  • API contracts:
    ../_shared/api-contracts/
  • Context loading:
    ../_shared/context-loading.md
  • Difficulty guide:
    ../_shared/difficulty-guide.md
  • Reasoning templates:
    ../_shared/reasoning-templates.md
  • Clarification protocol:
    ../_shared/clarification-protocol.md
  • Context budget:
    ../_shared/context-budget.md
  • Lessons learned:
    ../_shared/lessons-learned.md
  • 提示词模板:
    resources/subagent-prompt-template.md
  • 内存 schema:
    resources/memory-schema.md
  • 配置文件:
    config/cli-config.yaml
  • 脚本文件:
    scripts/spawn-agent.sh
    scripts/parallel-run.sh
  • 任务模板:
    templates/
  • 技能路由:
    ../_shared/skill-routing.md
  • 验证脚本:
    ../_shared/verify.sh
  • API 契约:
    ../_shared/api-contracts/
  • 上下文加载:
    ../_shared/context-loading.md
  • 难度指南:
    ../_shared/difficulty-guide.md
  • 推理模板:
    ../_shared/reasoning-templates.md
  • 澄清协议:
    ../_shared/clarification-protocol.md
  • 上下文预算:
    ../_shared/context-budget.md
  • 经验总结:
    ../_shared/lessons-learned.md