orchestrator
npx skills add https://github.com/wyattowalsh/agents --skill orchestrator
Agent 安装分布
Skill 文档
Orchestration: Subagents, Agent Teams & Parallel Execution
These rules govern ALL parallelization decisions. Apply them on every task.
Not for single-action requests, simple file edits, or sequential-only workflows.
Dispatch
| $ARGUMENTS | Action |
|---|---|
| (empty) | Load full orchestration guide; apply Decomposition Gate to current request |
pattern <A-F> |
Show the named pattern from references/patterns.md |
tier |
Display Tier Selection table and model guidance |
recovery |
Show the Accounting Rule and Recovery Ladder |
Canonical Vocabulary
| Canonical Term | Meaning |
|---|---|
| subagent | A Task-tool-spawned agent running in parallel within a session |
| wave | A batch of parallel subagents dispatched in a single message |
| team | A TeamCreate-spawned group of teammates coordinated by a lead |
| teammate | A member of an agent team with assigned file ownership |
| lead | The orchestrating agent in a team; never implements directly |
| dispatch | Send one or more subagents/teammates to execute in parallel |
| gate | A mandatory checkpoint that must pass before proceeding |
| accounting rule | N dispatched = N resolved; no agent silently dropped |
0. Decomposition Gate (MANDATORY before any work)
Before executing any request that involves tool-mediated work:
- DECOMPOSE: List the actions needed (file reads, edits, searches, commands, analyses).
- CLASSIFY: Which actions are independent (no data dependency)? Which are dependent?
- DISPATCH: 2+ independent streams â default to TeamCreate with subagent waves per teammate (Pattern E). Single domain only, no coordination needed â parallel Task calls. Exactly 1 action â single session.
- CONFLICT CHECK: Two independent actions editing the same file â make those sequential; all others remain parallel.
- TRACK: For orchestrated work, create TaskCreate entries before dispatch (see Section 7).
Fast path: Single-action requests skip directly to single session.
Explore-first path: Cannot decompose without exploration â spawn parallel exploration team first (Pattern F Wave 1), then re-enter this gate.
User override: Explicit user requests for a specific execution approach take precedence.
Common rationalizations (all invalid)
- “It’s faster to do it myself” â Parallel subagents complete N tasks in time of the slowest 1.
- “The task is too simple” â If it has 2+ independent actions, parallelize them.
- “I’ll just do this one thing first” â Decompose BEFORE doing anything.
Mode constraints
- Plan mode: Read-only subagents only. No teams, no write-capable agents.
- Implementation mode: All tiers available. Default to highest applicable tier.
- Delegate mode: Lead orchestrates only. All implementation via teammates/subagents.
Skill integration
When a superpowers skill is active, the gate operates WITHIN the skill’s execution structure:
- Phase-gated skills: Parallelize within each phase. Do not parallelize across phase boundaries.
- Per-task review loop skills: The skill’s sequential structure takes precedence. Parallelize exploration within each task, not across tasks.
- Dispatch-precondition skills: The skill’s “Don’t use when” conditions remain valid. The gate does not override skill-level safety guards.
1. Tier Selection (mandatory â highest applicable tier wins)
| Tier | Mechanism | Use when | Model |
|---|---|---|---|
| Team + nested waves | TeamCreate + subagent waves per teammate | 2+ independent streams (DEFAULT) | opus |
| Subagent wave | Task tool, parallel calls | 2+ actions, single domain, no coordination needed | opus |
| Single session | Direct execution | Exactly 1 action | N/A |
Select the highest tier whose criteria are met. Never select a lower tier to reduce cost.
2. Subagent Best Practices
Spawning
- One response, multiple Task calls. All independent subagents MUST be dispatched in the same message.
- Use
run_in_background: truefor subagents whose results are not needed immediately. - N independent actions = N parallel subagents. Merge only when they share file/directory scope.
Prompt-tuning
- Give every subagent a detailed, self-contained prompt with exact file paths, expected output format, and domain context.
- Do NOT rely on the subagent inheriting conversation history â it does not.
Model selection
opusâ the ONLY model. Every subagent, every teammate, every wave. No exceptions. Never downgrade.
Context management
- Delegate verbose operations (test suites, log parsing, doc fetching) to subagents.
- Use subagent resumption (agent ID) for multi-phase work rather than spawning fresh.
- After a wave completes, apply the Accounting Rule (Section 4) before synthesizing.
3. Agent Team Best Practices
- Start with 2-4 teammates. Scale up only when justified.
- Assign each teammate a distinct domain and non-overlapping file ownership.
- Aim for 5-6 tasks per teammate â productive yet manageable for check-ins.
- Include all task-specific context in spawn prompts: file paths, architecture decisions, acceptance criteria.
- Use delegate mode to prevent the lead from implementing work itself.
- Never assign two teammates overlapping file ownership.
- The lead must not proceed to synthesis until all teammate tasks are accounted for (Section 4).
4. Quality Gates & Failure Recovery
The Accounting Rule (MANDATORY after every parallel dispatch)
When N agents are dispatched, all N must be accounted for before proceeding:
- COLLECT: Wait for all N agents to return. Poll with
TaskOutputblock=false for timeout detection. - TALLY: Results received vs dispatched. Missing = unresolved.
- RESOLVE all non-successes via the Recovery Ladder (see
references/patterns.md). - GATE: Do NOT advance until every agent has SUCCESS or explicit SKIP.
- REPORT: Summarize all agent outcomes via TaskUpdate before proceeding.
Hooks for automated enforcement
- TeammateIdle hook: prevent teammates from idling before work is verified.
- TaskCompleted hook: prevent tasks from closing before tests pass.
- Both use exit code 2 to send feedback and keep the teammate/task active.
5. Orchestration Patterns
| Pattern | Name | Use When | Details |
|---|---|---|---|
| A | Parallel subagent wave | 2-6 independent subtasks in a session | see references/patterns.md |
| B | Agent team with file ownership | Cross-domain features, large refactors | see references/patterns.md |
| C | Competing hypotheses | Debugging, architecture decisions | see references/patterns.md |
| D | Plan-then-swarm | Large tasks needing human approval | see references/patterns.md |
| E | Teams of subagent-using teammates | Very large tasks, nested parallelism | see references/patterns.md |
| F | Multi-wave pipeline | Explore â implement â verify phases | see references/patterns.md |
6. Limitations
- No session resumption for teammates (
/resumeand/rewindwon’t restore them). - No nested teams (teammates can use subagents but cannot spawn teams).
- One team per session. Clean up before starting a new one.
- Lead is fixed â cannot transfer leadership.
- All teammates inherit the lead’s permission mode at spawn.
- Subagent resumption may not recover from all failure modes (re-spawn instead).
- No built-in timeout detection â orchestrator must poll with
TaskOutputmanually. - Recovery re-spawns count toward the session’s agent budget.
Critical Rules
- Never dispatch independent actions sequentially â all independent Task calls MUST appear in one response.
- Always run the Decomposition Gate before any tool-mediated work; skipping it is never acceptable.
- Never reduce parallelism, tier, or model quality for any reason â always use opus, no exceptions.
- Never silently drop a failed subagent â N dispatched = N accounted for; apply the Accounting Rule after every wave.
- Never advance to Wave N+1 with unresolved agents â resolve all agents in Wave N first.
- Always create TaskCreate entries before dispatching subagent waves or agent teams â silent orchestration is forbidden.
- Never assign two teammates overlapping file ownership â overlapping edits cause lost work.
- Always include full context in subagent and teammate prompts â they do not inherit conversation history.
Reference File Index
| File | Content | Read When |
|---|---|---|
references/patterns.md |
Detailed patterns A-F with ASCII diagrams, key rules, recovery ladder | Designing parallel execution or selecting a pattern |
7. Progress Visibility (MANDATORY for orchestrated work)
All orchestrated work must produce structured progress indicators via TaskCreate/TaskUpdate.
| Tier | Requirement | Granularity |
|---|---|---|
| Subagent wave | MUST | One task per subagent, created before dispatch |
| Agent team | MUST | One task per teammate assignment, created during setup |
| Single session (3+ steps) | SHOULD | One task per logical step |
Rules
- Create tasks before execution begins, not retroactively.
- Each task MUST have a descriptive
activeFormin present continuous tense naming the specific action and target. - Update tasks to
in_progressbefore starting,completedimmediately after. - After wave completion + accounting, summarize all agent outcomes before dispatching the next wave.