Orchestrate Implementation
Run Matt Pocock's /to-spec and /to-tickets output. One ticket owns one
branch, one BB environment, one review-fix gate, and one pull request.
Send raw bugs through /triage first. If a bare Spec needs several contexts,
pause and ask the user to run /to-tickets.
Contract
- Keep work serial. One orchestrator worker is active at a time;
/code-review
may create only its required Standards and Spec subagents.
- Use a fresh thread for implementation, diagnosis, each review-fix phase, and
PR writing, and apply
review-fix-loop here so it spawns only those phase
workers. One ticket shares one environment; the next gets a new branch and
environment. Spawn, never fork.
- Pin the graph, target branch, and each
ticket-base. Mutating workers commit
and leave a clean tree; reviewers and checkers preserve it. Verify every
worker claim in the worktree before recording it.
- Opening a draft PR and pushing its branch are this skill's. Merging, closing
tickets, and archiving environments belong to
land-stack, which --land
invokes once the whole graph is accepted. Deploying stays out.
- Leave a ticket open or
in review until its PR merges; implementation and
review passing is not a reason to close it. Scope is its acceptance criteria,
and the parent Spec stays unchanged.
- Cross-ticket integration belongs to an explicit approved ticket. Do not make
an implicit cumulative implementation or final mega-PR.
- A run outlives one turn. End a turn only in a terminal state or with a
continuation queued per
bb-workers.md, and open every turn with the PR
check sweep in references/pr-stack.md.
References
Follow ../review-fix-loop/references/bb-workers.md for spawning, waiting,
interactions, verification, budgets, continuation, relay, pausing, notification,
and auto-resume, and attach ../review-fix-loop/references/worker-footer.md to
every worker. Keep the ledger in references/ledger.md. After a PR opens,
references/pr-stack.md owns the baseline, checks, ready state, merges,
rebases, and review comments. references/worker-prompts.md holds the
implementation, diagnosis, and pull request prompts.
Modes
status prints the ledger and takes no action: one row per ticket with its
state, PR, checks, environment, and the current pause, then the landable line
from Finish. resume continues a paused run. --land invokes /land-stack
once the run is finished, so one invocation goes from tickets to merged.
Prepare
- Use
bb-cli to resolve the project, provider, target branch, remote, clean
committed HEAD, tracker, Spec, tickets, blocking edges, and current PRs.
Freeze the graph; pause on tickets not ready-for-agent, missing edges, cycles, or a
ticket without acceptance criteria.
- Resolve
validation: the ticket's own validation line, else the project's
documented check, else the package's test, lint, and typecheck
scripts. Record the command; run it yourself after every mutating worker.
Repeat the affected suite when a diff touches time, clocks, concurrency,
ordering, or randomness: one green run cannot tell a passing test from a
flaky one, and every PR stacked on a flaky head inherits the repair.
- Capture
ci_baseline with the command in references/pr-stack.md. A PR
failure named there is inherited, not caused, and never blocks this run;
without it a red repository reads as a red ticket and strands the stack.
- Snapshot the approved artifacts once and write the run ledger.
resume, or
an existing ledger at start, reconciles it with BB, Git, GitHub, and the
tracker before one next transition.
- Verify
bb-cli, implement, diagnosing-bugs, tdd, code-review,
review-fix-loop, show-me, gh-axi, and authenticated push and PR access.
Leave unrelated source checkout changes untouched.
Start a ticket
Choose the first ready ticket in published dependency order, then branch it so
each PR keeps a one-ticket diff. The first ticket branches from the target
branch. Each later ticket branches from the exact accepted head of the previous
ticket, and its PR targets that previous ticket branch. Create a managed
environment at that base and record ticket-base, pr-base, and
ticket-branch. A dirty or drifting base pauses the run.
Gates
Planned behavior or a known fix uses /implement; a hard, unexplained,
intermittent, or performance defect uses /diagnosing-bugs. Implementation
must advance from ticket-base, pass required validation, and leave a clean
tree. Diagnosis also needs a tight red reproduction, supported cause, cleanup,
and a regression test at an approved seam; if no sound seam exists, record an
/improve-codebase-architecture follow-up instead of a shallow test.
Apply review-fix-loop directly in this orchestrator at ticket-base; do not
spawn a loop coordinator. Write its LOOP_GATE into tickets.<id>.loop.gate,
then require LOOP_GATE.verdict: PASS recorded there, zero open confirmed
findings, required validation, and a clean tree. A skipped Spec, a paused loop,
or an absent verdict blocks the PR: an unwritten gate is a skipped gate, and
neither a finished loop nor a zero burden says which axes ran.
Before opening the PR, reconcile every acceptance criterion and prove
pr-base...HEAD contains only this ticket. After creation, verify its remote
head equals the reviewed HEAD, its base is pr-base, and its URL is recorded,
then follow references/pr-stack.md: record the checks, mark the PR ready once
it passes net of ci_baseline, and pause on a failing check the ticket broke.
Set the tracker to in review and start the next ticket in a new environment.
If push or PR creation fails, pause first. An older single-branch run instead
follows references/recovery.md.
Finish
Report ticket order, bases, environments, branches, commits, validation,
review-fix results, check status, tracker state, and the ordered PR stack.
Every accepted ticket must have one PR URL. End with one landable line:
LANDABLE: yes when every ticket is accepted with a green PR, or
LANDABLE: no, <pr> <reason> naming the first PR that blocks it. On yes, run
/land-stack when --land was given; otherwise tell the user that one command
merges the stack, closes the tickets, and removes the worktrees.
1---2name: orchestrate-implementation3description: Run an approved ticket graph serially in fresh BB threads: one reviewed pull request per ticket, and with --land, merge the stack.4---56# Orchestrate Implementation78Run Matt Pocock's `/to-spec` and `/to-tickets` output. One ticket owns one9branch, one BB environment, one review-fix gate, and one pull request.1011Send raw bugs through `/triage` first. If a bare Spec needs several contexts,12pause and ask the user to run `/to-tickets`.1314## Contract1516- Keep work serial. One orchestrator worker is active at a time; `/code-review`17 may create only its required Standards and Spec subagents.18- Use a fresh thread for implementation, diagnosis, each review-fix phase, and19 PR writing, and apply `review-fix-loop` here so it spawns only those phase20 workers. One ticket shares one environment; the next gets a new branch and21 environment. Spawn, never fork.22- Pin the graph, target branch, and each `ticket-base`. Mutating workers commit23 and leave a clean tree; reviewers and checkers preserve it. Verify every24 worker claim in the worktree before recording it.25- Opening a draft PR and pushing its branch are this skill's. Merging, closing26 tickets, and archiving environments belong to `land-stack`, which `--land`27 invokes once the whole graph is accepted. Deploying stays out.28- Leave a ticket open or `in review` until its PR merges; implementation and29 review passing is not a reason to close it. Scope is its acceptance criteria,30 and the parent Spec stays unchanged.31- Cross-ticket integration belongs to an explicit approved ticket. Do not make32 an implicit cumulative implementation or final mega-PR.33- A run outlives one turn. End a turn only in a terminal state or with a34 continuation queued per `bb-workers.md`, and open every turn with the PR35 check sweep in `references/pr-stack.md`.3637## References3839Follow `../review-fix-loop/references/bb-workers.md` for spawning, waiting,40interactions, verification, budgets, continuation, relay, pausing, notification,41and auto-resume, and attach `../review-fix-loop/references/worker-footer.md` to42every worker. Keep the ledger in `references/ledger.md`. After a PR opens,43`references/pr-stack.md` owns the baseline, checks, ready state, merges,44rebases, and review comments. `references/worker-prompts.md` holds the45implementation, diagnosis, and pull request prompts.4647## Modes4849`status` prints the ledger and takes no action: one row per ticket with its50state, PR, checks, environment, and the current pause, then the landable line51from Finish. `resume` continues a paused run. `--land` invokes `/land-stack`52once the run is `finished`, so one invocation goes from tickets to merged.5354## Prepare55561. Use `bb-cli` to resolve the project, provider, target branch, remote, clean57 committed `HEAD`, tracker, Spec, tickets, blocking edges, and current PRs.58 Freeze the graph; pause on tickets not ready-for-agent, missing edges, cycles, or a59 ticket without acceptance criteria.602. Resolve `validation`: the ticket's own validation line, else the project's61 documented check, else the package's `test`, `lint`, and `typecheck`62 scripts. Record the command; run it yourself after every mutating worker.63 Repeat the affected suite when a diff touches time, clocks, concurrency,64 ordering, or randomness: one green run cannot tell a passing test from a65 flaky one, and every PR stacked on a flaky head inherits the repair.663. Capture `ci_baseline` with the command in `references/pr-stack.md`. A PR67 failure named there is inherited, not caused, and never blocks this run;68 without it a red repository reads as a red ticket and strands the stack.694. Snapshot the approved artifacts once and write the run ledger. `resume`, or70 an existing ledger at start, reconciles it with BB, Git, GitHub, and the71 tracker before one next transition.725. Verify `bb-cli`, `implement`, `diagnosing-bugs`, `tdd`, `code-review`,73 `review-fix-loop`, `show-me`, `gh-axi`, and authenticated push and PR access.74 Leave unrelated source checkout changes untouched.7576## Start a ticket7778Choose the first ready ticket in published dependency order, then branch it so79each PR keeps a one-ticket diff. The first ticket branches from the target80branch. Each later ticket branches from the exact accepted head of the previous81ticket, and its PR targets that previous ticket branch. Create a managed82environment at that base and record `ticket-base`, `pr-base`, and83`ticket-branch`. A dirty or drifting base pauses the run.8485## Gates8687Planned behavior or a known fix uses `/implement`; a hard, unexplained,88intermittent, or performance defect uses `/diagnosing-bugs`. Implementation89must advance from `ticket-base`, pass required validation, and leave a clean90tree. Diagnosis also needs a tight red reproduction, supported cause, cleanup,91and a regression test at an approved seam; if no sound seam exists, record an92`/improve-codebase-architecture` follow-up instead of a shallow test.9394Apply `review-fix-loop` directly in this orchestrator at `ticket-base`; do not95spawn a loop coordinator. Write its `LOOP_GATE` into `tickets.<id>.loop.gate`,96then require `LOOP_GATE.verdict: PASS` recorded there, zero open confirmed97findings, required validation, and a clean tree. A skipped Spec, a paused loop,98or an absent verdict blocks the PR: an unwritten gate is a skipped gate, and99neither a finished loop nor a zero burden says which axes ran.100101Before opening the PR, reconcile every acceptance criterion and prove102`pr-base...HEAD` contains only this ticket. After creation, verify its remote103head equals the reviewed `HEAD`, its base is `pr-base`, and its URL is recorded,104then follow `references/pr-stack.md`: record the checks, mark the PR ready once105it passes net of `ci_baseline`, and pause on a failing check the ticket broke.106Set the tracker to `in review` and start the next ticket in a new environment.107If push or PR creation fails, pause first. An older single-branch run instead108follows `references/recovery.md`.109110## Finish111112Report ticket order, bases, environments, branches, commits, validation,113review-fix results, check status, tracker state, and the ordered PR stack.114Every accepted ticket must have one PR URL. End with one landable line:115`LANDABLE: yes` when every ticket is accepted with a green PR, or116`LANDABLE: no, <pr> <reason>` naming the first PR that blocks it. On `yes`, run117`/land-stack` when `--land` was given; otherwise tell the user that one command118merges the stack, closes the tickets, and removes the worktrees.