Ralph-style loops
Fresh-context iterations against a PROMPT.md backlog with guardrails — the Ralph Wiggum technique (Geoffrey Huntley). The pattern behind most production harnesses.
The Ralph Wiggum loop — named by Geoffrey Huntley — is the brute-force pattern: the same prompt, a while true, and a fresh context window each pass, usually against a PROMPT.md backlog. It’s how people run Claude Code overnight, and it works better than it has any right to, provided the guardrails exist: an objective exit condition, an iteration cap, and a gate the agent can’t talk its way past. The Ralph-style loops below ship those guardrails as part of the prompt, not as an exercise for the reader. New to the technique? The ralph-wiggum-loop guide covers where it came from and when to use it over /loop or /goal; the agent-loop-safety guide covers what keeps an overnight loop from becoming an overnight bill.
Guardrails that learn from failure
A Ralph-style loop that writes its own rules: when a check fails the same way twice, the failure pattern gets appended to a guardrails file that every later iteration reads first.
Backlog-clearing loop with a separate verifier
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.
Ralph the bug backlog
Work a triaged bug list one fix per fresh-context iteration: reproduce first, fix minimally, prove it with a regression test, and log root-cause patterns to guardrails.
Ralph a test backlog
Iterate over a prioritized list of untested modules with fresh context each pass, writing real behavioral tests for one module at a time and banking lessons in a guardrails file.
Grade C loops (2)
Showing A and B. 2 more graded C — they stop on their own, but run fewer checks than A or B. Show the 2 C loops →