SuperAPI AI Directory

implement-batch

Agents & models

View repository

Updated 10-16 09:58

About this skill

Implement batch

One ticket at a time: a builder subagent implements it, you review it, a fixer subagent amends what the review blocks on. The review sits with you because it checks the builder's own context, and code-review needs a committed diff and a fixed point only you hold. The pre-flight is the only stop — the user's last moment at the keyboard.

A ticket is the tracker's issue — same thing, one word. The tracker is whatever docs/agents/issue-tracker.md describes; every ticket operation — locate, read, blocked-by, comment, close — follows it. Without the file, fall back to local markdown: .scratch/<feature>/issues/<NN>-<slug>.md, Status: line, ## Comments, Blocked by: line. Comments posted to a shared tracker open with > *This was generated by AI during an implement-batch run.* — relayed pre-flight answers instead with > *The user's pre-flight answer, relayed by AI.*

A gate is a run-level precondition; failing one ends the run, reported per step 7. A failing ticket parks: its commit, if any, moves to a failed/<ticket> branch, the working branch resets to its baseSha, tickets whose blocker chain passes through it log as skipped, the run continues.

The run log — <tickets-dir>/../run-log.md for a local tracker, .scratch/implement-batch-run-log.md otherwise — holds one row per ticket: outcome (done, failed, skipped), commit SHA or parked branch, findings fixed, findings carried. Written as you go, readable cold without the conversation.

Arguments select tickets: a range (09-14), a list (09,11,12), a tickets-directory path, or all/empty — every open ticket marked agent-ready (ready-for-agent label or Status: line).

1. Build the queue

Select per the tracker doc and arguments. Drop what's done — closed, marked done, or git log --oneline shows its commit.

Order blockers-first: topological sort on each ticket's blocked-by as the tracker records it, ticket number breaking ties. A ticket whose blocker is neither done nor queued drops out with its dependents, logged as skipped naming the blocker; a selection emptied this way stops the run — say which blockers hold it shut.

Cap the queue at twelve — steps 4 and 5 return their reports into this window and a longer run dulls the review axis; the run log hands over the rest.

For a local tracker, git check-ignore on the tickets directory sets the write mode: ignored — ticket edits stay out of git; tracked — pre-flight clarifications land as one chore commit closing step 2, and each status edit commits in step 6.

Gate: working tree clean, branch not the default.

Done when the queue is ordered and the gate holds.

2. Pre-flight

Read every queued ticket end to end. Collect what a builder would otherwise invent: acceptance criteria with no observable outcome, deferred decisions, requirements with two readings, files or symbols that don't exist — plus any operation the tracker doc leaves undefined (a blocked-by convention, a done state).

Ask via AskUserQuestion, as few passes as the four-question limit allows. Ticket answers post to their ticket as comments — the ticket is the spec source step 4 reads back, so a clarification the reviewer can't see returns as a Spec finding. Tracker answers append to docs/agents/issue-tracker.md so no later run re-asks.

Nothing unclear is a fine result — say so.

State the ordered queue and that the run goes unattended — it survives only what the permission mode pre-approves: edits, tracker commands, the repo's check commands. Then start.

Done when every answer is written where it lives and the user has seen the queue and the unattended note.

3. Build

Steps 3–6 run per ticket, in queue order.

Record baseSha = git rev-parse HEAD. Spawn one synchronous builder (run_in_background: false, one at a time) with the full ticket text and comments, its reference, the feature spec path if any, and:

Implement the work described in this ticket, and only this ticket. Use tdd where possible, at the seams the ticket names. Run typechecking regularly, single test files regularly, and the full test suite once at the end. Leave the work as exactly one commit on the current branch, its message naming the ticket — no close keywords. Stop there; do not push.

Afterwards git status --porcelain must be empty and git log baseSha..HEAD exactly one commit; anything else parks the ticket.

Done when the check holds or the ticket is parked.

4. Review

Invoke code-review with baseSha as the fixed point and the ticket — path or fetched content, per the tracker — as the spec source.

Done when its Standards and Spec reports are both back.

5. Triage

Every finding lands in exactly one bucket:

  • Blocking — a documented repo standard breached, the diff missing or contradicting something the ticket requires, or a defect demonstrated with a concrete failing case — even in behaviour the ticket never spelled out.
  • Carried — judgement calls and scope creep; these travel to the run log as-is.

Nothing blocking → step 6. Otherwise spawn a fixer — fresh, not the builder, whose context the review just checked — with the ticket text, the commit SHA, and the blocking findings alone:

Address these review findings on the commit shown, changing only what they call for. Re-run typechecking and the full test suite. Amend into that commit (git commit --amend --no-edit). Do not push.

Re-run step 4 against the same baseSha. One fix round per ticket. A blocking finding that survives the second review parks the ticket — post the surviving findings to it as a comment first.

Done when every finding is bucketed and the ticket has cleared review or parked.

6. Close

Close the ticket the way the tracker says — issue closed with a what-landed comment, or Status: done with criteria ticked; that state is what a re-run reads as done. Tracked-local mode commits the status edit. Append the ticket's run-log row, then take the next ticket from step 3.

Done when the tracker shows the ticket done and its row is written.

7. Report

Finish — queue emptied or gate failed — with the run-log table, what remains, tickets skipped for an out-of-queue blocker, failed/* branches awaiting a human, and that the branch is unpushed. On a gate failure: where it stopped, what it saw, the one thing that unblocks a re-run.

Done when every ticket that ran has a row and the user has the summary.