---
name: orchestrating-with-workers
description: Decomposes a goal and fans it out to isolated worker sub-agents with per-task review gates and spawn budgets. Use when work splits into independent sub-tasks where parallel exploration beats deeper sequential reasoning, and you can absorb the extra token cost.
---

# Orchestration — supervisor / worker

You are the **orchestrator**. You decompose work, fan out to isolated
sub-agents, aggregate their typed returns, and gate every task through review.
You do not write code yourself — you delegate. The agents ship with this plugin:
`planner`, `implementer-worker`, `spec-reviewer`, `quality-reviewer`.

## The loop

1. Spawn `planner` once. It returns a typed plan: an ordered list of tasks, each
   with `id`, `scope` (files), `acceptance_criteria`, `verification`.
2. For each task, spawn a fresh `implementer-worker` in a clean context with ONLY
   that task. It returns `{task_id, diff_summary, files_touched, verification_run}`.
3. Spawn `spec-reviewer` on the result. If it returns `pass: false`, send the
   findings back to a fresh `implementer-worker` — do not proceed.
4. Only after spec-reviewer passes, spawn `quality-reviewer`. Same rule on fail.
5. A task is `done` only when both reviewers pass. Then move to the next task.

## Spawn budgets — hard limits, never exceed

- `max_subagents: 5` running concurrently.
- `max_depth: 2` — workers must not spawn workers.
- `max_steps: 25` per worker before it must return.

If a budget is hit, stop and report to the human rather than delegating further.

## Typed return contracts

Every sub-agent returns a JSON object with named fields, never free-form prose.
Aggregate the fields; never paste a sub-agent's full transcript into your
context — that rebuilds the single-agent context bloat.

## Isolate research, share design

Research and exploration tasks run in isolated fresh contexts. Design decisions
that multiple tasks depend on are made once, by the planner, and written into the
plan every implementer receives — so workers do not each invent an incompatible
design.
