Orchestrator - Multi-Agent Coordination
A specialized orchestration skill for coordinating multiple parallel workers to execute feature plans efficiently.
code
┌─────────────────────────────────────────────────────────────────┐ │ ORCHESTRATOR PIPELINE │ ├─────────────────────────────────────────────────────────────────┤ │ Load Plan → Spawn Workers → Monitor → Sync → Verify │ └─────────────────────────────────────────────────────────────────┘
Pipeline Phases
Phase 1: Load Execution Plan
Goal: Parse and validate the execution plan.
| Input | Output |
|---|---|
history/<feature>/execution-plan.md | Parsed track/bead structure |
Steps:
- •Read execution-plan.md
- •Validate all tracks have non-overlapping file scopes
- •Identify dependency graph
- •Determine initial beads (no dependencies)
Phase 2: Spawn Workers
Goal: Launch parallel sub-agents for each track.
| Input | Output |
|---|---|
| Track definitions | Running Task agents |
Spawning Strategy:
code
For each track with no blocking dependencies: 1. Prepare worker context (track scope, beads, acceptance criteria) 2. Spawn Task with worker skill loaded 3. Track worker status
Worker Assignment Template:
markdown
## Worker Assignment: <Track Name> ### Your Scope Files you may modify: <file glob patterns> ### Beads to Complete 1. **<Bead Title>**: <description> - Acceptance: <criteria> - Dependencies: <none or list> 2. **<Bead Title>**: <description> ... ### Rules - Only modify files within your scope - Complete beads in order respecting dependencies - Report completion after each bead - Stop and report if you encounter blockers
Phase 3: Monitor Progress
Goal: Track worker progress and handle blockers.
Monitoring Loop:
code
While beads remain: 1. Check for completed beads 2. Unblock dependent beads when prerequisites complete 3. Handle errors and blockers 4. Spawn additional workers as tracks become unblocked 5. Log progress
Status Tracking:
| Status | Meaning |
|---|---|
| ⏳ Pending | Not yet started, may have dependencies |
| 🔄 In Progress | Worker actively working |
| ✅ Complete | Finished and verified |
| ❌ Blocked | Waiting on dependency or error |
| ⚠️ Error | Failed, needs intervention |
Phase 4: Synchronization Points
Goal: Coordinate cross-track integration.
Sync Rules:
- •When tracks need to integrate, pause workers
- •Review changes from all tracks
- •Resolve any conflicts
- •Run integration tests
- •Resume workers
Phase 5: Final Verification
Goal: Ensure all work is complete and correct.
| Input | Output |
|---|---|
| All completed beads | Verification report |
Verification Checklist:
markdown
## Verification Report: <Feature Name> ### Track Completion - [x] Track 1: <name> - All beads complete - [x] Track 2: <name> - All beads complete ... ### Quality Checks - [ ] TypeScript: No errors (`tsc -b`) - [ ] Lint: Clean (`yarn lint`) - [ ] Tests: Passing (`yarn test`) - [ ] Build: Successful (`yarn build`) ### Manual Verification - [ ] <criterion 1> - [ ] <criterion 2> ### Issues Found - <issue description and resolution>
Coordination Patterns
Pattern 1: Independent Tracks
code
Track A: ○──○──○ Track B: ○──○──○ (no dependencies, full parallel) Track C: ○──○──○
- •Spawn all workers simultaneously
- •No coordination needed until final sync
Pattern 2: Sequential Dependencies
code
Track A: ○──○──○
↓
Track B: ○──○──○
- •Track B waits for Track A completion
- •Spawn Track B worker when Track A completes
Pattern 3: Shared Dependency
code
Track A: ○──○─┐
├──▶ Integration ──▶ Final
Track B: ○──○─┘
- •Both tracks run in parallel
- •Integration phase waits for both
- •Final phase after integration
Pattern 4: Cross-Track Sync Points
code
Track A: ○──○──┃──○──○
Track B: ○──○──┃──○──○
sync
- •Pause at sync point
- •Verify integration
- •Resume both tracks
Error Handling
Worker Failure
- •Log the error with context
- •Assess if bead can be retried
- •If retryable, respawn worker with additional context
- •If not, mark as blocked and continue other tracks
- •Report blockers at end
Conflict Detection
- •Check file modification overlap
- •If overlap detected, pause conflicting workers
- •Resolve conflict manually
- •Update file scopes if needed
- •Resume workers
Dependency Cycle
- •Detect cycles during plan validation
- •Break cycles by reordering or merging beads
- •Update execution plan
- •Proceed with corrected plan
Best Practices
- •Maximize Parallelism: Spawn workers as soon as dependencies clear
- •Minimize Communication: Workers should be self-sufficient within their scope
- •Verify Continuously: Run checks after each bead, not just at the end
- •Log Everything: Maintain audit trail of all worker activities
- •Fail Fast: Stop workers early if fundamental issues detected
Tools to Use
- •Task: Spawn sub-agent workers
- •Read: Check execution plan and worker outputs
- •get_diagnostics: Verify no errors after each phase
- •Bash: Run tests and build commands
Quick Reference
| Phase | Action | Key Question |
|---|---|---|
| Load | Parse plan | Is the plan valid and executable? |
| Spawn | Launch workers | Which tracks can start now? |
| Monitor | Track progress | Are workers making progress? |
| Sync | Coordinate | Do tracks integrate correctly? |
| Verify | Final check | Is the feature complete and working? |