The four-settings loop template: a separate verifier model that never shares context with the writer, a hard stop rule, a state file re-read each cycle, and worktree isolation. Point it at a checkable backlog and let it run overnight.
GOAL: every test in [/tests/TARGET] passes, lint is clean, zero type errors.
EACH CYCLE:
1. run the suite, read every failure
2. pick the single highest-impact failure
3. write the smallest change that fixes it
4. re-run tests + lint + type check
VERIFY: a separate model instance checks the goal — never the writer. Verifier prompt: "You are a verifier. You did not write this code. GOAL: <the exact goal string>. Given the diff and the test output, answer ONLY: PASS — every condition in GOAL is objectively met, with evidence, or FAIL: <the specific condition not met, and the evidence>. Do not fix anything. If unsure, FAIL."
STOP WHEN: verify passes, OR after 10 iterations, OR $5 spent, OR no progress in 2 attempts.
ON BLOCKER: log it, skip to the next item, never halt the whole loop.
STATE: append done / failed / next to a state file, re-read it at the top of every cycle.
ISOLATION: one git worktree per subagent.
claude-code
Implementation note
Near-verbatim from the source article's copy-paste template (structure and verifier prompt verbatim; target path parameterized). The verifier-never-shares-context split is the load-bearing setting: the writer is optimistic, the verifier is skeptical. Source claims ~340 cycles/7 days at ~$2.30 per accepted change; treat the numbers as anecdote, the shape as sound.
First-party Cursor guidance for the iterate-until-green loop, with the key anti-reward-hacking clause: the agent may never modify the tests it is trying to satisfy. Works in Cursor, Claude Code /goal, and Codex.
"Write code that makes these tests pass. Do NOT modify the tests. Keep iterating — run the suite, fix failures, run again — until all tests pass." (paraphrase of Cursor's official agent best-practices guidance)
Reduce the data [web app] downloads before its first screen appears. First record passing tests, mobile and desktop screenshots, and compressed transferred bytes—the data actually downloaded. Use the build report only to suggest candidates. Defer, compress, or remove one item, then rebuild and rerun every check. Keep it only if tests pass, screenshots are pixel-identical, and bytes decrease; otherwise revert. Stop when no safe candidate remains, progress stalls, or approval is needed. Return measurements, changes, and untested states.