Ralph Wiggum Technique
The Ralph Loop (aka Ralph Wiggum technique) is an autonomous AI coding pattern used to build LLM Wiki. Named after Ralph Wiggum from The Simpsons — lovable but forgetful, which mirrors how AI agents behave without persistent memory.
The Core Concept
Section titled “The Core Concept”while :; do cat PROMPT.md | claude-code ; doneA bash loop that repeatedly spawns fresh AI agent instances. Each iteration gets a clean context window. Memory persists only through files on disk — git history, progress files, PRD documents.
Origins
Section titled “Origins”| Who | Role |
|---|---|
| Geoffrey Huntley | Created the pattern (~May 2025). “Sit on the loop, not in it.” |
| Matt Pocock | Popularized it (Dec 2025). 11 tips, skills repo, Sandcastle library. |
| Ryan Carson (Snarktank) | Built the most starred implementation (15,861 stars). Runs 3 parallel instances. |
How It Works
Section titled “How It Works”Phase 1: Define Requirements
Section titled “Phase 1: Define Requirements”Human + LLM produce a PRD (Product Requirements Document). Break work into user stories, each small enough for one context window.
Phase 2: The Ralph Loop
Section titled “Phase 2: The Ralph Loop”Each iteration:
- Read
prd.jsonandprogress.txt - Pick highest priority incomplete story
- Implement the story
- Validate (typecheck, lint, test — “backpressure”)
- Commit with passing checks
- Update
prd.json(markpasses: true) and append learnings toprogress.txt - Context cleared — next iteration starts fresh
Key Files
Section titled “Key Files”| File | Purpose |
|---|---|
prd.json | User stories with passes: true/false status |
progress.txt | Append-only learnings for future iterations |
CLAUDE.md | Prompt fed to agent each iteration |
Matt Pocock’s Workflow
Section titled “Matt Pocock’s Workflow”Idea -> /write-a-prd -> PRD -> /prd-to-issues -> Ralph Loop -> Manual QAHis Key Tips
Section titled “His Key Tips”- Start hands-on, then go AFK — watch Ralph before letting it run unsupervised
- Define scope as end state, not implementation steps
- Use feedback loops — types, tests, linting must pass (“backpressure”)
- Take small steps — each PRD item fits in one context window
- Prioritize risky tasks first — architecture before UI polish
- Explicitly define quality expectations — “Agents amplify what they see”
- Tune it like a guitar — observe failures, add guardrails reactively
Key Resources
Section titled “Key Resources”Articles
Section titled “Articles”- snarktank/ralph (15,861 stars)
- mattpocock/skills (write-a-prd, grill-me, tdd)
Videos
Section titled “Videos”- Matt Pocock overview: youtube.com/watch?v=_IK18goX4X8
- Geoffrey Huntley deep dive: youtube.com/watch?v=SB6cO97tfiY
Relevance to LLM Wiki
Section titled “Relevance to LLM Wiki”The Ralph Loop is used in two ways:
- Build methodology — LLM Wiki itself was built using Ralph loops (
/ralphskill,prd.json,progress.txt) - Wiki operations — ingest/lint could run as a Ralph-style loop: process sources one at a time, each in a fresh context, progress tracked in
log.md