Agentic Engineering
RALPH Loops
The brute-force agent technique: the same prompt, an infinite shell loop, and a completely fresh context every iteration. Geoffrey Huntley’s method, documented accurately, including where it breaks and how to run it without handing your machine away.
What A RALPH Loop Actually Is
A RALPH loop is a shell loop that runs the same prompt against a coding agent over and over, forever, with a brand new context window every time. That is the entire technique. No orchestrator, no scheduler, no message bus, no agent-to-agent protocol. The loop starts the agent. The agent reads the repository to work out where things stand. It does one thing. It exits. The loop starts it again.
The technique is not ours. It comes from Geoffrey Huntley, who published Ralph Wiggum as a “software engineer” on 14 July 2025. Read the original. Our page is a reference, not a replacement, and Huntley’s write-up carries detail and hard-won operator judgement that no summary preserves.
RALPH is not an acronym. It has no expansion. If someone hands you a backronym, they made it up. The name is a reference to Ralph Wiggum from The Simpsons, and the joke is load-bearing: the technique looks far too stupid to work. Huntley’s own framing is that “Ralph is a technique. In its purest form, Ralph is a Bash loop,” and that its strength is being “deterministically bad in an undeterministic world.” Predictable failure is tunable. Creative failure is not.
# Huntley's minimal form, verbatim from the original post
$ while :; do cat PROMPT.md | claude ; done
# What people actually run unattended, with a bound on it
$ ITER=0
$ while [ $ITER -lt 20 ]; do
> cat PROMPT.md | claude -p --dangerously-skip-permissions
> git push origin "$(git branch --show-current)" || true
> ITER=$((ITER + 1))
> done
The loop is deliberately harness-agnostic. Huntley’s constraint is only that “Ralph can be done with any tool that does not cap tool calls and usage.” People run it with Claude Code, Amp, Codex and OpenCode. Which harness, which model and which permission posture you pick is a separate decision with its own trade-offs, covered on harness engineering.
One point of honesty about the record. The first public write-up is dated 14 July 2025 and we can verify that directly. Community histories place an earlier public demonstration in June 2025, and at least one secondary account dates the original discovery to early 2024. Those earlier dates are plausible but we could not corroborate them from a primary source, so we are not going to assert them as fact.
Why Throwing Away The Context Is The Feature
The instinct is that restarting the agent destroys everything it learned. It does. That is the point.
A long-running agent session degrades. Huntley’s working rule is that you have roughly 170k of context to play with and that “the more you use the context window, the worse the outcomes you’ll get.” Community playbooks put the reliable band lower still, treating the first half of the window as the zone where the model is genuinely sharp. Past that, the agent is reasoning over a transcript stuffed with its own dead ends, abandoned hypotheses and file contents that were true forty minutes ago. It repeats itself. It re-solves solved problems. It describes code that no longer exists, confidently.
RALPH sidesteps all of that by never letting a session get long enough to rot. Every iteration is short, clean, and starts from the same known state. The memory does not live in the transcript. It lives in the repository: the source tree, the test suite, the git history, and a plan file the agent maintains for itself. The window economics behind this trade are covered on context engineering.
The Prompt Must Be Idempotent And State-Derived
Because every iteration is byte-identical, the prompt cannot say “now do step four.” It has no idea which step it is on. It has to say something closer to: read the current state, decide what matters most, do exactly one thing, prove it, write down what you did.
Idempotent
Running the prompt twice on the same repository must not duplicate work. This is why “do not assume it is not implemented” is the single most repeated guardrail in the whole technique. Huntley: “A common failure scenario for Ralph is when the LLM runs ripgrep and comes to the incorrect conclusion that the code has not been implemented.” He calls that nondeterminism the Achilles heel of the method.
State-Derived
The next action has to be readable off disk. A plan file is the shared state between otherwise isolated runs, and the agent both consumes it and updates it. Huntley watches his plan file “like a hawk” and throws it out often. Regenerating a plan costs one loop. Letting a wrong plan drive fifty loops costs a night.
Self-Documenting
The next iteration will not remember why. So the current one must record it. Huntley instructs the loop to capture the reasoning behind a test inside the test itself, so a future iteration can judge whether a red test means the code is wrong or the test is obsolete. Without that, loop fifteen deletes the test loop four wrote for a good reason.
And one item per loop. Huntley repeats himself on purpose: “One item per loop. I need to repeat myself here, one item per loop.” You may loosen it as a project stabilises. The moment things go sideways, tighten it back down. The instruction itself, its constraints and its acceptance criteria are the subject of prompt engineering.
Read specs/ to understand the requirements.
Read IMPLEMENTATION_PLAN.md to understand the plan so far.
Read AGENTS.md to learn how to build and test this project.
Choose the single most important unfinished item from the plan.
Before changing anything, search the codebase to confirm it is not
already implemented. Do not assume it is missing.
Implement it fully. No placeholders, no stubs, no TODO markers.
Run the tests for the unit you changed.
If the build or the tests fail, fix them before you finish.
When the tests pass: update IMPLEMENTATION_PLAN.md, run git add -A,
and commit with a message describing what changed.
If you could not commit, say so plainly and state what blocked you.
If you learn something about how to build or test this project,
append it to AGENTS.md. Keep it short.
Backpressure, And Telling Progress From Thrash
Generation is cheap now. Verification is the entire job. Huntley splits the technique into two phases: generate, then backpressure. Backpressure is anything that mechanically rejects invalid work. A type system. A compiler. A test suite. A linter, a static analyser, a security scanner. His constraint is that “the wheel has got to turn fast,” so you balance strictness against cycle time rather than maximising either.
Without backpressure a RALPH loop does not fail loudly. It thrashes quietly, and it bills you for the privilege. Learn to read the difference from outside the loop.
Progress looks like: the commit graph advances every few iterations. The plan file gets shorter. Test count rises. Version tags increment. The agent instructions file accumulates real operational detail about how to build the thing.
Thrash looks like: the same file rewritten in alternating directions across iterations. Plan items marked done, then quietly re-added. A second implementation of something that already exists, because a search came back empty. Stub functions and placeholder returns. Huntley’s counter-prompt against that last one is deliberately shouty, and his diagnosis is worth internalising: the models chase a reward function, and the reward function is code that compiles, not code that works.
The gate we would treat as non-negotiable before leaving a loop unattended: an iteration that cannot commit has not made progress, no matter how good its closing summary sounds. Require a clean build before commit. Require a scoped test run for the unit just changed. Then read the git log, not the agent’s prose. The general theory of termination, oscillation and evidence across all loop shapes is covered on loop engineering.
How To Make It Stop, And What It Costs
while : has no exit condition. That is a design choice rather than an oversight, and it makes termination your problem. Three bounds are worth wiring in before you walk away.
An iteration cap. Community loop scripts wrap the core loop in a counter. Anthropic’s official Ralph Wiggum plugin exposes a --max-iterations flag and its own documentation calls it “your primary safety mechanism.” Note carefully what the cap bounds: it limits the outer loop, meaning tasks attempted, not tool calls inside a single iteration. One iteration can still run away on its own.
A completion signal. A phrase the agent emits once acceptance criteria are met, which the loop checks for. Useful, but brittle alone. Exact string matching cannot tell “finished” apart from “gave up,” which is exactly the distinction you care about at 4am.
A spend ceiling. Tokens are the real limit. Huntley has reported roughly ten and a half US dollars an hour for a mid-tier model running in a loop, and separately a fifty-thousand-dollar contract delivered as a tested MVP for two hundred and ninety-seven dollars of model spend. Both figures come from one operator on greenfield work. We have not reproduced either and we are not presenting them as a quote you can plan against. Treat them as evidence that the technique is cheap relative to a contract, not as a rate card.
Watch the first hour yourself. The prompts you start with will not be the prompts you finish with. They evolve by observing exactly how the loop fails and adding a guardrail for each failure. Huntley describes it as tuning a guitar, and there is no shortcut past sitting there and watching the stream for a while.
The Safety Warning This Technique Deserves
To loop unattended, the agent cannot stop and ask. In practice that means --dangerously-skip-permissions or its equivalent on whatever harness you run. The flag does precisely what its name says. It removes the approval step from every tool call, including file writes, arbitrary shell commands and network access.
The published playbook is blunt about the consequence and we agree with it word for word: once you bypass permissions, the sandbox is your only security boundary. Running without one exposes credentials, browser cookies, SSH keys and access tokens sitting on your machine. The framing to hold onto is that it is not a question of whether something gets popped, but when, and what the blast radius is when it does.
The practical minimum before you start a loop:
- Not your main checkout. A container, or at minimum a dedicated git worktree on its own branch. The blast radius should be one directory you are willing to delete.
- Commit or stash first.
git reset --hardis your undo button and it only works from a clean baseline. - Minimum viable credentials. Only the keys the task needs. No production secrets. No deploy keys it will never use.
- Restrict network egress where the platform lets you.
- Know the stop. Ctrl+C ends the loop, but only between iterations. An iteration already running will finish what it started.
One more limit, from the author himself, and we have not seen a convincing counter-argument: “There’s no way in heck would I use Ralph in an existing code base.” He positions it as a greenfield bootstrapping technique that gets you roughly ninety percent of the way, and he is equally direct that this is not autonomy. His words: anyone claiming engineers are no longer required, and that a tool does one hundred percent of the work, is selling you something.
When A Gauntlet Loop Is The Better Tool
RALPH’s judge is mechanical. A test passes or it does not. That is a strong signal and a narrow one. A green suite cannot tell you the API is confusing, the copy is wrong, the layout collapses at 360px, or the abstraction you just committed is a trap that costs you six months.
When the acceptance criteria resist automated checking, the loop needs a different kind of judge: an adversarial one. That is what we call a Gauntlet Loop, a pattern named publicly by Matt Shumer that we run as standing build doctrine. A builder produces a real artifact. A separate critic receives fresh context, judges the actual result rather than the builder’s description of it, and has the authority to reject. The largest gap goes back to a builder and the loop repeats.
The difference is not the shape of the loop. It is who decides. RALPH trusts the compiler. The Gauntlet trusts an independent reviewer with fresh eyes and a real veto. If you are running many agents against a dependency graph rather than a single repeating task, that is a third shape again, covered on graph engineering.
| RALPH Loop | Gauntlet Loop | |
|---|---|---|
| Origin | Geoffrey Huntley, published July 2025 | D-Central internal build doctrine |
| Shape | One agent, same prompt, infinite restart | Builder, then independent critic, then rebuild |
| Who decides it is done | The build and the test suite | A separate agent with fresh context and a real veto |
| Memory between passes | The repository, git history and a plan file | The artifact plus a written review packet |
| Best for | Greenfield bootstrapping with mechanical acceptance criteria | Work whose quality bar a compiler cannot check |
| Breaks down when | Correctness is subjective, or the codebase is large and established | The critic is not genuinely independent or cannot reject |
| Stops when | Iteration cap, completion phrase, or you hit Ctrl+C | The artifact clears the bar, or a human declines to co-sign |
Running Loops In DCENT_ADE
DCENT_ADE is terminal-first, so the honest answer is that a RALPH loop runs the way it always has. A shell in a terminal tab, native PTY, nothing clever required. Shells are part of the native host’s harness catalog alongside Claude Code, Codex, Gemini and OpenCode, so the loop you paste is the loop that runs.
What the environment adds is the part a bare bash loop never had.
- Isolation is the default, not a discipline you have to remember. Mission Control’s worktree isolation means a loop works in its own checkout rather than your main one.
- Observation you can trust. Orion’s awareness layer distinguishes busy, idle, awaiting input and finished from real terminal behaviour rather than from optimistic guesses. A loop that has silently gone to sleep on a permission prompt looks different from a loop that is working, which is precisely the distinction that matters when you check on it in the morning.
- Authority stays native. The Tauri and Rust host owns spawn, egress and tool server registration. The WebView gets no general spawn, SQL or fetch authority. Turning off an agent’s own permission prompts does not turn off the host’s controls.
- Local inference where it fits. Ollama and LM Studio discovery with model-role assignment means a local model can take a loop’s high-volume, low-stakes iterations. Cloud is an explicit, consented boundary and never an invisible fallback.
- No fake success. The current catalog execution layer refuses to claim a git merge it did not perform. In a loop, a false success report is worse than a failure, because the next iteration builds on top of it.
We build DCENT_ADE with Gauntlet Loops rather than RALPH loops, for the reason set out above: most of our acceptance criteria are not compiler-checkable. That is a fit judgement about our work, not a criticism of the technique. For greenfield code with a fast, strict test suite, RALPH is remarkably hard to beat on cost.
DCENT_ADE is free, open and as-is. No paid tier, no gatekeeping, no features held back for a licence. If you use it commercially or it earns you money, a voluntary subscription or donation is expected and never enforced: d-central.tech/fund. Start at the agentic engineering hub if you want the rest of the ladder.
Related products, repair, and setup paths
- how D-Central diagnoses ASIC repairs
- ASIC troubleshooting library
- ASIC manuals and repair guides
- replacement hashboards
- ASIC control boards
- ASIC power supplies
- S19 family replacement hashboard
- C52 replacement control board
- APW12 S19 power supply
- compare specs in the ASIC miner database
- compare ASIC miner specs
- ASIC miner database
- ASIC repair services
- Antminer S19 specs and profitability
- buy a tested Antminer S19
- Antminer S19 maintenance guide
- Antminer S19 repair service
- Antminer S21 specs
- Bitmain Antminer S21
- Antminer S21 maintenance guide
- BM1370BC S21 Pro chip
Last reviewed August 13, 2026.
