Skip to content
Back to skills

Spec Tdd Task Loop

ASecurity

Use when driving a whole MULTI-TASK feature phase — a task plan split into many self-contained task docs, run one task at a time with per-task commits, a plan-doc status board, and sessions that must survive the phase. The main session stays a LIGHTWEIGHT gate (compile + `git diff --stat` + JUnit-XML number recheck — never deep review, never running the tests itself); each task dispatches a level-1 sub-agent that runs the spec-tdd-escalate/tier machinery and itself dispatches the nested imple...

  • 3 stars
  • 0 votes
  • 0 copies
  • 9 views
  • Added September 21, 2026
ai-agentsgojavashellbashsqltestinggitapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned November 29, 2026

npx -y skills add BenjaminChenLab/spec-tdd-skill --skill spec-tdd-task-loop --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spec Tdd Task Loop?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spec Tdd Task Loop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/benjaminchenlab-spec-tdd-task-loop/badge)](https://www.skillsdirectory.com/skills/benjaminchenlab-spec-tdd-task-loop)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: spec-tdd-task-loop
description: Use when driving a whole MULTI-TASK feature phase — a task plan split into many self-contained task docs, run one task at a time with per-task commits, a plan-doc status board, and sessions that must survive the phase. The main session stays a LIGHTWEIGHT gate (compile + `git diff --stat` + JUnit-XML number recheck — never deep review, never running the tests itself); each task dispatches a level-1 sub-agent that runs the spec-tdd-escalate/tier machinery and itself dispatches the nested implementer (no self-testing — requires CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=3). Covers mock-first contract phases (the time dimension of tier choice), mid-run tier downgrades delivered by SendMessage, and resuming a half-finished task after a session break. Triggers on task loop, task-by-task spec-tdd, multi-task orchestration, per-task commit cadence, plan status board, not-yet-split requirement/blueprint needing task breakdown, multi-task loop.
---

# spec-tdd-task-loop

**REQUIRED BACKGROUND:** Understand the `spec-tdd` family first — the front-ends (`grill-spec-tdd`, `spec-tdd-escalate`), the tiers (`spec-tdd-lite` / `spec-tdd` / `spec-tdd-coverage` / `spec-tdd-adversarial`), and [PROTOCOL.md](../PROTOCOL.md) (I1–I22 / A1–A16). This skill adds no new invariant and relaxes none: each task's execution is still fully carried out by the tier machinery (**band caveat**: the lite floor is a compensated strengthening — a mandatory fresh review; the standard ceiling is a structural non-carriage grounded in economics — coverage evidence concentrates in the phase-end total pass (the closing section), adversarial-grade units in the pull-out escape hatch — not an invariant change); what this file defines is the loop rules layered on the **outside** of the whole family — the three-layer division of labor, the lightweight gate, number recheck, mock-first, resume, and disclosure.

## Overview

A multi-task phase: one master task table, one self-contained doc per task, task-by-task development and commit, possibly spanning multiple sessions. **The top-level context is the scarcest resource of the whole phase** — the only thing that must live from start to end is it. So all deep work (acceptance-test writing, encoding audit, implementation, attack rounds) sinks into disposable sub-agent contexts; the top does only two kinds of things:

1. **Cross-task state management** — pick tasks, maintain the authoritative plan doc's status section and decisions section, write decisions back, one commit per task.
2. **The lightweight gate** — verify only "objectively checkable facts": compile, file scope, test numbers. Each item is machine-comparable; it needs neither taste nor level-1's full context.

| Layer | Who | Does | Forbidden |
|---|---|---|---|
| Top-level orchestrator | the main session (program conductor) | cross-task flow, the lightweight gate, status-section upkeep, decision write-back, commits | deep code review, running the tests itself, writing acceptance tests, implementing |
| level-1 sub-agent (**TOP**, I19; **eco exception — all MID + a TOP final audit per card, see the dedicated section**) | the spec-tdd orchestrator for ONE task (runs the escalate machinery) | write the acceptance test (RED), encoding audit, dispatch level-2, verify personally (re-run / coverage / hash), tier-required attack rounds; the lite route: solo implementation + a fresh-context review dispatch (that tier's own mechanical shape) | implementing production code itself (non-lite tiers — exception per the template's TIER BAND), git writes |
| level-2 implementer (**MID**, I19) | the implementer | implement to green + its own unit tests | touching the acceptance test (hash-locked), git writes |

**Coverage and adversarial are not carried inside the loop per-task** (see Pre-flight 3's tier band): adversarial-grade units are **pulled out of the loop and run standalone — the standalone run launches only on the user's recorded I22 authorization** (the Phase 0 sniff pre-pulls; its pull-out list rides the double-consent gate's ask — a decline runs the card in-loop at the band tier with an adversarial-debt board row, a consented downgrade; a routing-point discovery mid-loop STOPs and reports immediately, the report IS the ask — I22's fallback); coverage-grade units stay in-loop at the standard tier, booked on the **coverage-priority list** (a board section) — the phase-end total-coverage pass (the closing section) is their convergence point, attacked first.

**Why self-testing is banned (one agent writing code + tests + judging itself): circular reasoning.** The implementer's blind spots enter both the code and the test simultaneously; green becomes self-fulfilling. Separating implementer and orchestrator means the acceptance test is locked by a different context before the implementation exists — hash-locking the acceptance test, bit-identical verification before and after dispatch (I4, executed at level-1). This is the reason the whole family exists. In the task loop, tiers above lite are equally non-negotiable; **lite's solo mode is the entry tier's known trade, available again inside the loop since v1.20.0** (the compensation = a mandatory fresh-context review dispatch — loop economics settled: small cards don't pay the two-context tax); **if level-1 cannot dispatch nested dispatches (lite's review dispatch counts too), the only legal action is to stop and report — never degrade into unreviewed self-testing.**

## Eco mode (the `eco` flag — the supervisor-shaped per-card economics mode, opt-in trial)

Active when args contain the token `eco` (stripped from the phase description); **runs without the token are byte-identical to before and never read further here**. **With the token (or under task-dag, whose REQUIRED BASE inherits this in full): read `references/eco-mode.md` NOW and follow it in full** — the per-card all-MID dispatch economics, the TOP read-only final-audit close step (brief contents, checklist, evidence rules), the findings loop + the audit-ledger inheritance + the close order, what does not change, and the recorded trial knobs. The dispatch template's MODEL PIN block (above) and the lightweight gate's eco close step (below) stay inline — they bind at their flow positions.

## When to Use

- A feature phase split into many tasks (typically 5+), one self-contained doc per task, developed and committed task by task.
- Expected to span multiple sessions, with context compaction or breaks → needs the status section + the half-finished-task resume mode.
- An authoritative plan doc exists (single source of truth: requirement + decisions section + task-table status section).
- Entering with only a settled requirement or a plan/blueprint, not yet split into a task table + task docs → run Phase 0 first (the table is the trace base for resume / rollback / write-back).
- Upstream dependencies (external API, another team's service) unsettled → mock-first contract development (see the dedicated section).

**When NOT to use:**
- A single task / single feature → go straight to `/spec-tdd-escalate` (or pick a tier manually); the main session orchestrates itself; the outer loop is overhead.
- A live-testing small-fix stream (one or a handful of small wiring/cosmetic/config fixes while the user keeps testing) → `spec-tdd-quickfix` — no task table, no per-task commits; the one-sentence fix plan + the user's go is the gate.
- Clearing a batch of independent small bugs at once → `spec-tdd`'s **multi-unit run** (loops units within one session; the boundary is the unit — no per-task commits, no cross-session state).
- Time-sensitive with a genuinely parallel DAG structure (not a chain) → `spec-tdd-task-dag` (the parallel overlay — and the manager's multi-task route since v1.33.0; this skill remains the directly-invocable bare serial mode; inside dag, serial is a mode choice, not a different driver).
- Exploratory / throwaway code → no skill needed.

## Phase 0 — task breakdown (entering with the task table un-split)

On entry, if there is only a settled requirement or a plan/blueprint, **not yet split into a task table + self-contained task docs** → run this section first; only enter Pre-flight after the control documents exist. If the trio is already there → skip. Rationale: the status section is the trace base for breakpoint resume, the task boundary is the rollback unit, the decisions section is the home for decision write-back — **a breakdown that lives only in the conversation = not broken down** (the spirit of I17); nothing landed on disk means resume / rollback / write-back have nothing to stand on.

**Entry quickfix check (before any breakdown):** the incoming work is a live-testing small-fix stream (the user live-testing the product; wiring/cosmetic/config fixes below lite's test-first cycle; outside quickfix's exclusions) → one-line suggestion `spec-tdd-quickfix`, the user's call — never break a task table out of what the floor tier exists for. This check is task-dag's too — its REQUIRED BASE makes this section its substrate.

1. **Settlement check (I20 sniff).** Scan the requirement for decision gaps (unbound quantities, either-or choices left open, TODO/TBD): gaps found → route to the grill front-end to talk them through — don't fill holes here; clean → proceed.
2. **Breakdown (top-authored — I19(a): planning never sinks).** The top reads the settled requirement / blueprint + inventories codebase anchors (a read-only Explore may run the recon), producing: (a) the authoritative plan-doc trio (Pre-flight 5's format) — the requirement body, the decisions section (existing discussion decisions settled as D1… with numbering continued), the task-table status section (all pending); (b) one self-contained doc per task (Pre-flight 6's fields). Granularity principle: **one task, one thing** — task boundary = commit boundary = rollback unit; wrong granularity deforms the rollback unit. **Granularity is bidirectional and carries a merge bias (v1.38.0, field 2026-11-02: a shared-file cut chained two logically independent cards serially, and piles of small units pay the card machinery ×N for no rollback gain). The machinery tax is per card** — every card pays a dispatch, the gate, a commit, the eco final audit, and a board row; a cluster of small adjacent units runs FASTER as ONE card (one dispatch doing them together — the closing review's merged-light-row shape) than as N cards. **Split only on a trigger**: (a) independently meaningful rollback (one would ever be reverted without the other); (b) different blast-radius classes (mixing drags verification up or forces a mid-card pull-out); (c) budget feasibility (the combined verification plan exceeds one card's budget); (d) a parallelizability win that outweighs the extra card's tax (a wide wave earns it; a two-card tail does not). No trigger → merge. **The single-writer check — every deliverable file has exactly ONE owner task.** A file two tasks both write is a boundary signal resolved BEFORE the table freezes: merge the two tasks (preferred when small); extract the shared part as its own upstream task (the consumers become file-disjoint and parallelizable — only when the wave is wide enough to pay the extra card); or pin one task consumer-only against the other's contract (the file named in exactly one deliverable list). The pick is weighed and disclosed. **Structural multi-writer files are the weigh's own shape, not its failure (per audit v1.38.0): a shared append-only schema/DDL file that every DB task extends honestly weighs out as "keep the pair — the natural serial edge, disclosed" — never a forced merge; under dag a same-wave share of an append-only file remains a disclosed DEVIATION from disjointness, never the sanctioned outcome (per re-audit F1, v1.38.1: the field pair survived on append-position luck)** (field: two cards both listing `db/envInit/01_schema.sql` shared a wave; the check's job is that the weigh HAPPENED, not that every overlap dissolves). **Single-dispatch-scale (definition — cited by task-dag's right-sized tail and the manager's small-phase escape): a card whose whole verification plan fits ONE dispatch's budget at its band's tier (the in-loop ceiling = standard) — small-to-medium, not a multi-dispatch chain.** **Critical-surface sniff (default ON)**: during breakdown, sweep all task concepts with the stakes predicate — applying the money-adjacent carve-out while sweeping: a unit that only READS the money system (recheck/lookup sweeps, display, reporting) is coverage-grade (booked on the list below), never a pull-out; "touches money" alone never pulls (field 2026-11-02: a read-only auto-recheck feature). Adversarial-grade tasks get **pulled out of the loop** before it starts (the table marks them pulled/external, run standalone on the user's recorded I22 authorization — the pull-out list is the double-consent gate's authorization ask; a decline runs the card in-band + an adversarial-debt board row; commits still land at task boundaries, the gate still checks report evidence) — a silent downgrade has no source of consent, and so does a silent standalone launch. Coverage-grade tasks (branch-evidence stakes, not blast-radius-critical) stay in-loop at the standard tier and are booked on the **coverage-priority list** (a board section: card ids + the stakes note) — the phase-end total-coverage pass attacks those cards first. **Budget size feasibility**: each task's wall-clock budget must exceed its verification plan's total build time (planned run count × full-suite duration); if impossible → split the task or raise the budget (see the watchdog section).
3. **Fresh-context plan review (independent sub-agent, TOP).** Dispatch a sub-agent that did not write the plan to attack it: requirement coverage (every requirement has a task), missing tasks, dependency order, task-doc self-containment (missing contract fields), granularity deformation (one task stuffing many things / cut pointlessly fine — the v1.38.0 rubric's merge bias and single-writer check are the concrete probes). Findings → the top fixes → **the SAME reviewer re-audits** (bounded: audit + one re-audit, the I16 convention). The brief carries the standing file-tools rule verbatim: local files are read ONLY with Read/Glob/Grep (Bash cat as fallback); NEVER open file:// URLs with any browser tool (Playwright MCP, webReader, or similar); if native file tools seem missing or unloadable, STOP and report back 'missing file tools' — never improvise with a browser.
4. **Double-consent gate.** Reviewer converged (no findings) + top sign-off → enter Pre-flight; the task table is surfaced together with Pre-flight's existing asks (no separate gate) — plus, when the sniff pulled any adversarial-grade cards, the I22 authorization ask for their standalone runs (**v1.43.0 in-principle ban: park-as-to-do is the recommended option — proceeding requires the user's own very-good-reason statement and time/token headroom**; a decline = in-band run + adversarial-debt board row). Unresolved findings after the re-audit → escalate to the user; never start the loop with an unconverged breakdown.

## Pre-flight

**Pre-ruled entry rulings (v1.31.0).** Entry may arrive with pre-ruled unattended rulings aboard — a manager going-dark gate's batched rulings carried on the `<phase>` hand-off. The asks they cover (this skill's session commit authorization, item 2; the I22 pull-out authorization for adversarial-grade cards — a grant pre-rules the standalone runs, a denial pre-rules the in-band run + debt row) are treated as answered, never re-asked; the tier disclosure (item 1) needs no ruling — it never asks (v1.41.0). The status section's opening rows disclose which asks were pre-ruled and by which gate. Those rulings cover THIS absence only — per-window, never carrying over (GOING-DARK item 1's shape).

1. **Orchestrator tier disclosure (I21 — never asks, never stops).** Before any work, check the model THIS session runs as. A run's judgment executes entirely in the orchestrator's own context; I19 pins every dispatch tier, but nothing can upgrade the session itself. **The check never asks and never stops** (maintainer ruling 2026-11-25): **top tier — or any tier above it — in use, or no higher tier exists → silent, move on.** (Tier map, maintainer ruling 2026-10-13: TOP = the top workhorse tier — opus-class; the flagship-experimental tier above it, fable-class, is never required for a pin.) A non-top session → ONE announcement line — "non-top session — proceeding at this tier; disclosed in the phase report" — then continue; the run never sits waiting on a tier answer. This skill's gate is light, but the level-1 dispatch must be TOP (it inherits all the planning / verification judgment) — if the top-level session itself runs a mid tier, the whole phase's routing and review judgment rides on mid too, which is exactly what the announcement names.
2. **Session commit authorization (asked once before the loop starts).** Task boundary = commit boundary is this skill's rollback design, but commit authority is always the user's — ask once explicitly before the loop starts: "Does this session authorize the top to commit at every task boundary?" **Authorized** → after the gate passes, the top commits directly (still listing file names explicitly; push is not covered by this authorization). **Not authorized** → the boundary is not skipped: at every task boundary pause, list that commit's file manifest for the user to execute manually, and record the user-reported hash in the status section — the rollback unit is unchanged, only the executor changes.
3. **Tier band (structural, not policy, not an ask).** The in-loop tier band = **lite … spec-tdd** (user ruling 2026-10-25): escalate routing runs unchanged inside the band (including lite — the solo + fresh-review shape for small cards; the v1.18.1 in-loop lite ban was reversed as of v1.20.0: small cards don't pay the two-context tax). **Coverage and adversarial are structurally not carried per-task**: per-card coverage multiplies the family's most expensive common tier ×N while seeing each card in isolation — coverage evidence belongs to the phase-wide union, so it lands ONCE in the phase-end total-coverage pass (the closing section); coverage-grade cards stay in-loop at the standard tier, booked on the **coverage-priority list** (their convergence point = the end pass, attacked first). Adversarial-grade units keep the **pull-out escape hatch** — the Phase 0 sniff pre-pulls and the double-consent gate carries the I22 authorization (a decline = in-band + the debt row; **v1.43.0: the pull-out ask recommends park-as-to-do — proceeding requires the user's own very-good-reason statement and time/token headroom**); a level-1 whose routing discovers stakes above the band (before implementing) → STOP and report, the top pulls it out on the user's recorded authorization, **never silently below the deserved reading**. The user mid-run demanding adversarial for some critical task → same pull-out; in-loop unlocking does not exist.
4. **Nested spawn depth check.** The default spawn depth limit leaves the level-1 sub-agent without the Agent tool → it cannot dispatch level-2. Fix: environment variable **`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=3`**, set in the top-level session's launch environment (somewhere the harness reads — the settings env block or the launching shell's environment; exporting inside some Bash call cannot affect the parent that spawns sub-agents). Verification: the dispatch template carries "if you have no Agent tool, STOP and report immediately" — if it reports having the tool on the first task, the setting is live.
5. **Authoritative documents in place.** Before the phase starts, confirm the trio exists: (a) the requirement body; (b) the **decisions section** — numbered decisions (D1, D2…); new decisions **continue the numbering**, never renumber or renumber over; (c) the **task-table status section** — one row per task: id + plain-language name + status (pending / in-flight / done + commit hash) + one evidence pointer. Missing → back to Phase 0 to produce them; never improvise a start (using a blueprint directly as the plan, or splitting verbally and running, are both improvisation).
6. **Task-doc self-containment check.** One self-contained doc per task — the sub-agent must be able to work without opening other documents. Required fields:
   - goal and scope (with explicit **non-goals**);
   - current-state anchors: file:line (line numbers drift — also give method/symbol names as anchors);
   - design notes;
   - **the complete external contract given in full at once** — full DDL text, API shapes, interface signatures; writing "same as the previous case" or "see the requirements doc" is banned;
   - **the deliverable file list** — files this task will produce / modify; mandatory and exhaustive for pure-docs tasks (the input the lightweight gate's item 5 checks against);
   - **cross-task calls** — every contract this task consumes that another task produces (by producer task id + the consumed symbol/endpoint/DDL; empty = none) — a REQUIRED field since v1.38.1 (per audit: the call-edge cross-read, the S4 decomposition probe, and the false-parallel review class all consumed voluntary prose naming; a doc phrasing it as "adopt on found" silently defeated all three). Prose naming elsewhere does NOT count as declared — the field is the single declared input; a call found in prose but absent from the field is a doc defect, fixed by filling the field.
   - acceptance criteria (behavior descriptions convertible into an acceptance test);
   - risks and rollback.

## The loop (one round per task)

**At loop start the top announces the phase estimate** — total wall-clock (cards × per-card tier estimate + gate/review/commit overhead) and a per-card rough number, intervals while calibration is thin; the board's rows carry the running state thereafter — no per-card announcements (noise, not signal). **The estimate is never the budget** (watchdog rule 4).

1. **Pick a task + verify anchors.** Take the next per the table's dependency order; after the previous task lands, its file:line anchors drift — quickly verify the doc's anchors still hold, fix the doc first if not (re-anchor by method name). Mark the row in-flight.
2. **Dispatch level-1 (TOP).** Use the template below. Path shorthands inside the doc must be **restored to absolute paths** in the prompt (the sub-agent's cwd cannot be relied on); the template's `{family root}` likewise — fill the absolute path of the skill family's install location; the template's **SCRATCH ROOT** field gets this run's absolute scratch root path (the convention = repo root). Record the dispatch time and delivery class into the status section's in-flight row (the watchdog's arming baseline — see the dedicated section).
3. **After the report, run the lightweight gate** (next section). Gate fails → re-dispatch with **objective evidence** (full compile error text, out-of-list files, XML number mismatches); the three-bucket routing (I10) is level-1's internal business — the top only relays facts, never judges in its place. The re-dispatch prefers SendMessage-resume of the same level-1 (its context is the cheapest corrector); a fresh chain only when unresumable — the findings loop's shape, so the gate-failure path stops being a standing exception to it (per audit v1.37.0).
4. **Decision write-back + status-section update.** Business decisions the user makes during a task are written **immediately** into the authoritative doc's decisions section (numbering continued) and the relevant task doc updated — the old plan gets struck through for the record, never deleted outright. A decision that lives only in the conversation = did not happen (sessions get cleared / compacted).
5. **Commit (top-exclusive, per pre-flight authorization).** **List file names explicitly**; `git add -A` / `git add .` strictly banned — the working directory always contains sub-agent untracked scratch (`.spec-tdd/` etc.) that would be swallowed into the commit. **This round's authoritative plan-doc updates (status section, new decisions) ride the SAME commit as the task doc's changes** — rolling back a task then rolls back its status row and decision record too, so the status section never claims a restored task is done. One-line subject. Task boundary = commit boundary = rollback unit. Record the commit hash in the status row.

### Level-1 dispatch template

```
ROLE: You are the spec-tdd orchestrator for ONE task of a multi-task phase.
Run the spec-tdd-escalate machinery for THIS task only: pick the tier by
stakes, write the acceptance test (RED, RED-purity checked), dispatch a
NESTED implementer via the Agent tool, and verify it yourself (re-run GREEN,
hash check, tier-required verification). Invoke the /spec-tdd-escalate skill
BY NAME if it is available in your runtime. If it is not, do NOT improvise
a lighter version from this prompt — read FAMILY FILES below and run that
machinery exactly.

MODEL PIN — MODE: {default | eco}. default: you run TOP and your
implementer is level-2 MID (I19); your encoding-audit / fresh-review
dispatch is TOP (I19(a)). eco: you AND every dispatch you make
(encoding audit, lite fresh reviewer, implementer) run the MID tier —
name it explicitly in every Agent call, never let one silently inherit
the session model. The judgment backstop is a TOP-tier read-only
final-audit dispatch the TOP-LEVEL session runs over your deliverable
at task close, before commit — you never see it, and it changes
nothing in your machinery. ORCHESTRATOR TIER CHECK — PRE-RESOLVED
under eco (all-MID machinery with a TOP final-audit backstop; the
check never asks anywhere, v1.41.0): do NOT stop to ask about
upgrading; carry "session tier disclosed (eco all-MID opt-in, at
invocation)" into your report disclosures. eco adds one
RETURN duty: WRITE your full RETURN report to
.spec-tdd/<task>/REPORT.md (SCRATCH ROOT-anchored) — the final audit's
brief references it by path, and it is the audit-phase resume
substrate.

No self-testing OUTSIDE the lite tier. Same-context test+implementation is
circular reasoning: the implementer's blind spots enter both the code and
the test, and green becomes self-fulfilling — which is why every tier above
lite dispatches a separate implementer, and why lite (the entry tier for
small non-critical units) compensates with a MANDATORY fresh-context review
dispatch over its test+implementation. If your escalate routing selects
lite, run the lite machinery exactly, including that review dispatch. If
you have no Agent tool, STOP and report that fact — do NOT fall back to
implementing yourself (the review dispatch needs the tool too).

TASK DOC: {absolute path} — READ IT FIRST; it is self-contained (goal,
scope, current-state anchors, design notes, full contract incl. DDL,
acceptance criteria, risks, rollback). Doc path shorthand maps to:
{abbreviation → absolute path}.

SCRATCH ROOT: {absolute path} — paste-verbatim anchor for EVERY
`.spec-tdd/` path in this prompt (repo root; under task-dag's wave
reuse, the assigned worktree root).

FAMILY FILES (if the skill is not invocable in your runtime, READ these
from disk and follow them — the machinery lives there, not in this prompt):
{family root}/skills/spec-tdd-escalate/SKILL.md (the routing you run),
{family root}/skills/PROTOCOL.md (invariants I1–I22), and the chosen
tier's {family root}/skills/<tier-name>/SKILL.md.

FILE TOOLS (standing rule, carries into every nested brief you compose):
local files are read ONLY with Read/Glob/Grep (Bash cat as fallback); NEVER open file:// URLs with any browser tool (Playwright MCP, webReader, or similar); if native file tools seem missing or unloadable, STOP and report back 'missing file tools' — never improvise with a browser

TEST-RUN DIET (standing rule, carries into every nested brief you
compose): run only the RELATED test classes per cycle, never the whole
suite mid-cycle (e.g. ./gradlew :Core:test --tests 'FooTest'
--tests 'BarTest' — your build's equivalent); compress run output
(-q --console=plain, redirect stdout+stderr to a scratch file and tail
it — a bare pipe swallows the exit code); failure facts come from the
JUnit XML summary numbers, never from full console dumps; the FINAL
verification stays ONE run covering all related test classes (that
round's XML is the only recheckable one).

DOC EDITS: report proposed task-doc / plan-doc changes; do not edit the
authoritative plan doc yourself — the top-level session owns decision
writeback.

SCOPE: this task only. Prior tasks' acceptance tests are the regression
wall: adapt one only where this task's contract evolution forces it — one
file at a time, assertion SEMANTICS unchanged, each adaptation listed in
your report with its rationale.

GIT: NO git write operations (add/commit/stash/checkout/restore/...). The
top-level session owns all commits. Read-only git (status/diff/hash-object)
is fine.

TIER BAND: lite … spec-tdd — the loop's structural band. Your escalate
routing runs UNCHANGED inside it, including lite (small non-critical
tasks: solo author-implementer plus ONE fresh-context review dispatch —
the lite machinery's own shape; disclose the tier used). The CEILING is
structural: coverage and adversarial are not carried per-task (per-card
coverage multiplies the expensive tier ×N; phase-wide coverage evidence
lands ONCE in the phase-end total-coverage pass the top runs at close —
a coverage-graded task here runs at spec-tdd, the standard tier, and the
top books it on the coverage-priority list). A task whose stakes would
route ABOVE spec-tdd: STOP and report BEFORE implementing — and the
report FIRST works the money-adjacent carve-out: a unit that only READS
the money system (recheck/lookup sweeps, display, reporting) is NOT
above-band — it stays here at the standard tier, booked on the
coverage-priority list; only MOVE-money / CHANGE-auth / IRREVERSIBLY-
corrupt-on-silent-wrongness pulls out standalone (adversarial-grade —
the standalone run fires only on the user's recorded authorization
(I22, asked at the loop's consent gate); you never launch it yourself —
STOP and report is your only move).
"It touches money" alone never pulls a task (field 2026-11-02: a
read-only auto-recheck over-triggered the pull-out). (Pure-docs tasks excepted — no acceptance test to
write, the tier machinery does not apply; see the loop's gate item 5.)

MOCK PHASE: {yes/no}. If yes: the contract target is the mock established
by task {id}; reduced verification depth is user-approved for mock-phase
tasks; disclose the tier actually used.

PHASE BOUNDARIES (before/after each nested dispatch, when ENTERING a wait
on a nested dispatch, after each completed long tool run, after each
delivered file): 1) touch `.spec-tdd/<task>/HEARTBEAT` (create the
directory if missing; touch or an equivalent write) — when the touch
coincides with entering a wait, write into the file: "waiting: <child-id>
expected-done <time>"; 2) re-read `.spec-tdd/POLICY-<task>.md` — ABSENT
means ONLY a confirmed file-not-found (e.g. `test -f` fails); any OTHER
read error is a STOP, not "no policy"; a PRESENT file overrides TIER
BAND above, DOWNGRADE-ONLY (raising waits for the next task boundary);
3) PATH RULE (every `.spec-tdd/` path in this prompt — the touch, the
POLICY re-read, every scratch write, incl. RETURN's logs): form it by
prefixing SCRATCH ROOT from your brief, joined with a `/`, PASTED
VERBATIM — never retype it, never resolve it against your own cwd, never
hand-compose any other absolute form; mkdir -p plus output-redirect makes
a typo'd absolute path silently succeed, materializing a parallel tree
whose heartbeat the watchdog never sees (2026-09-18 W22 incident).
Before the first such write: `git rev-parse --show-toplevel` must equal
SCRATCH ROOT — a mismatch is a STOP-and-report, never a best-effort
guess. Carry SCRATCH ROOT, this PATH RULE, and the FILE TOOLS rule
verbatim into every nested brief you compose (implementer, reviewer,
attacker): their templates' `.spec-tdd/` shorthand is anchored by YOUR
pasted root, never their own cwd.

NESTED DISPATCHES (any nested child — your implementer on tiers above
lite; your fresh-context reviewer on lite): dispatch each nested child in
BACKGROUND mode — a blocking Agent call makes you unreachable and
unmonitorable, and its never returning is NOT evidence the child lives (a
child's death is silent to you). Record the expected duration with each
dispatch (floor it at the known build cost of the affected files); on
overtime with no fresh output from the child (worktree / build outputs),
treat the child as dead: TaskStop it first (a presumed death is not a
confirmed one — two agents must never write the same tree; clear
build-process locks, e.g. stale daemons, before re-dispatching), then
re-dispatch: a CONTINUATION implementer on its partial work; for a dead
lite reviewer, a FRESH reviewer — its judgment depends on fresh context,
nothing is inherited (same re-dispatch-cost disclosure shape as the
closing review). Harness without background nested dispatch: disclose
the degradation (the top's budget backstops).

VERIFICATION REPORTING (your numbers will be independently rechecked):
  - FINAL verification = ONE gradle run covering ALL related test classes —
    each run CLOBBERS the previous JUnit XML, so only the last run survives
    for recheck.
  - Report per-class numbers read from build/test-results/test/*.xml, and
    state whether counts are @Test METHODS or EXECUTED INVOCATIONS
    (@ParameterizedTest: 1 method = N invocations).

RETURN: 1) one status line per command (command + pass/fail counts), full
logs to scratch files under .spec-tdd/ (never committed; hand paths)
 2) per-class numbers  3) created/modified file list (absolute paths)
 4) disclosures: tier actually used (+ any mid-run downgrade or band
cap), deviations from the task doc (DDL deltas, mock placement,
naming/structure), locally decided rule details  5) prior-test adaptations
with per-file rationale.
```

## In-flight monitoring (anti-idle watchdog)

429 quota exhaustion plus silent death stacked together can burn a whole afternoon on one card. **Three failure modes**: hard-fail (429 terminates directly, with a notification — covered by the existing resume rules), soft-wedge (the inference request enters a backoff-retry loop: state perpetually `running`, zero notifications, transcript stops updating — zero external signal), zombie-wait (the nested child has died silently while the parent healthily waits on an Agent call that will never return — **an Agent call not returning ≠ the child alive**). Field record: three modes stacked, one card ~6 h, ~5 h zero output — slower than a human. **The ruling: zero-output duration is the first-class metric; "avoid idling" is a fundamental requirement, not a nice-to-have**; under same-tree serial code tasks, one card idling = the whole queue stalled (under task-dag, what stalls is the wave-end merge — siblings keep running — still legitimate, for a different reason). **This is process monitoring, not a verification act**: every signal is an objective fact, no content judgment.

1. **Arming (at dispatch, registering the delivery class).** Every background dispatch the top owns — each card's level-1, the Phase 0 plan-review, the closing batch review — at dispatch time: record the dispatch moment and **delivery class** into the status section's in-flight row (the board is a file; a broken session can re-arm from it), and ensure the **recurring watchdog ring** exists — ONE session-scoped recurring schedule per run (example default: every 15 min at an off-round minute, user-adjustable; subject to the harness's expiry policy — read the tool contract, disclose at creation), serving ALL in-flight items, never per-card (task-dag: per wave). **Create-if-missing + verified at EVERY dispatch** (CronList or equivalent; v1.32.1 — a lawful inter-card-gap stand-down, an expiry, or a crash must never leave the run uncovered; field 2026-10-21). The board's in-flight row carries: schedule identity + cadence + timezone + expiry + a **pending-next-action line** (decided-but-unexecuted actions live here, not in conversation — the ring's stand-down gate reads it). **Both layers are background dispatches** (top→level-1, level-1→nested): a blocking call makes the parent unreachable and unmonitorable — mid-run redirection, POLICY re-reads, and the watchdog itself all depend on the parent keeping tool rounds. **Delivery classes**: (i) **output-type** (code tasks) — real output = tree diff, test-results changes, deliberate task scratch the agent writes (reports / ledgers; the harness's background task files and transcripts don't count); (ii) **read-only-type** (plan-review, closing review) — zero tree output and zero builds are by design; real output = growth of heartbeat / scratch reports; applying the output-type formula to them guarantees false verdicts.
2. **Two axes and the cadence.** **Real-output age** (time since the last real output) and the **wall-clock budget** (tier-derived example defaults: lite 30 / spec-tdd 60 min — environment-calibrated values, user-adjustable; read-only-type budget = the expected duration stated at dispatch). The cadence substrate (v1.32.1, maintainer ruling): **ONE session-scoped RECURRING schedule** — it re-fires every interval **with no successful turn in between** (trial-verified 2026-10-21: rings re-fired after ring turns took zero scheduling action; the one-shot chain's re-arm premise — "if it fires, I can schedule another" — collapses on the first 429, field-proven ×2: 2026-09-11 W16, and 2026-10-21 where the last one-shot died into the pool with nothing pending through a 6-h reset window). A ring landing inside the exhaustion window = 0-second death, free (rejected requests burn no tokens — field n=1 + trial); the next interval still comes; the first landing after quota recovers = the top automatically regains control — the coverage the old far-fire layer approximated, now native. Rings fire only while the REPL is idle (the same constraint one-shots always had — not a regression); a wedged top is covered only by external levers (manual message, the durable point, the OS fallback). **The ring's prompt is the discipline carrier** (maintainer ruling, v1.32.1): self-contained, self-retiring, carrying its OWN schedule id and the skill-file path, and this standing checklist — (1) read the current wall clock first; (2) agent list + board reconcile (in-flight rows + pending-next-action); (3) verify OWN schedule exists (else re-arm + disclose) AND scan every other schedule for a named moment already past — a past moment → delete that schedule and act now (collect-and-resume per card; the v1.32.1 clock guard made recurring: field 2026-10-30, a ring's own successful turn armed a revival one-shot for a moment ~35 min past and nothing re-caught it for 47 min); (4) three-state judgment per the full procedure (skill-file path carried); (5) per-card budget vs the board; (6) stand-down iff agent list empty AND pending-next-action empty → delete OWN schedule (deletion verified) + clear leftovers. The schedule is **session-scoped, session-lived** (one ring serves all in-flight; cross-session recovery re-creates + verifies it at the resumed session's first dispatch, from the board's disclosure row). **The carve-out stands unchanged (field 2026-10-06): the reset+15 insurance point — and only it — arms DURABLE when the reset moment falls outside the session's expected attended life (announced absence: overnight, leaving, offline)**; a missed durable one-shot is surfaced for catch-up at the next session launch — the one recovery lever a session that dies unattended still has. **An agent's self-reported state NEVER resets the real-output clock** (field-proven: the zombie parent's "implementer running" was proven wrong — response content is not health evidence).
3. **Three-state judgment (bound to clocks, separate tolerances).** (a) **zombie-wait** — diagnosed only on the four-condition conjunct: signs of activity (fresh heartbeat or background files appearing; the ownership of background files judged against heartbeat content — could be children's output or the parent's probe residue), zero real output, build **output not advancing** (output-directory mtime rolling is the primary signal; process presence is only corroborating — an idle resident daemon like a gradle daemon lives idle for hours by default; presence ≠ activity), and the heartbeat-declared wait overdue (the waiting entry's expected-done has passed). High-confidence death, **15-min fast knife**; (b) **total freeze** — heartbeat / background files / build output all frozen: an ambiguous state (a single long reasoning request and a soft-wedge are externally indistinguishable), **long tolerance ~90 min** (example default, user-adjustable), the budget backstops; (c) **legitimate work** — real output flowing or build output advancing → re-arm. **Instantaneous signal shapes cannot distinguish zombie from a healthy in-phase wait** (a healthy parent waiting on the encoding audit hits the first three of the four conditions) — the overdue clock is the only discriminator; that is why the three states and the nested time-limit are one integrated design.
4. **Budget = hard cap (three rules).** Exceeded → terminate and re-dispatch, **no "wait a bit longer"**. But: (i) **one-time reset while flowing** — real output flowing at the moment of overrun → reset the budget once and disclose (a size mis-estimate is a plan defect, not an agent defect; once only, against indefinite extension); stalled → terminate immediately; (ii) **continuation re-dispatch re-budgets** — re-grant by the remaining scope after inventory (inheriting a burned-through budget = instant kill); (iii) **Phase 0 size feasibility** — the budget must exceed the task's verification plan's total build time; if impossible → split the task or raise the budget (already in Phase 0). **Re-dispatch cap 2** (I9's circuit-breaker shape); beyond that, escalate to the user. **The budget is a kill cap, never an expected duration**: the user-facing estimate announced at loop start rides its own basis (expected verification rounds × this repo's real build cost) and converges on the board as cards land — announcing the budget as an expectation imports the kill threshold into the user's calendar (field 2026-10-14: a pre-routing estimate read as an expectation ran ~4× under the actual, incl. a 429 tax).
5. **Diagnosed → the matching recovery (the recovery reference).** zombie → start with the revival attempt; total freeze → the soft-wedge procedure; reset moment known (any 429 message in the session names it) → additionally schedule a reset+15 insurance point. **Degradation ladder (the honest version)**: no scheduling mechanism — or the recurring schedule cannot be created/kept alive → the watchdog degrades to board budget records + best-effort checks at natural control points + disclosure; **only when re-dispatch is also unavailable** (all pools dead / harness broken) → the degraded closing of "the top runs the final verification itself" (see `references/recovery-and-resume.md`) — the last rung, not a convenience shortcut; the full recovery procedures (session break / 429 / soft-wedge / zombie / going-dark): `references/recovery-and-resume.md`, read at the breakpoint.

## The lightweight gate (the top's only verification act)

After level-1 reports, before commit, the top personally:

1. **Compiles** — runs the main module's `compileJava` + `compileTestJava` once itself (e.g. `./gradlew :Core:compileJava :Core:compileTestJava`); green or it doesn't count; compressed output (`-q --console=plain`, the verdict read from the log tail — never the full dump).
2. **File scope** — `git diff --stat` + `git status --porcelain`, against level-1's reported created/modified list; out-of-list changes = inventory first (level-1 explains or reverts) before commit. Untracked scratch directories excepted.
3. **Number recheck** — read the JUnit XML (`build/test-results/test/*.xml`) against level-1's per-class numbers (see next section).
4. **Hash spot-check** — level-1 should report the acceptance test's pre-/post-dispatch hashes (bit-identical, I4); the top just compares the strings for equality.
5. **Pure-docs tasks get a proportionally shrunk gate and dispatch.** **Pure docs = the task doc says so AND the diff contains only document-class deliverables** (contract documents, usecase maps, explanatory docs) — any production / test code or config change means it is not pure docs and the whole task reverts to the regular gate (items 1–4 all run); the classification declared in Phase 0 / the task doc, the gate verifies via `diff --stat` against the **deliverable file list**, never by after-the-fact judgment. Gate: no test numbers to recheck — the numbers item is replaced by path-level checking (every listed file exists, scope matches); **deliverable content quality does not enter the top's gate** (the content-judgment-sinks principle — `references/recovery-and-resume.md`). Dispatch shrinks in sync: the template's acceptance test / hash / gradle-numbers reporting items are replaced wholesale by "deliverable file list + per-file delivery" — no test to write means no circular-reasoning concern, the tier machinery (including spec-tdd's floor) does not apply; the docs are authored by level-1 (or a dispatched level-2), the compile item still runs to guard against smuggled code changes, hash / numbers items are naturally empty. The PHASE BOUNDARIES instruction is still carried — a pure-docs task may have zero nested dispatches; the heartbeat is covered by the "after each delivered file" trigger. Content **correctness** is self-attested by the producing level-1 against upstream sources and disclosed in the report; what consuming tasks' contract tests and the plan review guard is **wiring and coverage**, not the truthfulness of the document itself.

**What it does not do**: deep code review (sunk into level-1's audit / attack rounds; cross-task deep review is carried by the closing batch review — see the dedicated section), running the tests itself (level-1 already ran them; the XML is there), re-running the full suite (except when diagnosing a gate failure). The top doing subjective review is not diligence, it is waste: it lacks level-1's full context, its conclusions won't beat the sub-agent's audit rounds, and it burns the scarcest context. The top's value is **objectivity and continuity**, not depth.

**Eco mode's close step (after gate items 1–5, before commit)**: dispatch the per-card TOP final-audit dispatch; only converged findings (or escalated to the user) close the card (brief / checklist / findings bound in `references/eco-mode.md`); pure-docs tasks skip the final audit (keeping the shrunk gate).

## Number-recheck discipline

- **Rule: test numbers reported by a sub-agent are always rechecked against the JUnit XML, never taken on faith.** Twice in the field a verbal number was wrong: once 165 reported, XML said 163; once "+6 new tests (21+6=27)" reported, XML said 30.
- **The counting-unit trap** — one `@ParameterizedTest` method = N invocations, and JUnit XML's tests count invocations. The 30 case: actually +7 methods (6 `@Test` + 1 `@ParameterizedTest` running 3 sets) = +9 executed units — the reporter did mental math in methods; the behavior wasn't inconsistent, purely a counting slip. When the recheck disagrees, first ask: **is the report in methods or invocations?**
- **The XML coverage trap — every test run clobbers the previous round's XML.** When level-1 runs multiple test batches, only the last is recheckable afterward. The countermeasure is already in the dispatch template: **final verification = ONE gradle run covering all related test classes + per-class numbers** — that round's XML is exactly what the top rechecks.

## Mock-first contract development (the time dimension of tier choice)

Upstream dependencies (external API, another team's service) unreleased / unsettled → **read `references/mock-first.md` NOW and follow it**: the first task builds the mock fixing the contract; the tier may drop during the mock phase (the user's call — tiers follow the code's life stage, the time dimension, not only blast radius); once the real dependency settles a contract-alignment task pays the deep tests back ("defer + pay back, never skip"); external open questions get their own landing spot in the plan doc, distinct from the decisions section. A settled-upstream phase never reads it.

## Mid-run redirection (delivering a tier downgrade to a running sub-agent)

The user may at any moment downgrade the tier for time pressure — including mid-task:

- **Delivery (dual channel)** — while level-1 runs in the background, use SendMessage to push the change in (e.g. "downgrade to spec-tdd, converge to green and stop, report discloses the tier change") — most immediate for a wakeful agent; **simultaneously write `.spec-tdd/POLICY-<task>.md`** (level-1 re-reads it at every phase boundary, per the template's boundary instruction). Three reasons for the file channel: backlogged messages are **delayed, not lost** (field-measured: a wedged agent only gets them, in order, on its first waking round — a time-critical instruction arriving hours late = not delivered); a fresh continuation agent **cold-starts** with no message backlog to receive, only files to read; a policy left sitting in a message queue = not yet landed. The POLICY file overrides the template's TIER BAND, **downgrade-only** (restoring the deserved tier waits for the next task boundary); it lands in scratch, not in the task doc — task-doc edits are bundled with commits, and writing operational policy into the contract pollutes the rollback unit or trips the gate's file-scope check.
- **Asset preservation** — completed tests and implementation are not discarded; converge to green and stop.
- **Disclosure** — that task's report must record the tier change (when, what was downgraded, what unverified risk remains).
- Undeliverable (not a background dispatch) → takes effect at the next task boundary, disclosed the same way.
- **In-band downgrades** — a mid-run tier drop (e.g. spec-tdd→lite) is handled the same way: delivered via SendMessage + POLICY file, else effective at the next task boundary, disclosed as above. Restoring the deserved tier happens only at the next task boundary (upgrades never ride the mid-run channel); the band ceiling is structural — "upgrading out of the band" does not exist.
- **Time-pressure downgrades create re-test debt.** **Any runtime downgrade for time pressure — a mid-run tier drop (e.g. spec-tdd→lite), or per-task SendMessage downgrades — is booked identically: tasks that passed below their deserved tier enter the re-test debt list** (recorded on the board; tasks whose stakes were already below the new ceiling and untouched by the downgrade are not — diluting the list = the list stops working), and disclosed in the phase report. Payback (re-test) is a formal entry, not optional: **when time allows, schedule it straight back into this phase's task table** (new task rows, numbering continued); still unpaid at phase close → the whole list goes into the phase report handed to the user. Without the booking, a lightweight first pass silently becomes permanent; without the handover, the booking does too. Pre-flight's tier-band ceiling is structural (pre-flight 3); coverage-priority cards (coverage-grade stakes, run at standard) go on the coverage-priority list — their payback = the phase-end total-coverage pass, not double-booking. This is the phase-level version of mock-first's "defer + pay back, never skip" (field record: STP2's "W11–W14 all passed lightweight = re-test candidates").

## Recovery and resume (session break / 429 / soft-wedge / zombie)

Any breakpoint — a session break / context corruption with a task half-finished, an agent killed by a 429, a soft-wedge or zombie-wait diagnosis (watchdog item 5) → **read `references/recovery-and-resume.md` NOW and follow the matching procedure**: inventory-first continuation (keep, fill gaps, never rewrite); the 429 case resumes the SAME agent by SendMessage (with the post-resume slow-start grace — delivered-but-silent is not death); zombie-wait tries revival before any kill; soft-wedge schedules a reset+15 nudge only for a still-future reset (read the wall clock first); joint surgery = SendMessage last words → TaskStop → orphan sweep incl. build locks → different-pool continuation; the degraded closing is the last rung, never a convenience; the post-first-429 dispatch discipline keeps later dispatches out of the exhausted pool; the first successful turn after a 429 records the freeze, schedules the durable insurance point (future resets only), and collects before judging; the top finishing the work itself is hard-banned. **Unattended window (going-dark)**: the user announces leaving/sleeping/going offline with work in flight → read `{family root}/skills/GOING-DARK.md` and execute it NOW (the batched pre-approval ask — expected return, unattended commit authority (cross-repo/sibling-checkout lines named individually), adversarial authority (I22, default none), parallel-impact operations (default none), recovery actions, tier ceiling, open decisions, run scope — plus substrate choice and optional OS-level fallback arming); if that file is unreadable, still run the gate and disclose. A healthy uninterrupted run never reads the reference.

## Disclosure conventions

The following must be **explicitly listed** in sub-agent reports and re-checked by the top / user — never done silently:

- tier capped (e.g. insufficient spawn depth, a coverage-grade card run at standard under the tier band's ceiling) or downgraded mid-run;
- literal doc deviations — DDL additive deltas, mock placement differing from the doc, naming / structure adjustments;
- locally decided rule details (small rules the doc doesn't pin and level-1 decided itself);
- adaptations of prior batches' tests (next section);
- causal claims in incident / overnight / phase-summary reports: each labeled **verified** (the check performed + its output) or **inferred-hypothesis** — an unperformed check's conclusion is never presented as fact (field 2026-10-21: "the machine slept" asserted with no power check — the machine never sleeps);
- phases spanning repos: the status section's preamble opens with a **visibility line** — which repos commits land in, which checkout's log shows which subset (field 2026-10-21: a whole night's commits landed in the sibling repo; the home checkout's log read as "dead") — repeated in the morning/return report; all board time disclosures carry an explicit timezone.

Principle: **the task doc is a contract. Deviating from the contract without disclosure = the contract is void** — the next task's sub-agent still understands the system per the old contract.

## The regression wall (test assets)

- Every task's acceptance tests are the next task's existing assets — the later in the phase, the thicker the wall. This is the task loop's compound interest.
- Later tasks adjusting prior tests for constructor / contract evolution is legitimate evolution, but: (1) **recorded per file** in the report with rationale; (2) **assertion semantics must not change** — only wiring may change (a new constructor parameter, a new contract field), never expected behavior. Changed semantics = a section of that wall fell; it must be re-walked as a new test through RED→GREEN.

## The closing batch review

An all-done task table ≠ straight to the report — closing has a fixed procedure: **run the phase-end total-coverage pass, dispatch the closing batch review, then produce the phase report.** Rationale: the task doc's self-containment design means every level-1 is blind to the others; the cross-task dimensions are visible to no one along the whole chain (the top being hard-banned from deep review is correct — it lacks full context and burns scarce resources); this blind spot is covered by a one-shot fresh context, not by anyone "happening to look". And since v1.33.0 the per-task band tops out at standard, so the phase's coverage evidence is produced exactly here — once, over the union of everything the phase landed.

1. **Trigger.** The task table all done (including re-test debt rows scheduled back) → run the total-coverage pass (next item) → dispatch the closing review; the review converged and findings disposed → only then produce the phase report. The user explicitly skips the pass or the review → comply, but list it in the phase report's residual risks — never silently omit.
2. **The phase-end total-coverage pass (v1.33.0 — the phase's single coverage checkpoint).** Before the review dispatch, the top personally runs ONE full-suite run covering every task's accumulated test classes in the real tree — a named gate exception (the same shape as task-dag's wave-union run: new information, no existing XML to recheck; evidence = that run's XML numbers) — **plus a branch-coverage report over the phase's deliverables** (whatever the repo's coverage tooling produces; run and report may be one command). Red on the union run → diagnose before proceeding (the regression wall broke somewhere cross-task). Both artifacts' paths ride the review brief. The pass runs at **coverage depth minimum, or above**: a phase that is blast-radius-critical as a whole upgrades the closing dispatch to the adversarial grade — on the user's recorded I22 authorization (asked with the closing announcement — **v1.43.0: park-as-to-do is the recommended option; proceeding requires the user's own very-good-reason statement and time/token headroom**; or pre-granted at the going-dark gate's item 6; ungranted = coverage-grade close + the adversarial-debt line in the phase report; direct loop/dag entries — manager-run features exited at the grill). **Pure-docs phases** (no test classes anywhere) skip the pass, disclosed. The coverage-priority list is the review's attack order — those cards' deliverables first.
3. **Who reviews, what (bounded, read-only).** A fresh-context **TOP** sub-agent (same shape as Phase 0's plan-review), looking at the whole phase's accumulated result in one pass: all tasks' commit ranges (first..last hash), task docs, the authoritative plan doc (status/decisions/external open questions), the disclosure list (assembled and handed over by the top — the reviewer does not re-read deliverables), **the total-coverage pass's XML numbers + branch-coverage report** (the phase's single coverage-evidence artifact). Read-only: git reads + file reads; no code changes, no builds, no git writes. Its brief carries the standing file-tools rule verbatim: local files are read ONLY with Read/Glob/Grep (Bash cat as fallback); NEVER open file:// URLs with any browser tool (Playwright MCP, webReader, or similar); if native file tools seem missing or unloadable, STOP and report back 'missing file tools' — never improvise with a browser.
4. **Five attack dimensions (the first four visible only cross-task; the fifth only at the union).** (a) cross-task inconsistency — one concept implemented in multiple shapes (money handling, error-handling style, naming); (b) duplicated logic never extracted — multiple similar copies across task boundaries, later fixed in one place and missed in another; (c) the accumulated effect of regression-wall adjustments — individually legal wiring changes that together thin the wall; (d) merged patterns in disclosures — several local rulings that together contradict the decisions section (each individually reasonable); (e) **coverage evidence** — uncovered or thin branches on the phase's deliverables read from the branch-coverage report (coverage-priority cards first); each uncovered branch is a finding with `file:line`.
5. **Finding disposal (auto-enters the board; right-sized per severity — v1.32.1).** Each finding numbered (F1, F2…) and labeled by the reviewer **severity + scope with a one-line mechanical rationale (file count + diff class)** — the labeling output is part of the review brief. **Simple/small findings do NOT get one card each**: they collectively open ONE merged light row (numbering continued, source noted "closing review F#×N") running ONE lite cycle — single brief + implement + test + fresh-context review + commit; **the eco per-card TOP final audit is skipped for the merged light row** (the findings came from that same TOP review — re-auditing its own findings' fixes is the redundant round this shape cuts; maintainer ruling 2026-10-21) — the SAME reviewer's convergence round covers it. Findings that are neither simple nor small open one full row each, the normal loop as usual. Coverage-gap findings follow the same right-sizing — a cluster of small uncovered branches in one area merges into ONE light row (write the missing tests + any fix, one lite cycle); a structural coverage gap on a coverage-priority card opens a full row. The top may **relabel UP only** (a mislabeled "simple" upgraded to a full card, disclosed — never the reverse). A finding the top judges a non-defect must **not be silently dropped**: strike through in the table + a one-line rationale (same convention as decision records). Findings are defect debt, booked separately from re-test debt (the tier-downgrade ledger); the defect and re-test ledgers are never co-booked. On opening fix work the top **re-announces the remaining estimate** (remaining findings × light-cycle unit cost, converging on the board — the v1.32.0 discipline extended to the tail); the light row's watchdog budget = the lite example default.
6. **Convergence bound (the I16 convention).** All fix rows done → **the SAME reviewer runs one convergence round**, scoped to the fix rows' diffs; unresolved findings remain → escalate to the user; no infinite loop. No findings → no extra round, straight to the report.
7. **It is additive, not a substitute.** Per-task lightweight gate and tier machinery unchanged — the closing review takes over no single-task verification (a consolidated view cannot catch holes inside one task); the total-coverage pass does not un-do per-card tier duties either (per-task coverage no longer exists to lean on — the pass is the checkpoint, not a backstop for skipped work); nor does it lift the top's deep-review ban — the review is a dispatch; the top only triages findings and strikes rows. The review dispatch hits 429 → the existing resume rules apply (SendMessage continues the same agent); after a confirmed soft-wedge, what TaskStop re-dispatches is a **fresh reviewer** — "the same reviewer runs one more round" is unavailable; that re-dispatch cost is disclosed in the report. The closing review is also under watchdog monitoring (read-only class: budget = the expected duration stated at dispatch; signal = heartbeat).
8. **Cost and disclosure.** +1 TOP dispatch per phase (a follow-up round only if findings exist, cap +1) + the top's own total-coverage run (wall-clock, not a dispatch — rides the loop-start/Gate-2 estimate). Review rounds, findings count, fix rows opened, rows struck (with reasons), the pass's union numbers + branch-coverage summary all go into the phase report.

## LSP / IDE diagnostics are not evidence

After sub-agents write files, LSP / jdtls often reports stale false errors — "method undefined", "cannot be resolved", even pointing at deleted scratch files. **Always defer to gradle compile / test results** (I19(f): the BUILD is the only oracle — IDE diagnostics are noise). No level wastes time chasing LSP errors.

## Common Mistakes

| Mistake | Fix |
|---|---|
| Taking a blueprint directly as the authoritative plan doc and starting (no status section, non-self-contained task docs) | Phase 0 first: on entry judge whether the trio exists; missing → the breakdown bootstrap produces it, only then Pre-flight. |
| A live-testing small-fix stream broken into a task table | Entry quickfix check (Phase 0, before any breakdown): suggest `spec-tdd-quickfix` — the user decides; a handful of wiring fixes needs no board |
| Splitting tasks verbally in the conversation and starting | A breakdown living only in the conversation = not broken down (the spirit of I17): after session compaction the trace base is gone and resume / rollback / write-back have nothing to stand on. Land the trio + self-contained task docs on disk. |
| Starting the breakdown without fresh-context review | Reviewer attacks coverage / omissions / order / self-containment / granularity + top sign-off (double consent) is half the bootstrap; the cost of a bad split is the whole phase; unresolved → escalate to the user. |
| Two tasks both writing the same deliverable file (a shared-file serial edge accepted silently) | The single-writer check (v1.38.0): one file, one owner task; a two-writer file → merge / extract a shared upstream task / pin a consumer-only contract / the disclosed keep (structural multi-writer files, v1.38.1) — weighed and disclosed (field 2026-11-02: the shared per-order-core file chained the sweep card and the endpoint card serially; nobody weighed the re-cut). |
| A pile of small adjacent units cut into many tiny cards | Granularity's merge bias (v1.38.0): the machinery tax is per card; split only on a trigger (independent rollback meaning / a blast-radius class split / budget / a parallelizability win that outweighs the tax); no trigger → ONE card, one dispatch doing them together (the merged-light-row shape). |
| The top personally deep-reviewing code, running the tests itself | Lightweight gate only: compile, `diff --stat`, XML number recheck. Deep review sinks into level-1's audit / attack rounds, cross-task deep review into the closing batch review; the top's context is the phase's scarcest resource. |
| level-1 has no Agent tool and implements itself (self-testing) | Hard ban — stop and report to the user; the fix is `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=3` (set in the top's launch environment, not some Bash call's export). |
| Taking a sub-agent's verbal test numbers on faith | Read the JUnit XML and recheck per class (field-proven: 165 reported, actually 163; "21+6" reported, XML 30). |
| Treating a number mismatch as behavioral anomaly | First ask the counting unit: `@ParameterizedTest` 1 method = N invocations, XML counts invocations; only after unit conversion still mismatching is it an anomaly. |
| level-1 runs multiple test batches and earlier XML is clobbered, unrecheckable | The dispatch template mandates: final verification = one run covering all related test classes + per-class numbers. |
| `git add -A` / `git add .` to take the commit | List file names explicitly — the working directory always contains `.spec-tdd/` etc. untracked scratch that would be swallowed into the commit. |
| The top committing at task boundaries without asking | Pre-flight asks once for session commit authorization; unauthorized → pause at the boundary, hand the file manifest to the user to commit manually, record the reported hash in the status row. |
| A sub-agent committing / stashing / checking out itself | git writes banned at every level; commits are the top's exclusive duty (task boundary = commit boundary = rollback unit). |
| User-ruled decisions left only in the conversation | Write back immediately to the authoritative doc's decisions section (numbering continued) + the relevant task doc (old plan struck through for the record). Conversations get cleared / compacted — not written back = did not happen. |
| After a session break, rewriting the half-finished work wholesale | Continuation mode: inventory existing diff vs task doc → spec-defect check (test contradicts doc → fix the test) → keep legitimate changes, fill only the gaps. 429 break (agent dead, session alive): SendMessage resumes the same agent, or immediately re-dispatch a continuation agent (not a restart); the dead one is the implementer → re-dispatch a continuation implementer, never wipe and redo. |
| A 429-dead agent's remaining work is small, the top "helpfully" finishes it itself | Not an option. Two legal paths: wait for reset and SendMessage-resume the same agent, or immediately re-dispatch a continuation agent (not a restart). The top's inventory stops at objective facts (status / `diff --stat` / path mapping); deliverable content judgment is the continuation agent's job. The user explicitly demands personal closure → comply, disclosed as degraded mode. |
| Forcing the heaviest tier "for safety" in the mock-first phase | The time dimension: deep tests before the contract settles are waste (a contract change rewrites them all). The user's call may downgrade; once the real API settles, a contract-alignment task pays it back. Downgrade = defer + pay back, never skip. |
| A long task list left to escalate's per-task self-judgment, several tasks all going coverage or adversarial, the phase eaten by deep verification rounds | The tier band's ceiling is structural = standard spec-tdd (pre-flight 3, not an ask); adversarial-grade units take the pull-out escape hatch (Phase 0 sniff pre-pull / routing-point STOP and report); coverage-grade units run at standard on the coverage-priority list — their convergence point is the phase-end total-coverage pass, never silently below the deserved reading. |
| Assuming in-loop lite is unavailable and forcing small cards onto spec-tdd (the two-context tax) | The tier band includes lite: small cards run the lite machinery (solo implementation + a **mandatory** fresh-context review dispatch), tier disclosed in the report — the v1.18.1 lite ban was reversed by v1.20.0 (loop economics: small cards don't pay the two-context tax). |
| Wanting a mid-run downgrade and just killing the running sub-agent to restart | Deliver the change by SendMessage; completed assets preserved; converge to green and stop, disclosed in the report. |
| A later task casually rewriting prior batches' tests on the way past | Regression-wall rules: only wiring adjustments allowed (forced by contract evolution), recorded per file; changed assertion semantics = a new test, re-walk RED→GREEN. |
| Table all-done goes straight to the phase report without the total-coverage pass or the closing batch review | Closing procedure: all-done (including payback rows) → total-coverage pass → closing review → findings enter the board / get struck → report. The cross-task blind spot (the price of self-containment) is visible to exactly this one gate along the whole chain — and the pass is the phase's only coverage checkpoint. |
| Treating the closing review as a substitute for per-task deep review ("it's backstopped, downgrading tiers is fine now") | Additive, not a substitute: a consolidated view cannot catch holes inside one task; tier machinery and the lightweight gate unchanged; the review takes over no single-task verification. |
| Closing-review findings silently dropped, or only listed in the phase report | Into a table row (the convergence point: on the board = will be executed) or struck through with a reason; report-only = no convergence point (the spirit of I17). |
| Allowing coverage or adversarial in-loop "for safety" | Structurally not carried per-task: per-card coverage multiplies the expensive tier ×N (the end pass pays it once over the union), hours-level adversarial depth ×N contradicts the anti-idle economics; adversarial units pull out and run standalone (pre-flight 3, on the user's recorded I22 authorization — the gate's pull-out ask; a decline = in-band + debt row), coverage-grade units run at standard on the coverage-priority list — mid-run adversarial demands pull out too; in-loop unlocking does not exist. |
| Zero monitoring while in-flight, idling discovered by hand | Anti-idle watchdog: armed at dispatch (delivery class registered), output-age + budget axes, three-state judgment bound to clocks. Field record: three modes stacked, one card 6 h, 5 h zero output. |
| Three-state judgment reading only instantaneous signals (zombie misjudged as a healthy in-phase wait) | The zombie conjunct includes "the heartbeat-declared wait overdue" — instantaneous shapes can't distinguish zombie from waiting; the clock is the only discriminator; total freeze keeps the ~90-min long tolerance (long reasoning vs soft-wedge indistinguishable). |
| Applying the output-type formula to a read-only reviewer (guaranteed misjudgment) | Register the delivery class at arming: read-only-type real output = heartbeat / scratch growth, budget = the expected duration stated at dispatch — not the tree diff. |
| Standing down because the agent reports "still running / all fine" | Self-reports never reset the real-output clock (field-proven: the zombie parent's "implementer running" was wrong); only actions count (a new child dispatched / boundary touch / output flowing). |
| Still "waiting a bit longer" past the wall-clock budget; or hard-killing while output flows | Stalled overrun → terminate and re-dispatch immediately; flowing overrun → one-time budget reset, disclosed (once only); continuation re-dispatch re-budgets by remaining scope; re-dispatch cap 2, beyond that escalate to the user. |
| Nested dispatch as a blocking call (the parent wedges itself) | Background mode in writing: mid-run redirection, POLICY re-read, the watchdog, and responsiveness all depend on the parent keeping tool rounds; no background nested support → disclose the degradation (the top's budget backstops). |
| Treating an overtime child as dead and re-dispatching directly | TaskStop the old child first (presumed ≠ confirmed; two implementers banned from the same tree) + clear build process locks, only then re-dispatch the continuation. |
| Mid-run changes via SendMessage only | Dual channel: backlogged messages deliver late (a time-critical instruction arriving late = never arrived); a fresh continuation agent cold-starts with no messages to receive — write the POLICY file too; it overrides the band, downgrade-only. |
| Writing POLICY into the head of the task doc | Task-doc edits bundle with commits — operational policy entering the contract pollutes the rollback unit or leaves dirty changes that trip the gate's file-scope check; POLICY lands in scratch. |
| Killing the parent directly on zombie diagnosis | Revival attempt first with evidence (child-death evidence + stop-waiting order) + a bounded grace — a living parent can save itself in place and keep its context; only on failure the joint surgery (SendMessage before the kill for last words). |
| Re-dispatching directly after TaskStop kills a wedged/zombie parent | Orphan sweep first (in-flight nested children stopped or confirmed ended) + clear build process locks (residual daemons collide with the new build); recovery re-dispatch prefers a different pool **that satisfies the tier pin**. |
| Post-first-429 dispatches still silently landing in the same pool | Dispatch discipline: name a different-pool model satisfying the tier pin (opt-in) or pause until the named reset; codified, never in-the-moment judgment. |
| Chasing LSP / jdtls "method undefined" false errors | The BUILD is the only oracle (I19(f)); defer to gradle compile / test. |
| Tier downgrade / doc deviation / local rulings undisclosed | Disclosure conventions: all explicitly listed, re-checked by the top / user — the doc is a contract; undisclosed deviation voids it. |
| A task doc saying "DDL same as the previous case" / "see the requirements doc" | Self-containment: the full contract given in full at once; the dispatch prompt restores path shorthands to absolute paths. |
| eco on, an Agent call not naming MID (silently inheriting the session model) | eco's MODEL PIN: level-1 and all nested name MID — omission breaks in both directions (a TOP bill comes back, or the shape silently runs wrong). |
| Under eco, committing once the gate passes without waiting for the per-card final audit | Close order = gate → final audit converged → commit; commit-before-audit = all-MID with no TOP judgment point — a downgrade, not a saving. |

## Red Flags — STOP

- The loop is running but the status section / task docs don't exist → STOP, back to Phase 0 to complete (existing work inventoried from the diff back into status rows) before continuing.
- The top starts reading sub-agent deliverables verbatim in full (autopsy-style content judgment; XML number recheck and path-level mapping excepted) → STOP — content judgment is a sub-agent's job (audit rounds / continuation dispatches).
- level-1 reports "I implemented it myself" (self-testing) → run void, re-dispatch.
- level-1 reports having no Agent tool → stop, report to the user to set spawn depth; never let it self-test in place.
- XML numbers disagree with the report (after counting-unit conversion) → demand an explanation or a re-run; no match, no commit.
- `git diff --stat` shows changes outside the reported list → no commit before inventory and an explanation.
- Any level's sub-agent touched git writes → first confirm the tree is undamaged, restate the discipline.
- The acceptance test is not bit-identical before vs after dispatch → I4 FAIL, route per the tier's TEST bucket even if the re-run is GREEN.
- Continuation inventory finds pre-break production changes made to accommodate a test contradicting the doc → fix the test, restore the bent production code.
- A tier was downgraded, the doc deviated, and the report doesn't say so → treat as unverified; demand the disclosure before re-review.
- A closing-review finding neither entered the table nor got struck through with a reason → STOP and complete the procedure — on the board = convergence point; booked but never looked at = not booked.
- Table all-done, the total-coverage pass skipped (straight to the review or the report) → STOP — the pass is the phase's only coverage checkpoint (per-task coverage no longer exists behind it); a skip needs the user's explicit call and a residual-risks line.
- The top extending a liveness check into content judgment (starting to read a wedged agent's output to judge "did it do it right") → STOP — monitoring stops at objective facts (mtime / git status / processes / status rows); after diagnosis, run the procedure, not an autopsy.
- A card stalled past its wall-clock budget and still "waiting a bit longer" → STOP — the budget is a hard cap; terminate and re-dispatch; re-dispatch already at the cap of 2 → escalate to the user.
- Level-1's routing finds stakes above the band (standard) and quietly starts work → STOP and re-dispatch — report first: the top pulls adversarial-grade cards out of the loop (standalone, on the user's recorded I22 authorization — **v1.43.0: park-as-to-do is the recommended option; proceeding requires the user's own very-good-reason statement and time/token headroom** — the report IS the ask when the discovery is mid-loop) or books coverage-grade ones on the coverage-priority list (standard in-loop, the end pass converges them).
- Eco mode, no per-card final-audit notification on record before commit (or the audit dispatch dead / silent) → STOP — a dead audit is not an approved audit; after one fresh re-dispatch still nothing → report to the user.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.