Bootstrap Ralph in any project - the AI coding loop that lets you ship while you sleep.
Ralph is a technique created by Geoffrey Huntley for running AI coding agents in a loop:
- You describe what you want to build
- Claude interviews you and creates a PRD (task list)
- Claude implements tasks one at a time, committing after each
- You come back to working code
curl -fsSL https://raw.githubusercontent.com/xaelophone/ralph-setup/main/install.sh | bash
exec $SHELL # Reload PATHmkdir my-new-app && cd my-new-app
git init
setup-ralph # Creates CLAUDE.md + progress.txt
claude # Claude will interview you and create PRD.md
# Once PRD.md exists with tasks:
ralph-loop # Run autonomously overnightcd my-existing-project
setup-ralph # Creates CLAUDE.md + progress.txt
# Option A: Let Claude analyze and create a PRD
claude # Tell Claude what you want to build/fix
# It will create PRD.md with tasks
# Option B: Create PRD.md yourself with tasks, then run:
ralph-loop # Claude works through your task listIf you plan features as GitHub Issues (recommended for teams):
cd my-project
setup-ralph # Initialize Ralph files
ralph-gh link 42 # Link to GitHub Issue #42
ralph-gh sync # Create PRD.md from issue content
# Edit PRD.md to break into atomic π€/π§ tasks
claude # Implement
ralph-gh post # Post progress back to the issueCome back in the morning to find:
- β
Completed tasks in
PRD.md - π Work log in
progress.txt - π§ Human tasks listed in
HANDOFF.md(if any)
| Tool | Description |
|---|---|
ralph-gh |
Bridge between GitHub Issues and local Ralph files |
setup-ralph |
Initializes a project with CLAUDE.md and progress.txt |
ralph-loop |
Autonomous Claude runner with completion detection |
Creates the Ralph workflow files in your project:
setup-ralph
# Creates:
# CLAUDE.md - Instructions for Claude (the Ralph workflow)
# progress.txt - Log of completed workRuns Claude autonomously with real-time completion detection:
ralph-loop # Run with defaults
ralph-loop --max-iterations 5 # Limit iterations
ralph-loop --resume # Resume crashed session
ralph-loop --status # Show session statusKey features:
- π Automatic restart when Claude's context fills up
- β
Detects
<promise>COMPLETE</promise>token to continue to next task - πΎ Session persistence with crash recovery
- π Cross-iteration context injection
- π€ Skips human tasks (π§), works only on AI tasks (π€)
Output example:
βββββββ ββββββ βββ βββββββ βββ βββ
βββββββββββββββββββ βββββββββββ βββ
βββββββββββββββββββ ββββββββββββββββ
βββββββββββββββββββ βββββββ ββββββββ
βββ ββββββ ββββββββββββββ βββ βββ
βββ ββββββ ββββββββββββββ βββ βββ
Autonomous Claude Loop v2.0.0
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Iteration 3 of 100
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Progress: 5/12 tasks (41%)
Remaining: 7 π€ tasks, 3 π§ tasks
Current: Implement user authentication
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Bridges GitHub Issues (strategic planning) with local Ralph files (tactical execution):
ralph-gh link 42 # Link project to issue #42
ralph-gh sync # Create PRD.md from issue content
ralph-gh post # Post progress summary as issue comment
ralph-gh status # Show current link and progressThe two-layer approach:
| Layer | Where | Purpose |
|---|---|---|
| Strategic | GitHub Issues | Team visibility, stakeholder access, cross-project planning |
| Tactical | PRD.md + progress.txt | Within-session task tracking, context recovery |
This lets you keep GitHub Issues for high-level planning while using Ralph's local files for the granular task execution that Claude needs.
I was building my own terminal UI (rwatch in Go/Bubbletea) to support the core ralph loop when I came across ralph-tui - a beautifully polished implementation that does everything I wanted and more. Rather than reinvent the wheel, I'm recommending it here:
# Install Bun first (if needed)
curl -fsSL https://bun.sh/install | bash
exec $SHELL
# Install ralph-tui
bun install -g ralph-tui
# Run
ralph-tuiralph-tui provides:
- π¨ Beautiful React-based TUI
- π Plugin system for different trackers (JSON, Beads)
- π Desktop notifications
- π Subagent tracing (see Claude's tool calls)
- π Session resume with full state
When to use which:
| Scenario | Use |
|---|---|
| Headless/CI, minimal dependencies | ralph-loop |
| Interactive development, fancy UI | ralph-tui |
Note: The experimental
rwatchGo code is still in this repo undercmd/rwatch/andinternal/if you want to build your own native TUI. Runmake buildto compile it.
Mark tasks in your PRD.md to control what runs autonomously:
- [ ] π€ Create API endpoint # Claude does this
- [ ] π§ Set up AWS account # Human does this (skipped)
- [x] π€ Write database schema # Already doneralph-loop and ralph-tui detect when Claude finishes a task using a special token:
<promise>COMPLETE</promise>
Claude outputs this after:
- Implementing the task
- Passing tests
- Committing code
- Updating progress.txt
This lets the loop know to continue to the next task automatically.
Claude will create something like this:
# My App - PRD
> **Legend:** π€ = AI task | π§ = Human task
## Tasks
### Phase 1: Foundation
- [x] π€ Set up project structure
- [x] π€ Create data models
- [ ] π€ Implement API endpoints
- [ ] π§ Set up production database
### Phase 2: Features
- [ ] π€ Add authentication
- [ ] π€ Create user dashboard
- [ ] π§ Configure OAuth providerβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Read PRD.md (task list) and progress.txt (history) β
β 2. Pick the highest-priority incomplete π€ task β
β 3. Implement ONLY that task β
β 4. Run tests and type checks (must pass!) β
β 5. Mark task complete in PRD.md β
β 6. Update progress.txt with what was done β
β 7. Commit changes β
β 8. Output <promise>COMPLETE</promise> β
β 9. Loop detects token, continues to next task β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Good tasks (~15-30 min):
- "Create login form component"
- "Add API endpoint for /users"
- "Write tests for auth service"
Bad tasks (too big - break them down):
- "Implement user authentication"
- "Build the entire dashboard"
For best results running overnight:
- Mark tasks clearly with π€ or π§
- Ensure tests exist and pass
- Run
ralph-looporralph-tui - Check HANDOFF.md in the morning for blocked/human tasks
| Problem | Solution |
|---|---|
| "CLAUDE.md not found" | Run setup-ralph first |
| "Another ralph-loop running" | Delete .ralph.lock or use --resume |
| Claude doesn't complete tasks | Add completion protocol to CLAUDE.md |
| Tasks too big | Ask Claude to "break this down into smaller tasks" |
- Ralph creator: Geoffrey Huntley
- ralph-tui: subsy/ralph-tui - Full-featured TUI
- This guide based on: Matt Pocock's guide
MIT - Do whatever you want with it!