Context (gather first)
Run these and read the output before planning:
git branch --show-current
git status --short
Pipeline
Read → Decompose → Plan → Gate 1 → Assign → Run → Gate 2 → Synthesize
The input — the text after /team (Claude Code) or $team (Codex) — is the user's natural-language goal. Run the pipeline. Don't ask permission for read-only work. Surface only when a gate fires.
0. Required reading (before Interpret)
Blocking, in order:
- Always read
references/SKILL.md— the project doc index. Use it to identify which reference files are relevant to the goal. - If the request requires building (writing/editing code, creating files, scaffolding features), also read
references/development/conventions.mdbefore any Plan node that writes code. No code-writing agent is dispatched until this read has happened in the main thread.
Cite both reads in the Gate 1 checklist as the first row(s). Skipping either is a planning failure — roll back to step 0.
No
references/SKILL.md? The reference layer isn't set up here — skip this step and work from the codebase itself. Say so at the top of the run. Don't invent a reference doc, and don't halt over its absence./setupbuilds it, in either mode.
1. Interpret
Extract: real intent · success shape (advice / fix / comparison / plan) · scope · destructive?
State a one-line restatement so the user can interrupt:
"Interpreting as: . Dispatching team to produce: ."
2. Plan the DAG
Decompose into 3–5 nodes. Each node: type · deps · agent kind (Explore for reads, Plan for design, general-purpose for action / +isolation: "worktree" for code writes).
Always end with a critic node prompted to disagree with the synthesizer.
3. Gate 1 — Review the plan
For each plan finding, mark Auto or Ask using Claude Code's auto-mode as the classifier:
- Auto-mode would prompt → Ask
- Auto-mode would run silently → Auto
/team-specific addition: ambiguous name/path with multiple valid resolutions → Ask
Print the checklist at the top of your response (one row per finding, Auto / Ask + 1-line note).
- All Auto → apply silently, proceed.
- Any Ask → use
AskUserQuestionwith the single most important question. Revise. Re-run Gate 1. Max 2 loops; on the 3rd, stop and surface the planning problem.
4. Run
Dispatch all dep-free nodes in ONE message (parallel Task calls). As layers finish, dispatch the next layer the same way. Critic runs last.
5. Gate 2 — Review the outcome
For each agent: format ok · scope ok · substance ok · budget ok · no "scope was wrong" signal.
- All pass → synthesize.
- N pass, 1 fails → re-dispatch only the failed node with sharpened prompt.
- "Scope was wrong" signal → roll back to Step 3.
Max 2 rollbacks per invocation. On the 3rd failure, stop:
"Plan and execution disagree after 2 rollbacks. Here's what I tried and the next plan I'd try — Y to run / N to revise."
6. Synthesize
Final output:
- The answer (recommendation / fix / diff)
- Why — 1–3 sentences, cite
file:lineorreferences/*.md - Critic pushback (skip if rubber-stamp)
- Out of scope (if user might expect it)
Never dump raw agent reports.
Hard rules
- Main thread orchestrates only. Reads >3 files? Use
Task. - Always include a critic. Critics must disagree, not approve.
- Auto/Ask follows auto-mode — don't invent new classifications.
- Cite
file:lineor doc section for every claim.
Caps
Hard (enforce):
- Max 5 agents per layer
- Max 10 agents total per /team invocation
- Max 4 DAG layers (deeper = wrong problem)
- Max 2 rollbacks (already in Gate 2)
Soft (debug signal):
- Total token budget ~60k; per-agent report ~4k
- Persistently over → re-scope, you over-fanned
Principle:
- Reports should be the smallest table that conveys findings. Trust the model to self-size; the soft caps are guard-rails, not gates.
Anti-patterns
- Asking permission for read-only research
- Serial
Taskdispatch when parallel is possible - Full rollback when only one node failed
- Critic that rubber-stamps (re-prompt to disagree)
- Dumping raw sub-agent output instead of synthesizing
Last Updated: 2026-08-18