orchestration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOrchestration
编排
Overview
概述
Coordinates skills, frameworks, and workflows across the project lifecycle. Combines pattern-based project classification with goal decomposition, hierarchical task planning, and multi-agent coordination.
Use this skill for project-level workflow decisions: which frameworks to activate, in what order, and how to validate progress between phases. For Claude Code-specific agent implementation details (agent configuration, batch sizing, prompt engineering), use the skill instead.
agent-patternsThis skill does NOT replace project management tools. It provides the decision framework for sequencing capabilities and validating readiness at each transition point.
在整个项目生命周期中协调技能、框架和工作流。结合基于模式的项目分类、目标分解、分层任务规划(HTN)和多Agent协调。
当需要做项目级工作流决策时使用此技能:激活哪些框架、以什么顺序激活,以及如何验证各阶段之间的进展。若需了解Claude Code特定的Agent实现细节(Agent配置、批量大小、提示工程),请使用技能。
agent-patterns此技能不会替代项目管理工具。它为能力排序和每个过渡点的就绪状态验证提供决策框架。
Quick Reference
快速参考
| Need | Action |
|---|---|
| Identify project type | Classify as Pattern A / B / C |
| Sequence frameworks | Follow pattern-specific phase order |
| Decompose a goal | Extract required effects, match capabilities |
| Validate readiness | Check phase-gate criteria before advancing |
| Find alternatives | Generate fallback capabilities per step |
| Score a plan | Evaluate cost, latency, risk, diversity |
| Coordinate agents | Select orchestration pattern for task type |
| Pass context | Use context distillation for subagents |
| 需求 | 操作 |
|---|---|
| 识别项目类型 | 分类为Pattern A / B / C |
| 排序框架 | 遵循特定模式的阶段顺序 |
| 分解目标 | 提取所需效果,匹配对应能力 |
| 验证就绪状态 | 进入下一阶段前检查阶段门标准 |
| 寻找替代方案 | 为每个步骤生成备选能力 |
| 评估计划 | 评估成本、延迟、风险、多样性 |
| 协调Agent | 根据任务类型选择编排模式 |
| 传递上下文 | 为子Agent使用上下文提炼法 |
Pattern Identification
模式识别
Classify every project before selecting frameworks or skills.
| Pattern | Characteristics | Timeline |
|---|---|---|
| A: Simple Feature | Existing system, well-understood, single-team | 1-5 days |
| B: New Product/System | From scratch, security/compliance matters | 4-12 weeks |
| C: AI-Native/Complex | AI agents, RAG, knowledge graphs, orchestration | 8-20 weeks |
在选择框架或技能之前,先对每个项目进行分类。
| 模式 | 特征 | 时间线 |
|---|---|---|
| A: 简单功能 | 基于现有系统、需求明确、单团队负责 | 1-5天 |
| B: 新产品/系统 | 从零开始开发、需考虑安全/合规要求 | 4-12周 |
| C: AI原生/复杂项目 | 涉及AI Agent、RAG、知识图谱、编排 | 8-20周 |
Phase Gates
阶段门
Do not advance without meeting gate criteria.
| Gate | Entry Criteria |
|---|---|
| Design (Phase 2) | PRP complete, problem validated, success metrics, user stories |
| Development (3) | Architecture documented, data model designed, security threats mapped |
| Testing (Phase 4) | Features complete, unit tests over 80%, code review, SAST clean |
| Deployment (5) | All tests passing, UAT completed, security tested, coverage over 90% |
未满足门控标准不得进入下一阶段。
| 阶段门 | 进入标准 |
|---|---|
| 设计阶段(Phase 2) | PRP完成、问题已验证、成功指标确定、用户故事就绪 |
| 开发阶段(Phase3) | 架构已文档化、数据模型已设计、安全威胁已映射 |
| 测试阶段(Phase4) | 功能开发完成、单元测试覆盖率超80%、代码评审完成、SAST检测无问题 |
| 部署阶段(Phase5) | 所有测试通过、UAT完成、安全测试通过、覆盖率超90% |
Scoring Function
评分函数
Plans are evaluated using weighted utility:
| Factor | Weight | Scores |
|---|---|---|
| Cost | 0.3 | free=1.0, low=0.8, medium=0.5, high=0.2 |
| Risk | 0.3 | safe=1.0, low=0.8, medium=0.5, high=0.2 |
| Latency | 0.2 | instant=1.0, fast=0.7, slow=0.3 |
| Diversity | 0.2 | min(unique_domains / 5, 1.0) |
Modifiers: recently used (within 3 steps) gets -30% penalty; novel capability gets +20% bonus.
计划通过加权效用进行评估:
| 因素 | 权重 | 评分标准 |
|---|---|---|
| 成本 | 0.3 | 免费=1.0,低成本=0.8,中等成本=0.5,高成本=0.2 |
| 风险 | 0.3 | 安全=1.0,低风险=0.8,中等风险=0.5,高风险=0.2 |
| 延迟 | 0.2 | 即时=1.0,快速=0.7,缓慢=0.3 |
| 多样性 | 0.2 | min(独特领域数 / 5, 1.0) |
调整规则:最近3步内使用过的能力扣减30%;新能力加20%奖励。
Multi-Agent Orchestration Patterns
多Agent编排模式
| Pattern | Use Case |
|---|---|
| Hierarchical | Parent delegates to specialized subagents |
| Sequential | Chain of experts (architect -> dev -> review) |
| Parallel | Independent tasks running simultaneously |
| Handoff | One agent passes context to the next |
Key rules: max delegation depth of 3, use context distillation (not full codebase), log all agent interactions.
| 模式 | 适用场景 |
|---|---|
| 分层式 | 父Agent将任务委派给专业子Agent |
| 顺序式 | 专家链(架构师→开发→评审) |
| 并行式 | 独立任务同时运行 |
| 交接式 | 一个Agent将上下文传递给下一个Agent |
核心规则:最大委派深度为3,使用上下文提炼法(而非完整代码库),记录所有Agent交互。
MCP Integration
MCP集成
MCP (Model Context Protocol) standardizes how agents connect to external tools, data sources, and prompt templates. The orchestrator discovers available MCP servers at startup and routes tool calls from subagents to the correct server.
| MCP Primitive | Role in Orchestration |
|---|---|
| Resources | Discover available data (schemas, configs, docs) before work |
| Tools | Execute validated actions with typed arguments |
| Prompts | Reuse domain-specific instruction templates across agents |
| Sampling | Allow servers to request AI reasoning mid-execution |
MCP(Model Context Protocol,模型上下文协议)标准化了Agent与外部工具、数据源和提示模板的连接方式。编排器在启动时发现可用的MCP服务器,并将子Agent的工具调用路由到正确的服务器。
| MCP原语 | 在编排中的角色 |
|---|---|
| 资源 | 开始工作前发现可用数据(模式、配置、文档) |
| 工具 | 使用类型化参数执行已验证的操作 |
| 提示 | 在各Agent间复用领域特定的指令模板 |
| 采样 | 允许服务器在执行过程中请求AI推理 |
Common Mistakes
常见错误
| Mistake | Correct Pattern |
|---|---|
| Treating all projects as Pattern A (simple feature) | Classify first: Pattern A (simple), B (new product), C (AI-native) before selecting frameworks |
| Skipping phase gates to move faster | Enforce gate criteria before advancing; skipping causes compounding rework |
| Activating all available skills simultaneously | Limit to 1-3 skills per phase with clear deliverables and handoffs |
| No decision logging for capability choices | Log rationale, alternatives considered, scores, and rejection reasons at each step |
| Building HTN plans without validating preconditions | Check project state (files, dependencies, env vars) against each capability's requirements first |
| Delegating without a clear objective manifest | Every subagent needs an objective, constraints, max tokens, and available tools |
| Passing entire codebase to subagents | Use context distillation to pass only relevant symbols and facts |
| 错误 | 修正方案 |
|---|---|
| 将所有项目都视为Pattern A(简单功能) | 先分类:在选择框架前先确定是Pattern A(简单)、B(新产品)还是C(AI原生)项目 |
| 为了加快进度跳过阶段门 | 进入下一阶段前强制执行门控标准;跳过会导致返工量不断累积 |
| 同时激活所有可用技能 | 每个阶段限制使用1-3个技能,且每个技能需有明确的交付成果和交接流程 |
| 未记录能力选择的决策依据 | 在每个步骤记录决策理由、考虑过的替代方案、评分结果以及拒绝理由 |
| 未验证前置条件就构建HTN计划 | 先检查项目状态(文件、依赖项、环境变量)是否符合每个能力的要求 |
| 委派任务时没有明确的目标清单 | 每个子Agent都需要明确的目标、约束条件、最大令牌数和可用工具 |
| 向子Agent传递完整代码库 | 使用上下文提炼法仅传递相关符号和事实 |
Delegation
委派
- Discover project pattern and classify scope: Use agent to survey the codebase, dependencies, and requirements
Explore - Execute multi-phase orchestration plan: Use agent to implement phase-specific deliverables with gate validation
Task - Design architecture and capability sequences: Use agent to decompose goals and build scored HTN plans
Plan
- 发现项目模式并分类范围:使用Agent调查代码库、依赖项和需求
Explore - 执行多阶段编排计划:使用Agent实现特定阶段的交付成果并进行门控验证
Task - 设计架构和能力序列:使用Agent分解目标并构建已评分的HTN计划
Plan
References
参考资料
- goal-decomposition.md -- HTN planning, goal analysis, capability matching, precondition validation, scoring, decision logging
- project-patterns.md -- Pattern A/B/C classification, phase sequences, skill coordination by phase, parallelization
- multi-agent-coordination.md -- Hierarchical, sequential, parallel orchestration patterns, delegation manifests, recursion limits
- mcp-orchestration.md -- MCP architecture, resources, tools, prompts, multi-server orchestration, bidirectional sampling
- context-distillation.md -- Symbol indexing, fact extraction, recursive context reduction, token management
- error-handling.md -- Objective drift, tool failure, context overflow, circuit breakers, recovery strategies, logging
- goal-decomposition.md -- HTN规划、目标分析、能力匹配、前置条件验证、评分、决策记录
- project-patterns.md -- Pattern A/B/C分类、阶段序列、按阶段协调技能、并行化
- multi-agent-coordination.md -- 分层、顺序、并行编排模式、委派清单、递归限制
- mcp-orchestration.md -- MCP架构、资源、工具、提示、多服务器编排、双向采样
- context-distillation.md -- 符号索引、事实提取、递归上下文缩减、令牌管理
- error-handling.md -- 目标偏移、工具故障、上下文溢出、断路器、恢复策略、日志记录