Ralph Workflow
Ralph Workflow is an unattended AI agent orchestrator for long-running development tasks. Write a detailed specification in PROMPT.md, start Ralph, and walk away. It coordinates AI agents through multiple development iterations and review cycles, producing commits automatically.
Ralph works best when you think like a Product Manager: scope out every detail of the feature you need. The more detail in your specification, the better Ralph performs. It is designed to run for hours without babysitting.
Inspired by Geoffrey Huntley's Ralph Workflow concept.
When to Use Ralph
Ralph excels at:
- Long-running feature implementations with detailed specifications
- Systematic refactoring workflows requiring multiple iterations
- Test suite generation with comprehensive review
- Documentation writing with multiple review passes
- Any task where you can write a detailed spec and let it run unattended
Not ideal for:
- Vague or undefined requirements (Ralph needs detailed specs)
- Simple one-off commands (use Claude Code directly)
- Real-time interactive debugging
- Tasks requiring human judgment at each step
How It Works
Ralph runs a multi-phase workflow:
-
Development Phase: Runs for a configured number of iterations
- Outer loop: Runs N iterations (configured by
-Dordeveloper_iters) - Inner loop: Plan → Develop → Analyze → Developer refines until satisfied
- Auto-commits after each iteration
- Outer loop: Runs N iterations (configured by
-
Review Phase: Runs for a configured number of cycles
- Outer loop: Runs N cycles (configured by
-Rorreviewer_reviews) - Inner loop: Analyzer → Fixer loops until issues are resolved
- Auto-commits after each cycle
- Outer loop: Runs N cycles (configured by
-
Commit Phase: Generates a meaningful commit message via AI
Ralph automatically cleans AI agent context between phases to prevent context pollution. Each phase operates with fresh context—the reviewer sees only the diff and current code state, not the development history.
All orchestration is handled internally by Ralph, ensuring deterministic, reliable operation.
Quick Start
1. Install
# Install from source
# Or build + install via Makefile
Alternatively you can use cargo crate
2. Install AI Agents
Install at least one AI agent:
| Agent | Install | Recommended Role |
|---|---|---|
| Claude Code | bun install -g @anthropic/claude-code |
Developer |
| Codex | bun install -g @openai/codex |
Reviewer |
| OpenCode | See opencode.ai | Either |
3. Run Ralph
# Create config file (smart init detects what you need)
# Navigate to your git repo
# Create PROMPT.md from a Work Guide
# Edit PROMPT.md with detailed requirements
# Run Ralph and walk away
Work Guides
Work Guides are templates for describing your tasks to the AI. Use them with --init:
# See all available Work Guides
# Create PROMPT.md from a Work Guide
# Overwrite existing PROMPT.md
Note: Work Guides (for PROMPT.md) are different from Agent Prompts (backend AI behavior). Run ralph --extended-help for details.
Writing Effective Specifications
Your PROMPT.md should be detailed. Example:
Refactor the authentication module to use OAuth2 instead of basic auth.
1. 2.3.4.
- --
- -
Common Commands
Preset Modes (control thoroughness)
Custom Iterations
Choose Agents
Verbosity Control
Recovery
Configuration
Ralph uses ~/.config/ralph-workflow.toml:
Configure reusable agent chains and bind drains to them:
[]
= 5
= 2
[]
= ["claude", "codex", "opencode"]
= ["codex", "claude"]
[]
= "developer"
= "developer"
= "reviewer"
= "reviewer"
= "reviewer"
= "developer"
Environment variables override config:
RALPH_DEVELOPER_AGENT- Developer agentRALPH_REVIEWER_AGENT- Reviewer agentRALPH_DEVELOPER_ITERS- Developer iterationsRALPH_REVIEWER_REVIEWS- Review cyclesRALPH_VERBOSITY- Output detail (0-4)
Files Created by Ralph
.agent/
├── commit-message.txt # Generated commit message
├── checkpoint.json # For --resume
├── start_commit # Baseline for diffs
└── logs/ # Detailed per-phase logs
Internal orchestration files are managed by Ralph and should not be edited manually.
Documentation
Full documentation is available on Codeberg:
- Quick Reference - Cheat sheet for commands and flags
- Agent Compatibility - Supported AI agents and configuration
- Git Workflow - How Ralph handles commits and diffs
- Template Guide - PROMPT.md Work Guides and agent prompt customization
- Architecture - Reducer/event-loop architecture and codebase tour
Note: When viewing on crates.io, these links point to the source repository on Codeberg.
FAQ
Can I use Ralph at work?
Yes. Ralph is a local CLI tool. The AGPL license covers only the Ralph source code, not anything you create with it.
Does AGPL apply to my generated code?
No. The AGPL covers only Ralph itself, not your code or Ralph's output.
What if Ralph gets interrupted?
Use ralph --resume to continue from the last checkpoint.
Cargo Features
| Feature | Default | Description |
|---|---|---|
monitoring |
Yes | Enable streaming metrics and debugging APIs |
test-utils |
No | Enable test utilities (TestLogger, TestPrinter, MemoryWorkspace) |
hardened-resume |
Yes | Enable execution history and file state capture for recovery |
To use test-utils for integration testing:
[]
= { = "0.6", = ["test-utils"] }
Contributing
Contributions welcome!
- Fork the repository
- Create a feature branch
- Run tests:
cargo test - Run lints:
cargo clippy && cargo fmt --check - Submit a pull request
License
AGPL-3.0. See LICENSE.