orchestration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Orchestration

编排

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
agent-patterns
skill instead.
This 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

快速参考

NeedAction
Identify project typeClassify as Pattern A / B / C
Sequence frameworksFollow pattern-specific phase order
Decompose a goalExtract required effects, match capabilities
Validate readinessCheck phase-gate criteria before advancing
Find alternativesGenerate fallback capabilities per step
Score a planEvaluate cost, latency, risk, diversity
Coordinate agentsSelect orchestration pattern for task type
Pass contextUse context distillation for subagents
需求操作
识别项目类型分类为Pattern A / B / C
排序框架遵循特定模式的阶段顺序
分解目标提取所需效果,匹配对应能力
验证就绪状态进入下一阶段前检查阶段门标准
寻找替代方案为每个步骤生成备选能力
评估计划评估成本、延迟、风险、多样性
协调Agent根据任务类型选择编排模式
传递上下文为子Agent使用上下文提炼法

Pattern Identification

模式识别

Classify every project before selecting frameworks or skills.
PatternCharacteristicsTimeline
A: Simple FeatureExisting system, well-understood, single-team1-5 days
B: New Product/SystemFrom scratch, security/compliance matters4-12 weeks
C: AI-Native/ComplexAI agents, RAG, knowledge graphs, orchestration8-20 weeks
在选择框架或技能之前,先对每个项目进行分类。
模式特征时间线
A: 简单功能基于现有系统、需求明确、单团队负责1-5天
B: 新产品/系统从零开始开发、需考虑安全/合规要求4-12周
C: AI原生/复杂项目涉及AI Agent、RAG、知识图谱、编排8-20周

Phase Gates

阶段门

Do not advance without meeting gate criteria.
GateEntry 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:
FactorWeightScores
Cost0.3free=1.0, low=0.8, medium=0.5, high=0.2
Risk0.3safe=1.0, low=0.8, medium=0.5, high=0.2
Latency0.2instant=1.0, fast=0.7, slow=0.3
Diversity0.2min(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.2min(独特领域数 / 5, 1.0)
调整规则:最近3步内使用过的能力扣减30%;新能力加20%奖励。

Multi-Agent Orchestration Patterns

多Agent编排模式

PatternUse Case
HierarchicalParent delegates to specialized subagents
SequentialChain of experts (architect -> dev -> review)
ParallelIndependent tasks running simultaneously
HandoffOne 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 PrimitiveRole in Orchestration
ResourcesDiscover available data (schemas, configs, docs) before work
ToolsExecute validated actions with typed arguments
PromptsReuse domain-specific instruction templates across agents
SamplingAllow servers to request AI reasoning mid-execution
MCP(Model Context Protocol,模型上下文协议)标准化了Agent与外部工具、数据源和提示模板的连接方式。编排器在启动时发现可用的MCP服务器,并将子Agent的工具调用路由到正确的服务器。
MCP原语在编排中的角色
资源开始工作前发现可用数据(模式、配置、文档)
工具使用类型化参数执行已验证的操作
提示在各Agent间复用领域特定的指令模板
采样允许服务器在执行过程中请求AI推理

Common Mistakes

常见错误

MistakeCorrect 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 fasterEnforce gate criteria before advancing; skipping causes compounding rework
Activating all available skills simultaneouslyLimit to 1-3 skills per phase with clear deliverables and handoffs
No decision logging for capability choicesLog rationale, alternatives considered, scores, and rejection reasons at each step
Building HTN plans without validating preconditionsCheck project state (files, dependencies, env vars) against each capability's requirements first
Delegating without a clear objective manifestEvery subagent needs an objective, constraints, max tokens, and available tools
Passing entire codebase to subagentsUse 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
    Explore
    agent to survey the codebase, dependencies, and requirements
  • Execute multi-phase orchestration plan: Use
    Task
    agent to implement phase-specific deliverables with gate validation
  • Design architecture and capability sequences: Use
    Plan
    agent to decompose goals and build scored HTN plans
  • 发现项目模式并分类范围:使用
    Explore
    Agent调查代码库、依赖项和需求
  • 执行多阶段编排计划:使用
    Task
    Agent实现特定阶段的交付成果并进行门控验证
  • 设计架构和能力序列:使用
    Plan
    Agent分解目标并构建已评分的HTN计划

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 -- 目标偏移、工具故障、上下文溢出、断路器、恢复策略、日志记录