AgentSkillsCN

orchestrator

战略性分解任务,并实现并行智能体编排。当请求复杂、多面,或提及多项交付成果时,主动调用此技能。 触发词:“编排一下”、“并行化一下”、“多智能体”或自动识别复杂请求。 自动检测模式:- “调研并实施”、“分析并修复”、“全面审视”- “全面覆盖”、“全盘审计”、“多文件”、“贯穿整个代码库”- 重构、迁移、多步骤调查- 多个 AND 连接的任务(“添加 X 和 Y 和 Z”) 命令:- /orchestrate - 全流程:分解 -> 路由 -> 执行 -> 综合- /parallel [任务] - 快速并行启动,无需分解- /plan-only - 获取执行计划,但不实际运行 输出:英语。采用 Task() 为子智能体分配任务。

SKILL.md
--- frontmatter
name: orchestrator
description: >-
  Strategic task decomposition and parallel agent orchestration.
  INVOKE PROACTIVELY when request is complex, multi-faceted, or mentions multiple deliverables.

  Triggers: "orchestrate", "parallelize", "multi-agent", or auto-detect complex requests.

  Auto-detection patterns:
  - "research and implement", "analyze and fix", "review everything"
  - "comprehensive", "full audit", "multiple files", "across the codebase"
  - Refactoring, migrations, multi-step investigations
  - Multiple AND-connected tasks ("add X and Y and Z")

  Commands:
  - /orchestrate - Full workflow: decompose -> route -> execute -> synthesize
  - /parallel [tasks] - Quick parallel launch without decomposition
  - /plan-only - Get execution plan without running it

  Output: English. Uses Task() for subagent dispatch.

Orchestrator Protocol

Multi-agent task orchestration with intelligent decomposition and parallel execution.

Activation Banner (MANDATORY)

When skill activates, display:

code
(ORCHESTRATOR) ════════════════════════════════════════
  Mode: [/orchestrate | /parallel | /plan-only | auto]
  Complexity: [SIMPLE | MODERATE | COMPLEX | EPIC]
  Workstreams detected: [N]
════════════════════════════════════════════════════════

Phase 0: Complexity Assessment

Before anything, assess task complexity:

IndicatorPoints
Multiple distinct deliverables+1
Cross-cutting concerns+1
>500 lines affected estimate+1
Multiple file types/domains+1
Integration requirements+1

Complexity levels:

  • 0-1: SIMPLE - No orchestration needed
  • 2-3: MODERATE - Light orchestration, 2-3 workstreams
  • 4-5: COMPLEX - Full orchestration, 3-5 workstreams
  • 6+: EPIC - Multi-phase orchestration, 5+ workstreams

Decision:

  • SIMPLE: Respond normally, no orchestration
  • MODERATE+: Activate orchestration protocol

Phase 1: Task Decomposition

Break the task into atomic workstreams using the AND/OR model:

AND Tasks (must all complete)

Tasks connected by "and", "also", "plus":

  • "Add auth AND logging AND tests" -> 3 workstreams

Sequential Dependencies

Tasks where one depends on another:

  • "Create schema THEN implement API THEN add tests"

Parallel Opportunities

Independent tasks that can run simultaneously:

  • Architecture exploration (Explore agent)
  • Pattern research (Explore agent)
  • Dependency check (Explore agent)

Decomposition Output Format

code
WORKSTREAM MAP
══════════════════════════════════════

Phase 1 (Parallel):
  [1] Research: Explore existing patterns
      Agent: Explore | Est: 2min
  [2] Research: Check dependencies
      Agent: Explore | Est: 1min

Phase 2 (Sequential):
  [3] Implement: Core feature
      Agent: general-purpose | Est: 10min
      Depends: [1], [2]

Phase 3 (Parallel):
  [4] Test: Write unit tests
      Agent: general-purpose | Est: 5min
      Depends: [3]
  [5] Document: Update README
      Agent: general-purpose | Est: 3min
      Depends: [3]

══════════════════════════════════════

Phase 2: Agent Routing

Select agent type based on task characteristics:

Task TypeAgentRationale
Code explorationExploreRead-only, fast, cheap
Pattern findingExploreNo modifications needed
Dependency mappingExploreJust reading
Architecture researchPlanNeeds deep thinking
Design decisionsPlanTrade-off analysis
Implementationgeneral-purposeFull tool access
Refactoringgeneral-purposeNeeds edit capabilities
Testinggeneral-purposeNeeds to run tests
Documentationgeneral-purposeNeeds to write files

Routing Decision Tree

code
IS READ-ONLY?
  YES → IS COMPLEX RESEARCH?
    YES → Plan agent
    NO → Explore agent (fastest)
  NO → general-purpose (full capabilities)

Agent Dispatch Format

python
# Explore agent - read-only codebase scanning
Task(subagent_type="Explore", prompt="...")

# Plan agent - research/planning mode
Task(subagent_type="Plan", prompt="...")

