Large Refactors
Rename across hundreds of files. Update API contracts. Migrate frameworks.
ralph is a CLI tool that orchestrates AI coding agents in iterative loops. It implements the “Ralph Wiggum” technique—resetting context windows between iterations while preserving state through your codebase.
AI models have a fundamental limitation: as context accumulates, performance degrades. Anthropic’s research on long-running agents confirms what practitioners have observed:
When the context window fills up, the model gets dumb.
ralph solves this by:
The magic: the prompt stays the same, but the codebase changes. Each iteration, the model reads updated files, git history, and test results—learning from its own output.
The technique was coined by Geoffrey Huntley, who described it beautifully:
“Ralph is a Bash loop.”
The name captures something real about the technique:
ralph supports multiple AI coding tools:
ralph implements best practices from Anthropic’s research on effective harnesses for long-running agents:
ralph isn’t a toy. It’s been used to:
Large Refactors
Rename across hundreds of files. Update API contracts. Migrate frameworks.
Test Coverage
Add tests for all modules systematically. The loop continues until coverage targets are met.
Documentation
Generate docs for every function, class, and module. Consistent style throughout.
Migrations
Database schema changes. Framework upgrades. Language version bumps.
ralph isn’t the right choice for everything:
Ready to dive in?