delegate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/delegate
/delegate
You orchestrate. Specialists do the work.
Reference pattern for invoking multiple AI tools and synthesizing their outputs.
你负责编排,专家负责执行任务。
这是调用多个AI工具并合成其输出的参考模式。
Your Role
你的角色
You don't analyze/review/audit yourself. You:
- Route — Send work to appropriate specialists
- Collect — Gather their outputs
- Curate — Validate, filter, resolve conflicts
- Synthesize — Produce unified output
你无需亲自进行分析/审查/审计工作,你需要:
- 路由 — 将任务分配给合适的专家
- 收集 — 收集他们的输出结果
- 整理 — 验证、过滤、解决冲突
- 合成 — 生成统一的输出结果
Your Team
你的团队
Moonbridge MCP — Unified Agent Interface
Moonbridge MCP — 统一Agent接口
One interface, multiple backends. Moonbridge wraps both Codex and Kimi:
| Adapter | Strengths | When to Use |
|---|---|---|
| Long-context, tool calling, security | Refactors, migrations, debugging, backend |
| Native vision, extended thinking | UI from designs, visual debugging, frontend |
Single agent:
mcp__moonbridge__spawn_agent({
"prompt": "...",
"adapter": "codex", // or "kimi"
"reasoning_effort": "high" // codex: low/medium/high/xhigh
// OR
"thinking": true // kimi: extended reasoning
})Timeout: Moonbridge defaults: Codex=30min, Kimi=10min. Override for edge cases:
| Task | Timeout |
|---|---|
| Quick check | |
| Large refactor | |
mcp__moonbridge__spawn_agent({ ..., "timeout_seconds": 3600 })Parallel agents (same or mixed adapters):
mcp__moonbridge__spawn_agents_parallel({
"agents": [
{"prompt": "Backend API", "adapter": "codex", "reasoning_effort": "high"},
{"prompt": "Frontend UI", "adapter": "kimi", "thinking": true},
{"prompt": "Tests", "adapter": "codex", "reasoning_effort": "medium"}
]
})一个接口,多个后端。Moonbridge同时封装了Codex和Kimi:
| 适配器 | 优势 | 使用场景 |
|---|---|---|
| 长上下文、工具调用、安全性 | 重构、迁移、调试、后端开发 |
| 原生视觉能力、深度思考 | 根据设计稿生成UI、视觉调试、前端开发 |
单个Agent调用:
mcp__moonbridge__spawn_agent({
"prompt": "...",
"adapter": "codex", // 或 "kimi"
"reasoning_effort": "high" // codex可选:low/medium/high/xhigh
// 或者
"thinking": true // kimi启用深度思考
})超时设置: Moonbridge默认超时:Codex=30分钟,Kimi=10分钟。可针对特殊情况覆盖默认值:
| 任务类型 | 超时时间 |
|---|---|
| 快速检查 | |
| 大型重构 | |
mcp__moonbridge__spawn_agent({ ..., "timeout_seconds": 3600 })并行调用多个Agent(相同或混合适配器):
mcp__moonbridge__spawn_agents_parallel({
"agents": [
{"prompt": "Backend API", "adapter": "codex", "reasoning_effort": "high"},
{"prompt": "Frontend UI", "adapter": "kimi", "thinking": true},
{"prompt": "Tests", "adapter": "codex", "reasoning_effort": "medium"}
]
})Gemini CLI — Researcher, deep reasoner
Gemini CLI — 研究员、深度推理工具
- Web grounding, thinking_level control, agentic vision
- Best at: current best practices, pattern validation, design research
- Invocation: (bash)
gemini "..."
- 网络 grounding、思考级别控制、Agent视觉能力
- 最适合:当前最佳实践、模式验证、设计研究
- 调用方式:(bash命令)
gemini "..."
Non-Agentic (Opinions Only)
非Agent类工具(仅提供观点)
Thinktank CLI — Expert council
- Multiple models respond in parallel, synthesis mode
- Best at: consensus, architecture validation, second opinions
- Invocation: (bash)
thinktank instructions.md ./files --synthesis - Note: Cannot take action. Use for validation, not investigation.
Thinktank CLI — 专家委员会
- 多模型并行响应,支持合成模式
- 最适合:达成共识、架构验证、二次意见
- 调用方式:(bash命令)
thinktank instructions.md ./files --synthesis - 注意:无法执行操作。仅用于验证,不用于调查。
Agent Teams — Full Claude Code Teammates
Agent团队 — 完整的Claude Code协作团队
When workers need to communicate, challenge each other, or coordinate across layers.
Start a team: Describe the task and team structure in natural language. Claude handles spawning.
Lead in delegate mode: Shift+Tab after team creation. Lead coordinates only.
Plan approval: For risky work, require teammates to plan before implementing.
Lead reviews and approves/rejects plans.
When to use over Moonbridge:
| Signal | Teams | Moonbridge |
|---|---|---|
| Workers must discuss findings | YES | no |
| Competing hypotheses / debate | YES | no |
| Cross-layer (FE+BE+tests) | YES | no |
| "Implement this spec" | no | YES |
| Result-only, no coordination | no | YES |
当协作成员需要沟通、相互质疑或跨层协调时使用。
创建团队: 用自然语言描述任务和团队结构,Claude会负责创建Agent。
以委托模式担任负责人: 创建团队后按Shift+Tab切换。负责人仅负责协调工作。
计划审批: 对于高风险任务,要求团队成员在执行前提交计划。负责人负责审核并批准/拒绝计划。
何时选择团队而非Moonbridge:
| 信号 | 团队模式 | Moonbridge |
|---|---|---|
| 协作成员需要讨论发现结果 | 是 | 否 |
| 需要提出竞争假设/进行辩论 | 是 | 否 |
| 跨层协作(前端+后端+测试) | 是 | 否 |
| "实现这个规格" | 否 | 是 |
| 仅需结果,无需协调 | 否 | 是 |
Internal Agents (Task tool)
内部Agent(任务工具)
Domain specialists for focused review:
- ,
go-concurrency-reviewer,react-pitfallssecurity-sentinel - ,
data-integrity-guardian,architecture-guardianconfig-auditor
专注于特定领域审查的专家:
- ,
go-concurrency-reviewer,react-pitfallssecurity-sentinel - ,
data-integrity-guardian,architecture-guardianconfig-auditor
How to Delegate
如何委托任务
Apply principles — state goals, not steps:
/llm-communication遵循原则 — 明确目标,而非步骤:
/llm-communicationTo Moonbridge Agents (Codex, Kimi)
给Moonbridge Agent(Codex、Kimi)
Give them latitude to investigate:
"Investigate this stack trace. Find root cause. Propose fix with file:line."NOT:
"Step 1: Read file X. Step 2: Check line Y. Step 3: ..."给予他们自主调查的权限:
"Investigate this stack trace. Find root cause. Propose fix with file:line."而非:
"Step 1: Read file X. Step 2: Check line Y. Step 3: ..."To Thinktank (Non-Agentic)
给Thinktank(非Agent类)
Provide context, ask for judgment:
"Here's the code and proposed fix. Is this approach sound?
What are we missing? Consensus and dissent."提供上下文,请求判断:
"Here's the code and proposed fix. Is this approach sound?
What are we missing? Consensus and dissent."Parallel Execution
并行执行
Run independent reviews in parallel:
- Multiple moonbridge agents in same call ()
spawn_agents_parallel - Multiple Task tool calls in same message
- Gemini + Thinktank can run concurrently (both bash)
并行运行独立的审查任务:
- 单次调用中启动多个Moonbridge Agent()
spawn_agents_parallel - 单次消息中调用多个任务工具
- Gemini和Thinktank可同时运行(均为bash命令)
Dependency-Aware Orchestration
依赖感知型编排
For large work (10+ subtasks, multiple phases), use DAG-based scheduling:
对于大型任务(10+子任务、多阶段),使用基于DAG的调度:
The Pattern
模式
Phase 1 (no deps): Task 01, 02, 03 → run in parallel
Phase 2 (deps on P1): Task 04, 05 → blocked until P1 complete
Phase 3 (deps on P2): Task 06, 07, 08 → blocked until P2 completeKey principles:
- Task decomposition — Break feature into atomic subtasks
- Dependency graph — DAG defines execution order
- Parallel execution — Independent tasks run simultaneously
- Fresh context — Each subagent starts clean (~40-75k tokens)
Phase 1 (无依赖): 任务01、02、03 → 并行运行
Phase 2 (依赖Phase1): 任务04、05 → 需等待Phase1完成后执行
Phase 3 (依赖Phase2): 任务06、07、08 → 需等待Phase2完成后执行核心原则:
- 任务分解 — 将功能拆分为原子子任务
- 依赖图 — DAG定义执行顺序
- 并行执行 — 独立任务同时运行
- 全新上下文 — 每个子Agent启动时使用全新上下文(约40-75k tokens)
Step 1: Decompose
步骤1:分解任务
Split feature into atomic tasks. Ask:
- What can run independently? → Same phase
- What requires prior output? → Blocked
将功能拆分为原子任务,思考:
- 哪些任务可以独立运行?→ 同一阶段
- 哪些任务需要依赖前置输出?→ 阻塞状态
Step 2: Declare Dependencies
步骤2:声明依赖关系
Use TaskCreate/TaskUpdate primitives:
TaskCreate({subject: "Install packages", activeForm: "Installing packages"})
TaskCreate({subject: "cRPC builder", activeForm: "Building cRPC"})
TaskUpdate({taskId: "2", addBlockedBy: ["1"]}) # Task 2 waits for Task 1使用TaskCreate/TaskUpdate原语:
TaskCreate({subject: "Install packages", activeForm: "Installing packages"})
TaskCreate({subject: "cRPC builder", activeForm: "Building cRPC"})
TaskUpdate({taskId: "2", addBlockedBy: ["1"]}) # 任务2需等待任务1完成Step 3: Execute Phases
步骤3:执行阶段
Spawn all unblocked tasks in single message:
undefined在单条消息中启动所有未阻塞的任务:
undefinedPhase 1 - all parallel via moonbridge
Phase 1 - 通过moonbridge并行启动所有任务
mcp__moonbridge__spawn_agents_parallel({
agents: [
{prompt: "Task 1: ...", adapter: "codex"},
{prompt: "Task 2: ...", adapter: "codex"},
{prompt: "Task 3: ...", adapter: "kimi", thinking: true}
]
})
undefinedmcp__moonbridge__spawn_agents_parallel({
agents: [
{prompt: "Task 1: ...", adapter: "codex"},
{prompt: "Task 2: ...", adapter: "codex"},
{prompt: "Task 3: ...", adapter: "kimi", thinking: true}
]
})
undefinedStep 4: Progress
步骤4:进度跟踪
After each phase:
- Mark completed tasks:
TaskUpdate({taskId: "1", status: "completed"}) - Check newly-unblocked:
TaskList() - Spawn next phase
每个阶段完成后:
- 标记已完成任务:
TaskUpdate({taskId: "1", status: "completed"}) - 检查新解锁的任务:
TaskList() - 启动下一阶段
When to Use DAG Orchestration
何时使用DAG编排
| Scenario | Use DAG? |
|---|---|
| Large migration (10+ files, phases) | ✅ Yes |
| Multi-feature release | ✅ Yes |
| Single feature (1-5 files) | ❌ Overkill |
| Quick fix | ❌ Overkill |
For typical feature work, simple parallel spawning is sufficient.
| 场景 | 是否使用DAG? |
|---|---|
| 大型迁移(10+文件、多阶段) | ✅ 是 |
| 多功能版本发布 | ✅ 是 |
| 单个功能(1-5个文件) | ❌ 过于复杂 |
| 快速修复 | ❌ 过于复杂 |
对于典型的功能开发任务,简单的并行启动已足够。
Curation (Your Core Job)
整理(你的核心工作)
For each finding:
Validate: Real issue or false positive? Applies to our context?
Filter: Generic advice, style preferences contradicting conventions
Resolve Conflicts: When tools disagree, explain tradeoff, make recommendation
对于每个发现结果:
验证:是真实问题还是误报?是否适用于我们的场景?
过滤:通用建议、与规范冲突的风格偏好
解决冲突:当工具意见不一致时,解释权衡方案并给出建议
Output Template
输出模板
markdown
undefinedmarkdown
undefined[Task]: [subject]
[任务]: [主题]
Action Plan
行动计划
Critical
关键优先级
- — Issue — Fix: [action] (Source: [tool])
file:line
- — 问题 — 修复方案:[操作](来源:[工具])
file:line
Important
重要优先级
- — Issue — Fix: [action] (Source: [tool])
file:line
- — 问题 — 修复方案:[操作](来源:[工具])
file:line
Suggestions
建议项
- [improvement] (Source: [tool])
- [改进建议](来源:[工具])
Synthesis
合成结果
Agreements — Multiple tools flagged:
- [issue]
Conflicts — Differing opinions:
- [Tool A] vs [Tool B]: [your recommendation]
Research — From Gemini:
- [finding with citation]
undefined共识内容 — 多个工具共同标记的问题:
- [问题]
冲突内容 — 不同工具的意见分歧:
- [工具A] vs [工具B]:[你的建议]
研究结果 — 来自Gemini:
- [带引用的发现结果]
undefinedWhen to Use
适用场景
- Code review — Multiple perspectives on changes
- Incident investigation — Agentic tools investigate, Thinktank validates fix
- Architecture decisions — Thinktank for consensus
- Audit/check tasks — Parallel investigation across domains
- 代码审查 — 从多个视角审视代码变更
- 事件调查 — Agent工具负责调查,Thinktank验证修复方案
- 架构决策 — 使用Thinktank达成共识
- 审计/检查任务 — 跨领域并行调查
Note
注意事项
All Codex delegation goes through Moonbridge MCP. Use with . This gives you:
mcp__moonbridge__spawn_agentadapter: "codex"- Single interface for both Kimi and Codex
- Mixed-adapter parallel spawning
- Consistent parameter naming
所有Codex委托任务必须通过Moonbridge MCP进行。使用并设置。这样做的优势:
mcp__moonbridge__spawn_agentadapter: "codex"- 统一的Kimi和Codex调用接口
- 支持混合适配器的并行启动
- 一致的参数命名规则
Related
相关链接
- — Prompt writing principles
/llm-communication - — Example implementation
/review-branch - — Multi-model synthesis
/thinktank - — Codex delegation patterns
/codex-coworker
- — 提示词编写原则
/llm-communication - — 示例实现
/review-branch - — 多模型合成
/thinktank - — Codex委托模式
/codex-coworker