A post by Geoffrey Huntley on his own site, dated July 14, 2025, that explains the
Ralph Loop technique he had been discussing on social media. Ralph, in the post’s
words, is a technique, and in its purest form it is a Bash loop that repeatedly pipes the same prompt
file into a coding agent: while :; do cat PROMPT.md | claude-code ; done. The post personifies the
technique as Ralph Wiggum, the character from The Simpsons, and much of its explanation proceeds by
that metaphor — Ralph makes mistakes, and each time he does, the operator “tunes” him by adding a sign
to the prompt.
Its running example is CURSED, a new esoteric programming language the author reports Ralph was building, with a compiler and, as the prompt’s stated goal, a standard library written in the language itself — and which, the author points out, Ralph was able to build and program in without the language being in the model’s training data. The post sets out the principles the author arrived at while doing this, and closes with the full prompts he was using to build and to plan the language.
Key Points
- Ralph works autonomously in a single repository as a single process performing one task per loop; the author calls it monolithic and argues multi-agent, agent-to-agent designs are not needed at this stage, likening non-deterministic agents as microservices to “a red hot mess”.
- Each loop should do one thing only, and the agent is trusted to choose the most important thing to implement next; the author calls this full hands-off vibe coding that tests the bounds of responsible engineering.
- Every loop deterministically loads the same things into context — the plan (
fix_plan.md) and the specifications — and the author’s reason for keeping each loop small is that only about 170k tokens of context window are available and outcomes worsen the more of it is used. - The primary context window should act as a scheduler that spawns subagents for expensive work; many subagents may search and write files, but only one should run build and test, because fanning validation out to hundreds of subagents produces what the author calls bad back pressure.
- A common failure is the agent searching with
ripgrep, wrongly concluding code is not implemented, and producing duplicate implementations; the fix is an instruction not to assume something is unimplemented, and the author calls this nondeterminism Ralph’s Achilles’ heel. - When Ralph generates the wrong patterns the author updates his technical standard library, and when it builds the wrong thing entirely he suspects the specifications — reporting that only a month in did he notice his lexer specification defined one keyword twice for opposing cases, which wasted a lot of time.
- Tests, type systems, static analysers and security scanners act as Backpressure that rejects invalid generated code; the author stresses wiring in a static analyser or type checker for dynamically typed languages, and weighs Rust’s correctness against its slow compilation.
- Because each loop starts with a fresh context, the agent is asked to record in documentation why each test and implementation matters, as notes for later loops that will not have the reasoning.
- Against the model’s bias toward placeholder or minimal implementations, the prompt demands full implementations, and further Ralph loops can be run to find placeholders and turn them into a to-do list.
- The to-do list is regenerated by a separate planning prompt whenever it runs out or goes off track; the author reports throwing it out repeatedly and watching it “like a hawk”.
- Ralph is allowed to update an
AGENT.mdfile with what it learns about building and running the project, which the post calls the heart of the loop. - When the codebase breaks overnight, the operator judges whether to
git reset --hardand restart or to write new prompts to rescue it; the author’s position is that any problem the loop creates can be resolved by a different series of prompts. - The author says the technique suits bootstrapping greenfield projects, expecting to get about 90% of the way, that he would not use it in an existing codebase, and that senior engineering expertise is still needed to guide it. These are the author’s own judgements from one project.
Context
The post is a firsthand account by the technique’s practitioner, argued from a single project that was still unreleased at the time of writing; the author says he held the post back because the project had significant gaps. Its strongest claims — that the technique can replace most outsourcing for greenfield work, and that current models and tools already amount to what he calls post-AGI territory — are presented as his own position rather than measured results. It links to a third-party field report from a hackathon in which a coding agent was run in a loop, as one example of the technique being tried by others.