5.5 Spec-first agent loop
5.5 Spec-first agent loop
implementation tasks with specifiable behaviour enter the agent's loop with an executable acceptance criterion (failing test, type signature, or conformance check). The agent iterates against that gate before opening a PR. Exploratory work and UI spikes are explicitly exempt — the criterion scopes to tasks where behaviour can be specified up-front
Levels
Level 0
Agent generates code first; tests written after (or not at all) in the same agent run
Level 1
Spec-first used ad-hoc on some task types; no convention; acceptance criteria captured inconsistently
Level 2
Default for implementation tasks with specifiable behaviour: task templates (see `PL1-task-decomposition`) include an acceptance-criterion field that becomes the pre-code gate; agent iterates until green before opening PR. Exploratory and UI spikes explicitly exempted
Level 3
Gate quality compounds: recurring spec shapes become reusable acceptance-criterion templates; failed-gate patterns (tests that pass but don't catch behaviour) inform prompt and template refinement; spec-to-green iteration count tracked and trends down
Recipes that advance this criterion
No recipes yet.