
Ralph
The Ralph Wiggum loop — autonomous agent coding via dumb bash loops, fresh context.
About
Ralph is an agentic coding technique coined by Geoffrey Huntley ('Ralph Wiggum as a software engineer', ghuntley.com/ralph): put a coding agent in a while-true bash loop feeding it the same fixed prompt every iteration. Each iteration starts with a fresh context window, reads specs and the plan from disk, does exactly one unit of work, validates it observably, commits, and exits. Nothing survives between iterations except what's written to disk — which kills context rot. The technique went viral in late 2025; Anthropic shipped an official ralph-loop plugin, and the community built playbooks, packaged skills, and overnight-execution systems on top of it.
The honest picture: it's stubbornness as strategy — 'deterministically bad in an undeterministic world.' It works best for multi-step tasks with clear, checkable end states; it's wasteful for one-shot edits and can burn API credits if the plan goes stale (regenerate the plan when the loop starts circling). Reference implementation: ghuntley/how-to-ralph-wiggum.
What it can do
- Fresh-context loop: same prompt, new agent process per iteration
- Disk-persisted plan as shared state between iterations
- Per-iteration validate, commit, and exit cycle
- Human gates before irreversible steps
- Executor adapters for any CLI
- Official Anthropic ralph-loop plugin available
Setup
Copy the loop template into your repo (PROMPT.md, IMPLEMENTATION_PLAN.md, specs/), then ./loop.sh plan 5 and ./loop.sh build 20; or install Anthropic's ralph-loop plugin.
Prerequisites
Any agentic CLI (Claude Code, Codex, Amp, Copilot CLI); a repo with specs and a plan file.
Use cases
Works with
Trust score — 9/10
Scored 9/10 (verified tier, metrics-v1). Evidence: Verified via vendor site/docs/GitHub and reputable coverage, wave 46; Trending score 90/100 from researcher assessment.
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.