Agent Loop Spec Template
A specification for a closed-loop workflow: steps, per-step verification, exit criteria, recovery, and budget. Copy it below, fill the bracketed fields, delete what you don't need.
# Loop spec: [name]
## Goal
[The outcome this loop must produce, stated so success is checkable.]
## Steps
| # | Step | Action | Verification (evidence, not assertion) |
|---|------|--------|------------------------------------------|
| 1 | [name] | [what happens] | [command/output/artifact checked, against what criterion] |
| 2 | [name] | [what happens] | [check] |
## Exit criteria
- Success: [the final verification that ends the loop]
- Abort: [conditions under which the loop stops and escalates]
## Recovery behavior
- On step failure: [retry with diagnosis / backtrack / escalate]
- Diagnosis required before retry: yes
## Budget
- Max iterations: [N]
- Max cost/time: [bound]
- On budget exhaustion: escalate to [who] with [what evidence]
## Observability
- Logged per step: [plan, output, verification result]
- Where: [file/system]
Field notes
| Field | Why it matters |
|---|---|
| Verification column | The table forces the discipline: every step names its evidence before the loop runs. Blank cells mean the loop can lie to you. |
| Budget | Boundedness is a loop-reliability axis. A loop without a budget is an incident waiting for a trigger. |
| Exit criteria | Define abort as carefully as success. Loops that only know how to succeed run forever on impossible tasks. |