Open Ralph Wiggum β The Complete Guide
Open Ralph Wiggum is a CLI wrapper that automates the so-called "Ralph Wiggum technique": an AI coding agent is given the same prompt over and over until the task is done. Between iterations, the agent sees its own file changes and the Git history β so it can self-correct and make incremental progress. Open Ralph Wiggum supports 5 agents (Claude Code, Codex, Copilot CLI, Cursor Agent, OpenCode) and can even rotate between them to compare models head-to-head.
Repo: Th0rgal/open-ralph-wiggum Β· License: MIT
β¦ you want to rotate multiple agents/models in a loop and prefer a lean, agent-agnostic CLI. If you haven't yet decided which Ralph variant to use, first read the Ralph Wiggum technique β overview. It compares all 6 major implementations (snarktank/ralph, ralph-loop plugin, open-ralph-wiggum, ralphex, ralph-orchestrator, ralphy).
1. What is Open Ralph Wiggum?β
Classic AI coding sessions run interactively: you type, the agent answers, you correct. Ralph flips that around β you go grab a coffee, and the agent grinds through a well-defined task. The core loop looks like this:
- Send the prompt to the agent
- Agent edits files, calls tools, writes code
- CLI checks whether the completion promise (e.g.
COMPLETE) shows up in the output - If not β restart the loop (agent sees its own changes + Git history)
- If yes β done
Why does this work?β
- Self-correction through reading diffs β on the next run, the agent sees what it did last time
- Tests as ground truth β if your prompt says "done when
pnpm testis green", the agent iterates against reality, not against its own hallucinated view - Incremental progress β large tasks decompose into bite-sized chunks across iterations
Open Ralph Wiggum in the Ralph universeβ
There are several Ralph implementations β each with a different focus. Here's the short version; for the full discussion see the overview.
| Aspect | open-ralph-wiggum | snarktank/ralph | ralphex | ralph-orchestrator | ralphy |
|---|---|---|---|---|---|
| Language | Bun + TS | Bash | Go | Rust + TS | TS + Bash |
| Agents | 5 | 2 (Amp, Claude) | 1 + wrapper | 7 | 8 |
| Agent rotation | β per iteration | β | β | β | β (parallel) |
| Multi-phase reviews | β | β | β (5 review agents) | β | β |
| Parallelism | β | β | Worktrees | β | β
(--parallel) |
| Web dashboard | β | β | β | β (alpha) | β |
| MCP server | β | β | β | β | β |
| Telegram steering | β | β | β | β (RObot) | β |
| PRD format | free prompt + tasks mode | prd.json + progress.txt | Markdown plan with ### Task N | YAML/PDD | MD/YAML/JSON/issues |
| Sweet spot | Comparing models | Bash pragmatism, big community | Multi-phase review, enterprise | Hat system, MCP stack | Parallel branches + PRs |
| Stars (May 2026) | β | 18.7k | 1.1k | 2.8k | 2.8k |
Its unique selling point is --rotation: between iterations the agent switches (e.g. Claude β Codex β OpenCode). This produces heterogeneous solution paths and reduces the chance that a single model gets stuck in a dead end. No other Ralph implementation has this built in.
2. Prerequisitesβ
- Bun (runtime, required) β
curl -fsSL https://bun.sh/install | bash - At least one agent CLI on the path:
claude(Claude Code)codex(OpenAI Codex CLI)copilot(GitHub Copilot CLI)cursor-agent(Cursor headless)opencode(open-source default)
- Git repo in the current directory (for history-based self-correction)
Open Ralph Wiggum is written in TypeScript and uses Bun as its runtime instead of Node β cold start is noticeably faster, which actually matters when you have thousands of iterations per loop.
3. Installationβ
- npm (recommended)
- Bun
- From source
npm install -g @th0rgal/ralph-wiggum
ralph --version
bun add -g @th0rgal/ralph-wiggum
ralph --version
git clone https://github.com/Th0rgal/open-ralph-wiggum.git
cd open-ralph-wiggum
# Linux / macOS
./install.sh
# Windows
.\install.ps1
Verifyβ
ralph --help # List commands
ralph --init-config # Write default config
which claude codex # Agent CLIs reachable?
On Windows, Ralph automatically resolves .cmd extensions for npm-installed CLIs β you don't have to manually add anything to your PATH.
4. First loop in 30 secondsβ
mkdir demo && cd demo && git init
ralph "Erstelle eine TypeScript-Funktion add(a, b) in src/add.ts.
Schreibe einen Test in test/add.test.ts.
FΓΌhre 'bun test' aus. Wenn der Test grΓΌn ist, gib COMPLETE aus." \
--agent claude-code \
--max-iterations 5
What happens here:
- Ralph starts
claudewith your prompt - Claude creates the files
- Output contains
COMPLETEβ Ralph stops - You have a working mini-build without a single keystroke
--max-iterationsWithout a limit, a loop can run for hours and rack up token costs. Rule of thumb: --max-iterations 10 to 20 for most tasks. Only raise it when you know what you're doing.
5. Agents & modelsβ
Supported agentsβ
| Agent | Flag | Notes |
|---|---|---|
| Claude Code | --agent claude-code | Best quality for complex refactors, Sonnet/Opus |
| Codex | --agent codex | OpenAI's coding model, fast |
| Copilot CLI | --agent copilot | GitHub-integrated, good for repo context |
| Cursor Agent | --agent cursor-agent | Headless variant of the Cursor editor |
| OpenCode | --agent opencode | Open-source, default, model-agnostic |
Override the modelβ
ralph "..." --agent claude-code --model claude-opus-4-7
ralph "..." --agent codex --model gpt-5
ralph "..." --agent opencode --model openai/gpt-4o
Custom binary paths (ENV)β
| Variable | Default |
|---|---|
RALPH_OPENCODE_BINARY | opencode |
RALPH_CLAUDE_BINARY | claude |
RALPH_CODEX_BINARY | codex |
RALPH_COPILOT_BINARY | copilot |
RALPH_CURSOR_AGENT_BINARY | cursor-agent |
export RALPH_CLAUDE_BINARY="$HOME/.local/bin/claude-beta"
ralph "..." --agent claude-code
6. Agent rotation β pit models against each otherβ
Probably the most exciting mode: rotate between agents/models. A different agent is used per iteration.
ralph "Implementiere und teste eine Bloom-Filter-Klasse in src/bloom.ts.
Test grΓΌn β COMPLETE." \
--rotation "claude-code:claude-sonnet-4-6,codex:gpt-5,opencode:openai/gpt-4o" \
--max-iterations 12
What you get out of it:
- Heterogeneous approaches β Claude refactors, Codex writes fresh tests, OpenCode cleans up
- Robustness β one model hits a dead end, the next one sees the diff and corrects course
- Comparative metrics β in the
--statusdashboard you can see how many tool calls/iterations each agent consumed
--agent and --model are ignored. The rotation list is the sole source of truth.
7. Tasks mode β break down large projectsβ
For anything too big for a single prompt, there's the tasks mode.
ralph "Baue eine REST-API mit Auth, CRUD und Tests laut PRD.md" \
--tasks \
--agent claude-code \
--max-iterations 50
How it worksβ
- Tasks are maintained in
.ralph/ralph-tasks.md - One task per iteration β the agent stays focused
- Default promise:
READY_FOR_NEXT_TASK(instead ofCOMPLETE) - Status markers:
[ ]open Β·[/]in progress Β·[x]done
Manage tasks from the outsideβ
ralph --list-tasks
ralph --add-task "Rate-Limiting via Redis hinzufΓΌgen"
ralph --remove-task 3
8. Live-controlling the loopβ
While the loop runs, you can step in from a second terminal.
ralph --status # What's running, how long, which tools
ralph --add-context "Nutze Vitest, nicht Jest" # Inject a hint
ralph --clear-context # Discard the hint
--add-context writes to .ralph/ralph-context.md. The hint flows into the next iteration β the currently running tool call is not interrupted.
The status dashboard showsβ
- Iteration, elapsed time, original prompt
- Pending context (what will be injected on the next run)
- Current tasks (in tasks mode)
- The last 5 iterations with tool counts (Bash, Write, Read, Edit) and duration
- Struggle indicators β warns when the agent is stuck (no file changes, same errors)
9. Custom prompt templatesβ
If you want to customize the standard prompt header, pass a template:
ralph "..." --prompt-template ./my-template.md
Available variablesβ
| Variable | Meaning |
|---|---|
{{iteration}} | current iteration |
{{max_iterations}} | limit |
{{min_iterations}} | minimum before completion is allowed |
{{prompt}} | your task prompt |
{{completion_promise}} | completion signal (default COMPLETE) |
{{abort_promise}} | abort signal |
{{task_promise}} | task completion signal (tasks mode) |
{{context}} | injected mid-loop context |
{{tasks}} | task list (tasks mode) |
Minimal templateβ
# Iteration {{iteration}} / {{max_iterations}}
## Aufgabe
{{prompt}}
## Wenn fertig
Gib **{{completion_promise}}** in deine letzte Output-Zeile.
## Aktueller Hinweis
{{context}}
10. State & storageβ
- ralph-loop.state.json β active loop state
- ralph-history.json β iteration metrics
- ralph-context.md β pending context
- ralph-tasks.md β task list (tasks mode)
- ralph-questions.json β open follow-up questions
.ralph/ in .gitignoreThe folder contains volatile loop state β don't commit it. A single entry in .gitignore is enough. The repo itself (i.e. the code changes) is unaffected.
11. Important flags β cheatsheetβ
# Loop control
--agent <name> # Pick agent
--model <name> # Override model
--rotation "a:m,b:m" # Agent rotation
--max-iterations N # Hard limit
--min-iterations N # Complete no earlier than N
--completion-promise "STRING" # Default: COMPLETE
--abort-promise "STRING" # Early abort
--prompt-file, -f <path> # Prompt from file
--prompt-template <path> # Custom template
--tasks, -t # Tasks mode
# Output
--no-stream # Output at the end (instead of streaming)
--verbose-tools # Show all tool operations
--questions / --no-questions # Interactive follow-ups (default: on)
# Safety / behavior
--allow-all / --no-allow-all # Tool permissions (default: allow)
--no-plugins # OpenCode: disable plugins
--no-commit # No auto-commits
--config <path> # Custom agent config
--init-config [path] # Write default config & exit
# Live control (in a second terminal)
--status
--add-context "TEXT"
--clear-context
--list-tasks
--add-task "TEXT"
--remove-task <index>
12. Safety β required readingβ
--allow-all is the defaultRalph approves the agent's tool calls automatically by default. That's the whole point of the exercise β otherwise there'd be no autonomous loop. But: the agent can do anything you could do in your shell.
Mitigations:
- Only run loops in dedicated repos, never in your home directory
- Clone sensitive repos into a VM or container first (Docker, Daytona, sandboxed.sh)
- API keys via
.envβ not in prompts, not in the repo - When in doubt:
--no-allow-allβ interactive confirmation (kills autonomy, but it's safe)
By default, Ralph commits after every iteration. That's excellent for debugging (git log shows every iteration), but it pollutes the history. For "real" branches β --no-commit and squash manually at the end.
When Open Ralph Wiggum is not the right toolβ
- Tasks that require human judgment (design decisions, trade-offs)
- Production debugging with real users β caution beats speed here
- Tasks without a verifiable success criterion β without tests or a linter, the loop spins until the iteration limit without you knowing whether it's actually "done"
13. Prompt best practicesβ
A good Ralph prompt has 4 parts:
## Ziel
Implementiere die JWT-Auth laut PRD.md.
## Akzeptanzkriterien
1. POST /login gibt bei korrekten Credentials einen Bearer-Token zurΓΌck.
2. GeschΓΌtzte Routen (/me) liefern bei fehlerhaftem Token 401.
3. `pnpm test` lΓ€uft grΓΌn.
4. `pnpm lint` lΓ€uft ohne Fehler.
## Verifikation
FΓΌhre `pnpm test && pnpm lint` aus, bevor du COMPLETE schreibst.
## Completion
Wenn alle Kriterien erfΓΌllt sind, gib in der letzten Zeile `COMPLETE` aus.
For extensive feature lists, a structured JSON schema (features as a list with id, title, acceptance: []) reduces the agent's tendency to rewrite existing tests instead of satisfying them.
14. Common problemsβ
| Problem | Solution |
|---|---|
bun: command not found | Install Bun (curl -fsSL https://bun.sh/install | bash) |
claude / codex / copilot: command not found | Install the agent CLI separately, set RALPH_*_BINARY if needed |
| Loop never stops | Set --max-iterations; make the completion promise explicit in the prompt |
| Agent is stuck, changes nothing | Check status (--status) β struggle warnings; --add-context with a hint |
| Auto-commits explode | --no-commit + git rebase -i at the end |
| "Tests green, but wrong" | Agent rewrote the tests β tighten the acceptance criteria, use a JSON PRD |
| Token costs too high | Stricter --max-iterations, shorter template, smaller model |
15. Further readingβ
Open Ralph Wiggum
- GitHub: Th0rgal/open-ralph-wiggum
Ralph universe (see the overview)
- snarktank/ralph β most popular Bash variant (Ryan Carson)
- anthropics/claude-plugins-official β ralph-loop β official Claude Code plugin (stop hook, in-session loop)
- umputun/ralphex β Go, multi-phase reviews
- mikeyobrien/ralph-orchestrator β Rust, hat system, MCP, Telegram
- michaelshimeles/ralphy β parallel worktrees + PRs
- Original technique: Geoffrey Huntley's blog β "Ralph Wiggum as a Software Engineer"
- Sandboxing: sandboxed.sh
Agent CLIs that Ralph uses
"Run the same prompt in a loop until the agent's diff catches up with reality."