# general-purpose - full tool access
Task(subagent_type="general-purpose", prompt="...")

Phase 3: Execution Strategy

Parallel Execution

Launch independent workstreams simultaneously:

code
EXECUTING PHASE 1 (PARALLEL)
────────────────────────────
[1] Launching Explore: Pattern research...
[2] Launching Explore: Dependency check...

Waiting for completion...

[1] ✓ Complete (45s)
[2] ✓ Complete (32s)
────────────────────────────

Sequential Execution

Wait for dependencies before proceeding:

code
EXECUTING PHASE 2 (SEQUENTIAL)
────────────────────────────
[3] Launching general-purpose: Core implementation
    Inputs from [1], [2]: [summarized context]

[3] ✓ Complete (8m 23s)
────────────────────────────

Context Passing

Each subsequent phase receives synthesized context from prior phases:

code
## Context from Phase 1

### Pattern Research [1]
- Found similar feature in src/existing/
- Uses factory pattern
- Tests in tests/existing.test.ts

### Dependency Check [2]
- No breaking changes needed
- Compatible with current API version

Phase 4: Result Synthesis

Aggregate all workstream outputs into coherent result:

code
ORCHESTRATION COMPLETE
══════════════════════════════════════════════
Workstreams: 5/5 complete
Total time: 15m 42s
Phases: 3

DELIVERABLES:
1. [Feature] User authentication - src/auth/
2. [Tests] Unit tests added - tests/auth.test.ts
3. [Docs] README updated - README.md

NOTES:
- Pattern from existing auth used
- All tests passing
- No breaking changes introduced
══════════════════════════════════════════════

Commands

/orchestrate [task description]

Full orchestration workflow:

  1. Assess complexity
  2. Decompose into workstreams
  3. Route to agents
  4. Execute phases
  5. Synthesize results

/parallel [task1] [task2] [task3]

Quick parallel launch without full decomposition:

  • Launches all tasks simultaneously
  • All use default agent type unless prefixed:
    • explore:task -> Explore agent
    • plan:task -> Plan agent
    • task -> general-purpose

Example:

code
/parallel "explore:find all API routes" "explore:check test coverage" "review authentication flow"

/plan-only [task description]

Returns execution plan without running:

  • Shows decomposition
  • Shows agent routing
  • Shows phase ordering
  • Does NOT execute

Useful for:

  • Reviewing before committing
  • Adjusting workstreams manually
  • Learning what orchestrator would do

Integration with Existing Plugins

auto-ralph Integration

If orchestrator detects a workstream suitable for Ralph Loop:

  • Flag with [RALPH-CANDIDATE]
  • Suggest: "Consider delegating workstream [N] to auto-ralph"

Handoff pattern:

code
Workstream [3] detected as iterative task:
- Clear success criteria (tests pass)
- Benefits from iteration

Options:
1. Run as standard workstream
2. Delegate to auto-ralph for iteration

ultrathink Integration

For Plan agent workstreams requiring deep analysis:

  • Auto-apply ULTRATHINK protocol
  • Ensure multi-perspective analysis
  • No shallow answers in planning phases

Error Handling

Workstream Failure

code
WORKSTREAM [3] FAILED
─────────────────────
Error: Tests failing after implementation
Status: Blocked

Options:
1. Retry workstream [3]
2. Retry with more context
3. Delegate to auto-ralph for iteration
4. Cancel remaining workstreams
5. Continue with partial results

Dependency Failure

If a phase fails, dependent phases cannot proceed:

code
DEPENDENCY BLOCKED
─────────────────────
Workstream [3] cannot start:
- Depends on [2] (FAILED)

Options:
1. Fix [2] and retry
2. Skip [2], provide manual context
3. Cancel [3] and dependents

Anti-Patterns

  • DO NOT orchestrate single-task requests
  • DO NOT create >7 workstreams (cognitive overload)
  • DO NOT use Plan agent for implementation
  • DO NOT use Explore agent when writes needed
  • DO NOT skip complexity assessment
  • DO NOT ignore dependencies between workstreams

Settings Persistence

Configuration in ~/.claude/orchestrator.local.md:

yaml
---
max_parallel_agents: 3
default_timeout_minutes: 30
auto_ralph_handoff: true
ultrathink_for_plan: true
verbose_progress: true
confirm_before_execute: true
---
ParameterDefaultDescription
max_parallel_agents3Max simultaneous agents
default_timeout_minutes30Per-workstream timeout
auto_ralph_handofftrueOffer Ralph for iterative tasks
ultrathink_for_plantrueApply ULTRATHINK to Plan agents
verbose_progresstrueShow detailed progress
confirm_before_executetrueConfirm plan before running

Resources

  • references/agent-routing.md - Agent selection decision tree
  • references/decomposition-rules.md - Task breakdown patterns
  • references/phase-patterns.md - Execution phase patterns
  • references/synthesis-rules.md - Result aggregation rules
  • examples/ - Real orchestration examples