orchestrator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrchestrator - 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 . 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作为独立进程运行。
gemini -p "..." --approval-mode=yoloConfiguration
配置
| Setting | Default | Description |
|---|---|---|
| MAX_PARALLEL | 3 | Max concurrent subagents |
| MAX_RETRIES | 2 | Retry attempts per failed task |
| POLL_INTERVAL | 30s | Status check interval |
| MAX_TURNS (impl) | 20 | Turn limit for backend/frontend/mobile |
| MAX_TURNS (review) | 15 | Turn limit for qa/debug |
| MAX_TURNS (plan) | 10 | Turn limit for pm |
| 设置项 | 默认值 | 描述 |
|---|---|---|
| MAX_PARALLEL | 3 | 最大并发子Agent数量 |
| MAX_RETRIES | 2 | 每个失败任务的重试次数 |
| POLL_INTERVAL | 30s | 状态检查间隔 |
| MAX_TURNS (impl) | 20 | 后端/前端/移动端的交互轮次上限 |
| MAX_TURNS (review) | 15 | QA/调试的交互轮次上限 |
| MAX_TURNS (plan) | 10 | 产品经理(pm)的交互轮次上限 |
Memory Configuration
内存配置
Memory provider and tool names are configurable via :
mcp.jsonjson
{
"memoryConfig": {
"provider": "serena",
"basePath": ".serena/memories",
"tools": {
"read": "read_memory",
"write": "write_memory",
"edit": "edit_memory"
}
}
}内存提供商和工具名称可通过配置:
mcp.jsonjson
{
"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 +
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 per completed agent
PHASE 5 - Collect: Read all , compile summary, cleanup progress files
orchestrator-session.mdtask-board.md../_shared/verify.sh {agent-type} {workspace}result-{agent}.mdSee for prompt construction.
See for memory file formats.
resources/subagent-prompt-template.mdresources/memory-schema.md阶段1 - 规划:分析请求→分解任务→生成会话ID
阶段2 - 准备:使用内存写入工具创建和
阶段3 - 执行:按优先级层级启动Agent(绝不超过MAX_PARALLEL上限)
阶段4 - 监控:每隔POLL_INTERVAL轮询一次;处理已完成/失败/崩溃的Agent
阶段4.5 - 验证:针对每个已完成的Agent运行
阶段5 - 汇总:读取所有文件,编译汇总报告,清理进度文件
orchestrator-session.mdtask-board.md../_shared/verify.sh {agent-type} {workspace}result-{agent}.md提示词构建可参考。
内存文件格式可参考。
resources/subagent-prompt-template.mdresources/memory-schema.mdMemory File Ownership
内存文件归属
| File | Owner | Others |
|---|---|---|
| orchestrator | read-only |
| orchestrator | read-only |
| that agent | orchestrator reads |
| that agent | orchestrator reads |
| 文件 | 归属方 | 其他角色权限 |
|---|---|---|
| 编排器 | 只读 |
| 编排器 | 只读 |
| 对应Agent | 编排器可读取 |
| 对应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.mdReferences
参考资料
- Prompt template:
resources/subagent-prompt-template.md - Memory schema:
resources/memory-schema.md - Config:
config/cli-config.yaml - Scripts: ,
scripts/spawn-agent.shscripts/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.shscripts/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