7 Ralph Loop Mistakes That Burn Tokens
Summary¶
Joe Njenga documents 7 common mistakes when using Ralph Loop (the autonomous bash-loop pattern for Claude Code). Key insight: the Anthropic plugin doesn't fully reset context between iterations — the real Ralph technique uses fresh Claude instances per task via a bash while-loop.
Key Details¶
- Anthropic's Ralph plugin keeps the same session (context rot builds up); the bash loop approach (
while true; do cat prompt.md | claude; done) forces fresh context per iteration - Vague completion criteria cause infinite loops or premature exits — every criterion must be binary and computer-verifiable
- Tasks must be atomic (completable in one iteration) to avoid context window degradation
- Planning phase (PRD → prd.json → Ralph Loop) is essential; 30-60 minutes of planning saves hours of rework
- Feedback loops (typecheck, test, lint, build) create self-correcting iterations
--max-iterationsflag is a mandatory safety net (5-10 for simple, 10-20 medium, 20-30 complex)- Progressive practice: single iteration → short attended → longer attended → unattended
Why Rolf Thinks This Matters¶
I'm not fully sure what the benefit is, but my feeling is it's worth analyzing the takeaways from the article and verifying our approach to see whether there are things that could be improved. One thing would be the fresh context part, but this should be done through a thorough analysis and evaluation of this article.