Use when starting, resuming, or completing any development task or sprint. Drives a gate-driven loop — quick, mvp, and sprint-bulk modes — with a G1 Scope gate and a G2 Design gate before any commit. Self-contained, no specialist agents. Do not use for debugging — use /diagnose; or for converting raw intent into tasks — use /task-decomposer.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Orchestrator?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/aldianriski-orchestrator)
---
name: orchestrator
description: Use when starting, resuming, or completing any development task or sprint. Drives a gate-driven loop — quick, mvp, and sprint-bulk modes — with a G1 Scope gate and a G2 Design gate before any commit. Self-contained, no specialist agents. Do not use for debugging — use /diagnose; or for converting raw intent into tasks — use /task-decomposer.
argument-hint: "[quick | mvp | sprint-bulk | overnight] [task-or-description]"
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, Task
user-invocable: true
version: "0.2.0"
---
# orchestrator
Gate-driven execution loop. Coordinate the work; restate intent as a verifiable goal first. Humans approve gates — never self-approve. No specialist agents: gates are inline checklists and review is a structured self-pass.
Before routing/dispatch, read `.claude/CONTEXT.md` (else `CONTEXT.md`, or the host equivalent) in full unless `/prime` loaded it this session: its gates, sprint rules and model tiers bind every commit; missing file → report and use this skill's defaults.
Before recon/design, read only the affected area's section of `docs/architecture/overview.md` (else `docs/ARCHITECTURE.md`, `ARCHITECTURE.md`, or the host equivalent); if absent, report it and locate the area from code and existing docs.
## Mode dispatch
| Mode | Gates | Use when |
|---|---|---|
| `quick` | G1 | single task, small, low risk |
| `mvp` | G1 + G2 | feature work, medium+, multi-step |
| `sprint-bulk` | G1+G2 once | auto-loop the active sprint's members |
| `overnight` | G1+G2 pre-signed | **canonical name** for the unattended headless run of a promoted Plan — `sprint-bulk` under the Part 0 authority contract and the Part 0b continuation contract. **Aliases, all still accepted:** `night-run` · `unattended` · `sprint-bulk unattended` |
**Intake routing — a mode keyword selects the mode, it never bypasses these routing checks.** Run them on every invocation, named mode or not:
- No tracked task → run `/task-decomposer` first, then consume its hand-off per `references/mode-choice.md`: `stop` ends; `promote` invokes promote once and returns its result here; `<mode>` proceeds as named.
- Intent too **foggy to slice** (decisions unknown — no acceptance criteria writable yet) → `/task-decomposer` **fog-mode** (`--fog`): map the decisions before forcing tasks.
- Task is in an **active sprint** → no mode named: popup per `references/mode-choice.md`, recommended first; a named mode (including one picked at a hand-off) skips it. Named or chosen quick/mvp follows its § Promoted member before dispatch. Headless/unattended mode-less intake → `Next:` only, runs nothing.
- Task is only in the **Backlog** (not in any active sprint) → **don't silently build**: attended per `references/mode-choice.md` → popup `/lean-doc-generator promote` into a sprint, or explicit `quick` one-off; headless/unattended → `Next:` only, runs nothing (never slide decompose → build unrecorded).
- Asked to **start a night run** on anything that isn't already a promoted Plan → you are the *interactive launcher*, not the run: do feed → promote → pre-flight here, gates and all, and fire the trigger only once pre-flight is green. Never spawn first (→ `${CLAUDE_SKILL_DIR}/references/night-run.md` Part 1a).
- **Layout v1/mixed** → `TODO.md` present and no `docs/work/` → v1 · both present → mixed · only `docs/work/` → v2 (existence only, never content). Refuse this skill's queue operation and point to `/lean-doc-generator migrate`, the only 2.x path for a v1 tree.
## G1 — Scope gate (all modes, always runs)
Confirm before touching code. BLOCK if any answer is "unknown":
- [ ] Goal restated as one verifiable sentence ("done when …")
- [ ] Size estimated S / M / L — an **L splits before proceeding**
- [ ] Files likely touched listed; blast radius understood — a small lookup stays inline; for unfamiliar / mature code whose recon would read many files, **recon via the `Explore` agent** (condition (a), bulky output: impl + tests + deps read in its own context)
- [ ] Out-of-scope explicitly named (what this task will NOT do)
- [ ] Assumptions surfaced and confirmed where they affect behavior
**Fast-path:** `origin: decomposer` (it met the intake grill) → G1 = one confirm ("scope unchanged since approval?"); changed/unsure → full checklist above.
**Every other origin gets the full checklist** — `close-retro` follow-ups, `/triage`-converted bugs and `manual` entries never passed the intake grill, so there is no prior scope agreement for a fast-path to re-confirm. A **missing** `origin:` is treated as ungrilled, not as decomposer: the fast-path is the exception that must be earned, and the field says so in the task's own text — never inferred from `tracker:` or from how the entry reads.
## G2 — Design gate (mvp + sprint-bulk)
Before implementing, draft the design in **`/plan`** (plan mode) and get human sign-off; on approval (plan-mode exit or popup) mvp sets the task file's `gates_signed: G1,G2 @ <sha>` (`@ <YYYY-MM-DD>` with no git; G1 the moment it passes) and a one-paragraph `## Approved design` (sprint-bulk keeps the sprint-level field):
- [ ] Approach chosen over alternatives, with a one-line WHY; its file list holds only what the change needs, inside the task's declared layers — ticking or moving the task file is coordinator bookkeeping, not a design file, and a doc is listed only when the task or the change's behaviour needs it
- [ ] **Business facts** — the design reads the repo's stated business facts first (its requirements, business notes, its profile's business topics), then names each one the change touches and how it honours it; where a fact and the neighbouring code disagree, the fact wins and the design says so
- [ ] Micro-task list, each independently verifiable (for an **L** design, present + approve it section-by-section, not one monolith) — a change to working behaviour opens with its pin, inside the declared layers (a pin that belongs outside them is named as an open point, not added)
- [ ] Each `done-when` notes its **verification method** where a mechanical check exists — that named check's FAIL then blocks the *silent* tick: surface → recorded owner ruling, never tick past it quietly (ADR-021)
- [ ] **Reachability — for every mechanical `Verify:`, four questions, not one.** **EXISTS** (is the method actually there?) · **RUNS** (in the target environment?) · **REACHES** (does its scope touch the artifact or behaviour the criterion claims?) · **PROVES** (if it PASSes, is the criterion true?). *A check that never examines the target is not verification.* Naming a method is the half that gets checked today and the half that fails safely; an **unreachable** criterion reads exactly like a satisfied one — it goes green while saying nothing about its subject (L-136 ×4: a `Verify:` naming `check-doc-caps.sh` for `docs/qa/` files, where §2 states no cap for `docs/qa/`, so it could neither pass nor fail them and ran `66 PASS, 0 FAIL`). **A method whose scope excludes the target is recorded as not-valid-proof, not accepted.** Where no mechanical method reaches it, the criterion stays a **judgment tick and says so** — that is legitimate, and inventing a checker merely to make a criterion look mechanical is the failure, not the fix. Evidence for it comes from the repo's existing runners first; a throwaway probe script lives **inside the working tree** and is deleted before the report, never in a system temp dir (a write outside the working tree needs a permission an unattended run does not have). EXISTS and REACHES are pre-screened by a reachability checker where the host has one (lean-flow's own: `scripts/lib/check-verify-reaches.ts`); RUNS and PROVES are yours; a `Negative:` box is a criterion like any other, with or without `Verify:`, and its verification names the test that would fail if that behaviour broke; no such test → a judgment tick that says so
- [ ] **Heading for an `overnight` run?** Record the **approval envelope** in the sprint frontmatter — `approval_envelope: goal · scope · acceptance · design · verification · j1-delegation · capabilities · repair-policy · budget · stop-conditions @ <sha>`. Gates say *the Plan is sound*; the envelope says *the run may proceed inside these bounds without asking* — different grants, so signing G1/G2 does not imply one. All ten, or the envelope can silently widen along the one omitted; frontmatter, never the transcript, because that is the only thing an unattended run reads (L-099 · L-151). Absence means NOT approved (`references/night-run.md` Part 1a step 4b)
- [ ] **Authority class declared per task — `J0` · `J1` · `J2`**, in the header meta beside `class:` (`references/night-run.md` Part 0 § Authority classes). J0 needs no approval · J1 is delegated in advance by a recorded pre-launch approval and runs unattended **inside that envelope only** · J2 is human-reserved and **parks**. **Declared, never inferred, and an absent class reads as J2** — the safe end, because an undeclared class is an unasked question and an unasked question is a BLOCK. Against `HITL`/`AFK` it is a one-way implication, not independence — `J2` ⇒ `HITL` always, `HITL` ⇏ `J2`: staffing describes the run, the class describes the task, so a J1 task run with a human present is still J1
- [ ] Hard-to-reverse decision? → record it (prompt `/lean-doc-generator <adr> <subject>`); a `risk: high` task touching auth / input / secrets / data-exposure → sketch its one-line abuse case here at design time (complements the Review-time `/security-review` row — never replaces it)
- [ ] A ruling you are about to **offer** changes a shipped entry point or a frozen contract (a rule id, a published count, what a skill or check requires)? → read that entry point's own ADR first and name it in the option you offer (L-220)
- [ ] **Builder check before sign-off** — one fresh reader per G2 batch, given every task design, its frozen Done-when and the touched paths, reports contradictions and open questions; settle facts and contradictions yourself, carry only intent questions into the popup, log one `builder-check · Tn` line each (`references/builder-check.md`)
- [ ] Residual ambiguity grilled (below) until the goal is unambiguous
**Residual grill** — the detailed grill runs at intake (`/task-decomposer` Clarify); here, re-grill only what is still open —
by **frontier round** — batch every still-open question whose prerequisites are settled into one **AskUserQuestion popup**, serialise only the dependents (dependency is the discriminator, not count), recommending an answer each time. An unconfirmed
`assumes:` or a `needs-info` task **BLOCKS G2** until resolved — surface it or mark it `blocked` with an unblock condition, never
park it as a passive note. A design that must be *felt* → `/prototype`, fold the verdict back into G2; a high-stakes hard-to-reverse fork → `/council` (`verdict-<slug>.md`) → ADR.
## Continuation contract — when an unattended run may stop
`references/night-run.md` Part 0 says what a run may **do**; this says when it may **stop**. A run does not pause between tasks the owner already approved — a `J1` task is one the recorded approval
covers, so re-confirming it re-asks a settled question; finishing a task is not a decision point. It **ends at exactly one of five terminal states, named in the rollup**: `PLAN_EXHAUSTED` (every task
reached a resolved state) · `AUTHORITY_BOUNDARY` (work remains, all of it J2 or blocked behind a
park) · `HARD_FAILURE` (a step the run cannot proceed past) · `BUDGET_STOP` (a declared ceiling
reached with Plan remaining) · `USER_STOP` (a human interrupted). Anything else is a stop nobody
declared — the failure that reads as success, since a turn that simply ends carries `subtype:
success` and no error. The launcher writes the state, as it already writes the DoD count (ADR-016) —
this changes *when* a run stops, never *who* records it. Full contract → `references/night-run.md` Part 0b.
## Phases
> **Routine work runs inline; a dispatch needs a named condition.** The session coordinates gates, grill, design, synthesis and merge, and builds routine steps itself under the secret-files rule (`dispatch.md`). It dispatches only for bulky output · two or more parallel disjoint units · a black-box review, verify or builder check · the cross-model route (the other provider's CLI) · a compacted session or an owner or coordinator ask for a worker (`dispatch.md` § Route by classification); a sub-agent dispatch goes to a `general-purpose` agent, names that condition and its class row's model (`execution`→Sonnet · `mechanical-ingest`→Haiku) and hands over the procedure skill. Either way, route by type: new behaviour→`/tdd` test-first · bug→`/diagnose` · hard-to-change→`/refactor-advisor` · docs/config/spikes→direct. Pin changes to working behaviour first, within declared layers. Drive `/goal` from the task's done-when; clear at task end. Escalate ADR-grade forks by hand to Fable / `/council`.
> Every dispatch names its model from its own classification and follows the parallel preflight, both in `dispatch.md`; every build dispatch pastes `${CLAUDE_SKILL_DIR}/references/worker-brief.md` verbatim. Keep which worker holds which task, so a question or fix returns to it. Read reports and run gates; never investigate a worker's blocker or redo its work.
> Post-G2 sprint execution: a worker's `blocked` question parks per `references/sprint-bulk-run.md` § Runtime and is asked at exit; elsewhere relay it as an **AskUserQuestion popup** (unattended → `night-run.md`). Send the answer to that worker via `SendMessage`, never a new agent (no resume, or a later process → `dispatch.md`). Routing · `/goal` · parallel/sequential · uncertain-write readback → `${CLAUDE_SKILL_DIR}/references/dispatch.md`; a lane or new-session request, an owner-opened session to delegate to, or multi-session lanes → `${CLAUDE_SKILL_DIR}/references/coordinator.md` (a lane is a session, never an `Agent` subagent); roles → `.claude/CONTEXT.md` · ADR-010.
### quick
1. **Parse** — restate the task as a verifiable goal; confirm in one line.
2. **G1** — run the checklist; BLOCK on any fail. On the owner's approval (plan-mode exit or popup) write the task file's `gates_signed: G1 @ <sha>` (`@ <YYYY-MM-DD>` with no git).
3. **Implement** — execute per Implement routing (new behaviour → `/tdd` by default); flag scope creep the moment it appears.
4. **Self-review** — run the review checklist (below) as the floor; heavier isolated `/code-review` / `/verify` passes apply to non-trivial diffs and mvp+sprint-bulk, not quick low-risk tasks.
5. **Commit** — structured message: `type(scope): summary`; pass it through `/humanizer` embedded mode (format `plain`) unless a fixed template (also mvp step 7 and the sprint-bulk Commit) → `${CLAUDE_SKILL_DIR}/references/dispatch.md` § Commit messages.
### mvp
1. **Parse** → 2. **G1** → 3. **Grill** (if requirements unclear) → 4. **G2 Design**
→ 5. **Implement** micro-tasks in order (route by type — new behaviour → `/tdd`), ticking each as its check passes → 6. **Self-review** → 7. **Commit**.
### sprint-bulk
Operates on the active sprint file `docs/sprint/SPRINT-NNN-<slug>.md` and its **members by reference** (ADR-047): the `## Members` paths ∪ every `docs/work/*/TASK-*.md` stamped `sprint: SPRINT-NNN`, each resolved by id in whatever status folder it sits.
A member's DoD is its own `## Done when`; § Plan carries only sprint-scoped meta (`Layers:` · `Depends-on:` · `Cites:`), never DoD. Resolution · tick · transitions · close → `${CLAUDE_SKILL_DIR}/references/dispatch.md` § Members by reference.
0. **Guard** — verify an active sprint (a top-level `docs/sprint/SPRINT-*.md` with `status: active`, never `logs/` or `archive/`) with a member still open — an open `## Done when` `[ ]`, or not yet in `done/`/`cancel/`. No active sprint → halt, redirect to `/lean-doc-generator promote`; every member closed → step 6. More than one active (parallel streams) → ask which sprint to run.
Resuming from a `/handoff` that lists an uncertain write → read its target back before any retry; a timeout is not a failure (`${CLAUDE_SKILL_DIR}/references/dispatch.md` § Uncertain writes).
1. **Batch G1** — one combined scope pass over the Plan — the pre-run sweep opens here (`references/sprint-bulk-run.md` § Sweep).
2. **Batch G2** — one design pass; **map shared-file ownership** (every file touched by >1 task → single owner + commit order, before the first task) and note cross-task file overlaps — and **cross-stream** ones: files shared with another stream's active sprint → coordinate or sequence, never parallel-build; at commit, stage shared files per-hunk (`git add -p` + verify `git diff --cached`) — a plain `git add <shared>` stages another task/stream's WIP into your commit (contaminates at the commit phase, not just merge — promoted rule); **finish the pre-run sweep** (`references/sprint-bulk-run.md` § Sweep) — every foreseeable question asked before the first dispatch; a batch sign-off never waves an open assumption through. **The map is built from `Layers:`, so it cannot see files no task declares** — the sprint file (§ Files Changed), its Execution Log, and every member file's ticks and `git mv` transitions are written across tasks and owned by the **coordinator**, never assigned to one; a dispatched agent returns its Log entry and evidence in its report instead of writing them (SPRINT-063 produced two copies of one Log → `${CLAUDE_SKILL_DIR}/references/dispatch.md` § Worktree dispatch protocol).
3. **Sequence** — **run the pre-dispatch preflight first** (cycle · shared-file ownership · base-ref-vs-HEAD · wave rank, all derived from each task's `### Tn`/`Layers:`/`Depends-on:`); any FAIL halts the wave with its named finding, never a bare fail. Then from the G2 overlap map decide per task: **two or more ready units with no shared file and no dependency between them → dispatch in PARALLEL, worktree-isolated** (one `Agent(isolation:"worktree")` per task, one message; coordinator merge-back queue) · **a lone ready unit, or shared/dependent → SEQUENTIAL, inline in the session unless another admitted condition applies** (ownership order); large fan-out → `/batch` · `/workflows`. Protocol + queue + rules → `${CLAUDE_SKILL_DIR}/references/dispatch.md`.
4. **Loop** — run each Plan task's implement, review, tick, move and commit sequence in `references/dispatch.md` § Members by reference. From the release containing ADR-045's 2026-11-12 amendment, all of its moves and ticks ride in the task's own work commits; earlier sprints' bare move commits stand;
with no git (`git rev-parse --git-dir` fails) every move is a plain file move and a tick is checked against the promote entry's snapshot, not `plan_commit` (`/lean-doc-generator` § Without git);
**append to the sprint Execution Log** (never edit § Plan — it's frozen and holds no DoD). `/loop` can pace it; unattended overnight run → `${CLAUDE_SKILL_DIR}/references/night-run.md` (pre-flight + trigger + **the unattended contract, Part 0**). **Run the loop until the Plan is exhausted — every member's boxes ticked or its task carrying a rollup line — then emit the rollup block at exit, always, headed by `run · N of M DoD ticked`, counted over the members' `## Done when` boxes** (night-run.md Part 4). Nothing outside this loop checks the Plan is finished, so a turn that ends mid-Plan ends the session reporting `success`; the count is what makes that visible (`unattempted` is its state). **Governed by the Continuation contract above** — do not pause between already-approved tasks, and end at exactly one of its five named terminal states.
5. **Park, continue, ask at the end** — post-G2, attended and overnight follow `references/sprint-bulk-run.md` § Runtime (parks, readiness, task-boundary re-checks and exit frontier). Explicit user stops, budget stops, hard failures and pre-execution gates still halt at once; the exit rollup remains `night-run.md` Part 4.
6. **Close** — every member in `docs/work/done/` or `cancel/` (the host's `check-sprint-by-reference.ts <sprint> --close` gate where it has one, else the plain-git check in dispatch.md § Members by reference)
→ **first, once, after the final wave's merge-back, run system-verify** (the discovered host gate against the integrated tree; a FAIL blocks this close per ADR-021 → `${CLAUDE_SKILL_DIR}/references/dispatch.md` § System verify) → then `/lean-doc-generator close`; then **fixes-only sprint → `/release-patch` (PATCH); feature sprint → MINOR by hand** (release-patch is PATCH-only, scans `plan_commit..HEAD`).
## Review
Run checks in a **fresh, isolated context** (a reviewer who didn't write the code catches more) and **scope every pass to
the diff + its blast radius** — never the whole repo (the fan-out re-scan is the biggest token sink). A **skip table** +
**scale-depth** rule decide what fires — keyed on **consequence, never file type**: low behaviour *and* low governance impact → self-review only · governance impact at any size (spec/STANDARD semantics · an implementation-binding ADR · a workflow or protocol contract) → one scoped `sonnet` reviewer, whatever the extension · small/med → one scoped `sonnet` reviewer · large/high-risk → `/code-review` · behaviour change → `/run` + `/verify` · auth/input/secrets → `/security-review` · bug → `/diagnose`. The material-risk classes are defined **once** in `references/dispatch.md` § System verify and consumed here; unclear ⇒ material.
A pass's worst finding **per axis** feeds **one bounded builder retry** — automatic in attended modes, one retry per
pass, re-reviewed once; whatever is still open goes to the owner (the revise loop). Unattended, it fires only under
**ADR-022's mechanical-trigger carve-out** (named-check FAIL + declared repo policy; judgment findings always park).
**Record the skip-table lookup itself, not only its outcome** — append `consequence · Tn · behaviour:… ·
governance:…` to the Execution Log the moment the table above is consulted, whatever depth is then chosen
(TD-092). Otherwise a governance/material task whose review never gets logged is unreachable to
`check-review-depth.sh` in attended mode, which is every mode this repo runs.
Full routing · skip table · the Standards-vs-Spec axes · the revise loop · adversarial floor · self-review checklist → `${CLAUDE_SKILL_DIR}/references/review-scoping.md`.
**Report shape** — every boundary report (a gate verdict, a task done, the sprint-bulk exit) and every confirmation popup opens with ONE line that carries both its verdict (what is true now, or what was decided) and the next step, then a `Progress:` line, then the evidence, then exactly one `Next:` line; context the reader already has is not restated. Record reuse → `dispatch.md`.
The sprint-bulk exit rollup is a machine-read contract (night-run.md Part 4) and keeps its own shape, `run · N of M DoD ticked` first; the rule governs the prose around it (TASK-321). `Progress:` gives sprint members done and epic conditions ticked, each N of M with %; a running job adds done/total, % and an ETA (TASK-583).
In every mode, before the report: anything a check created in the working tree (a probe script, a database directory, a cache, a log), gitignored or not, is removed unless the task's declared files include it; what the repo's own tests leave outside the working tree is named in the report, never deleted (deleting it needs a permission an unattended run does not have).
## Red flags
❌ **G1 skipped** — unconfirmed scope causes regressions; no exceptions.
❌ **Size L not split** — un-reviewable; split first.
❌ **Self-implementing past the goal** — coordinate the task, do not expand it.
❌ **Grill skipped on ambiguous requirements** — builds the wrong thing.
❌ **Committing through a failing check** — surface the failure, don't bury it.
❌ **Silently absorbing a mid-sprint scope change** — a pivot that shifts scope is logged (`scope-change`: what broke · impact · re-confirm G2) in the Execution Log *before* editing the frozen § Plan or a member's `## Done when` (SPRINT-012 T4 · ADR-047).
❌ **Quietly reinterpreting a DoD that execution invalidated** — distinct from the row above: the scope holds, the *criterion* went stale. A DoD frozen at promote can carry a number estimated before it was measured, or a premise a later decision dissolved. Log a `scope-change` and get the owner's ruling before ticking it; never round a measurement up to meet a stated figure, and never re-read the words to fit what was built. A sprint that closes green against criteria nobody re-agreed to is the failure (L-088).
❌ **Offering a ruling against a shipped contract without its ADR** — an owner can only rule on the options shown; one that silently breaks a frozen surface is not a choice they made. Twice the governing ADR went unread while the rule naming it was loaded: SPRINT-110 R3 (ADR-049) and SPRINT-111 T3, a rule-id removal against ADR-034's frozen 100, found only after the build (L-220).
❌ **Treating autonomy as authority** — `sprint-bulk` / "go autonomous" is momentum, not a licence to silently reverse a safety/policy default (keep it default-OFF + surface the conflict for an owner decision — promoted rule), nor to read an **unanswerable question as approval**: headless has no ask channel at all (`AskUserQuestion` unregistered; `dontAsk` auto-denies) — a missing channel, a denial, or no human is a **BLOCK**, so park it. Never "proceed with the recommended option", never self-approve, never reshape a task to dodge the gate (dodging is scope-changing → itself HITL) (SPRINT-033).
❌ **Sliding decompose → build with no sprint recorded** — a Backlog task not in an active sprint never auto-builds; surface promote-vs-one-off as a popup, never silent (SPRINT-015 T1).
❌ **Spawning an unattended run before its Plan is promoted and pre-flight is green** — step 0's guard runs *inside* the spawned process, where there is no ask channel to halt into; the check that matters is the interactive one, before the spawn. "Run a night run for `<intent>`" is a compound instruction — prepare, then launch — never launch alone (SPRINT-034).