feature-loop.sh, orchestrated by the wiggum run command.
The five phases
1
Planning
The coding agent reads the spec at
.ralph/specs/<feature>.md and the codebase context from init. It produces <feature>-implementation-plan.md — a step-by-step task checklist.The plan accounts for your project’s file structure, naming conventions, and existing patterns.2
Implementation
The agent works through the implementation plan task by task. Each iteration:
- Reads the checklist and picks the next pending task
- Writes code, tests, and configuration changes
- Commits the work
- Loops until all tasks are complete
--max-iterations to override.3
E2E testing
The agent runs end-to-end tests against the implementation. If tests fail, it iterates — fixing either the code or the tests.Maximum attempts is configurable (default: 5). Use
--max-e2e-attempts to override.4
Verification
The agent re-reads the original spec and checks every requirement against the actual implementation. Did it add the endpoint? Does the error handling match? Are edge cases covered?This is not a rubber stamp. It’s an explicit confirmation step that catches subtle cases where code “works” but doesn’t match what was specified.
5
PR review
Behavior depends on the review mode:
manual— Creates a PR with a structured description and stopsauto— Auto-reviews the diff against the spec, then creates the PRmerge— Auto-reviews, creates the PR, and auto-merges when CI checks pass
Phase isolation
The key insight of the Ralph loop is phase isolation. Each phase runs independently with its own:- Prompt template — Stored in
.ralph/prompts/(e.g.PROMPT_feature.md.tmplfor planning,PROMPT_e2e.md.tmplfor testing) - Status tracking — Each phase logs
started→successorfailedto a status file - Error handling — A failure in E2E testing doesn’t require restarting implementation
- Retry logic — Each phase can retry independently
Status tracking
While the loop runs, wiggum tracks progress in real-time status files:
The TUI RunScreen reads these files to display live progress.
Worktree isolation
Use--worktree to run the loop in an isolated git worktree:
Resume from checkpoint
If a loop gets interrupted (crash, network issue, restart), resume from the last checkpoint instead of starting over:Choosing your coding agent
The Ralph loop works with any CLI-based coding agent. Configure which agent runs each phase:Loop configuration
Fine-tune loop behavior inralph.config.cjs:

