Ralph
Ralph solves the context window limitation by breaking work into independent iterations—each Amp session gets a fresh context, implements one story, and commits before the next iteration begins.
Overview
Ralph implements the Ralph Wiggum technique for autonomous AI development using Amp. Rather than attempting massive one-shot implementations that exceed context limits, Ralph carves work into discrete chunks. Each iteration spawns a fresh Amp instance, picks the highest-priority incomplete story from a JSON spec, implements it, and commits—repeating until all requirements pass.
Key Features
- Iterative execution: Fresh context per iteration keeps the agent in its "smart zone"
- Persistent memory: Context survives across sessions through git history,
progress.txt, andprd.jsonstatus tracking - Quality gates: Automated typechecking, tests, and browser verification ensure code quality compounds
- Knowledge accumulation: Updates
AGENTS.mdwith discovered patterns for subsequent iterations
Code Snippets
Installation
# Option 1: Copy to your project
cp ralph.sh prompt.md scripts/
# Option 2: Install as global Amp skill
cp -r . ~/.config/amp/skills/ralph
Basic Usage
# Run the loop with a PRD
./ralph.sh
The Core Loop
#!/bin/bash
# Simplified version of the loop logic
while true; do
# Read PRD, find incomplete story
story=$(jq -r '.stories[] | select(.status != "done") | .id' prd.json | head -1)
if [ -z "$story" ]; then
echo "All stories complete"
exit 0
fi
# Run Amp on single story
amp -p "Implement story $story from @prd.json. Run tests. Commit when done."
# Update status
jq ".stories[$story].status = \"done\"" prd.json > tmp && mv tmp prd.json
done
Technical Details
Ralph uses a bash-based orchestration layer that:
- Selects incomplete stories from
prd.json - Spawns Amp with clean context for each story
- Runs quality checks (typecheck, tests, browser verification)
- Commits successful changes with descriptive messages
- Updates PRD status and progress log
- Repeats until all requirements pass or iteration limit reached
The key insight: context windows are arrays. The less the sliding window needs to slide, the better the results. By resetting context between iterations, each task gets the full "smart zone" of the context window.
Connections
- ralph-wiggum-technique-guide - Comprehensive implementation guide covering the underlying technique Ralph implements
- a-brief-history-of-ralph - Chronicles how this methodology evolved from fringe experiment to mainstream approach
- 12-factor-agents - HumanLayer's complementary framework for deterministic agent workflows
Linked References (1)
Mentions (15)
- A Brief History of Ralph
Dex Horthy chronicles his journey with the Ralph Wiggum Technique from June 2025 to January 2026, documentin...
- Claude Code Guide
...de-best-practices - Optimization and workflow patterns (map)ralph-wiggum-and-why-claude-codes-implementation-isnt-it - Ralph ...
- Claude Code Ralph Loop Tutorial
Ralph Loop forces Claude Code to operate in a continuous intellig...
- Fundamental Skills and Knowledge You Must Have in 2026 for SWE
...rchitectures, and recreate intellectual property from specs.Ralph was born from a nine-year-old's advice. While playing Facto...
- Ralph: Step-by-Step Setup Guide
Ryan Carson shares his practical experience with Ralph, the autonomous AI coding loop created by Geoffrey Huntley....
- Ralph Wiggum (and why Claude Code's implementation isn't it)
... Huntley and Dex Horthy break down why Anthropic's official Ralph plugin misses the point of the original technique. The dist...
- Ralph Wiggum as a Software Engineer
Ralph is a simple automation pattern: a Bash loop that continuous...
- The Ralph Wiggum Loop from First Principles
Geoffrey Huntley, the creator of Ralph, walks through the technique from absolute first principles...
- Ralph Wiggum Loop Honest Reviews
The author questions whether Ralph makes sense for projects that can't be fully auto-validated...
- The Ralph Wiggum Technique: Running Claude Code in a Loop
Ralph Wiggum (named after the Simpsons character) is a deceptivel...
- RepoMirror
ralph-wiggum-technique-guide - RepoMirror implements the exact Ra...
- Stop Chatting with AI. Start Loops (Ralph Driven Development)
...ter) to capture thoughts without the friction of typing. 2. Ralph Driven Development Bad AI results stem from bad prompts, ba...
- The Age of the Generalist
...5-the-year-in-llms and the automation patterns discussed in ralph-wiggum-as-a-software-engineer.
- Thread-Based Engineering: How to Ship Like Boris Cherny
ralph-wiggum-technique-guide — The Ralph Wiggum pattern mentioned...
- Zeroshot
ralph-wiggum-technique-guide - Zeroshot productionizes the Ralph ...