Ralph
Run Claude as an autonomous coding agent. Give it a task, and watch it work through your entire codebase.
Quick Start (30 seconds)
# Install
pipx install ralph-agent # or: pip install ralph-agent
# Run with a simple prompt
ralph run --prompt "Add a dark mode toggle to the settings page"
That's it. Ralph will autonomously implement the feature, make commits, and report when done.
Table of Contents
Installation
From PyPI (Recommended)
# Using pipx (recommended for CLI tools)
pipx install ralph-agent
# Or using pip
pip install ralph-agent
From Source
git clone https://github.com/anthropics/ralph-agent.git
cd ralph-agent
pip install -e .
Requirements
- Python 3.9+
- Claude CLI installed and authenticated
- macOS or Linux
Usage Patterns
1. Single Task (Simplest)
Run a one-off task immediately:
ralph run --prompt "Add input validation to the login form"
2. Multi-Phase Project (Recommended)
For larger features, break work into phases and tasks:
Step 1: Initialize Ralph in your project
cd your-project
ralph init
Step 2: Edit .ide/tasks/plans/00-overview.md
# Project: User Authentication
## Phase 1: Setup
- [ ] TASK-101: Create user database schema
- [ ] TASK-102: Set up authentication middleware
## Phase 2: Implementation
- [ ] TASK-201: Build login endpoint
- [ ] TASK-202: Build registration endpoint
- [ ] TASK-203: Add password reset flow
## Phase 3: Testing
- [ ] TASK-301: Write unit tests
- [ ] TASK-302: Add integration tests
Step 3: Run Ralph
ralph run
Ralph will work through each task, checking off boxes as it completes them.
Step 4: Monitor progress
ralph status # Quick summary
ralph tasks # See all tasks
ralph history # View iteration log
3. Generate from Idea (Full Workflow)
Let Claude help you plan before executing:
# Step 1: Generate a PRD from your idea
ralph generate prd --prompt "Build a REST API for task management with teams"
# Output: .ralph/projects/<id>/PRDs/
# Project ID: abc123def456...
# Step 2: Review generated PRDs (optional)
# Step 3: Run directly by ID (recommended)
ralph run --id abc123
# OR: Convert PRD to executable plans first
ralph generate plans --from-prd .ralph/projects/abc123.../PRDs/
# Reuses same project ID, outputs to: .ralph/projects/abc123.../plans/
ralph run --id abc123
Note: Generated files are automatically organized in .ralph/projects/<id>/ for easy resumption. You can specify --output for custom locations.
Commands Reference
Core Commands
| Command | Description | Example |
|---|---|---|
ralph run |
Execute tasks | ralph run --prompt "Fix the bug" |
ralph status |
Show progress | ralph status --detailed |
ralph resume |
Continue interrupted work | ralph resume |
Generation Commands
| Command | Description | Example |
|---|---|---|
ralph generate prd |
Create PRD from prompt | ralph generate prd -p "Auth system" |
ralph generate plans |
Create phased plans | ralph generate plans --from-prd ./PRD.md |
Utility Commands
| Command | Description | Example |
|---|---|---|
ralph init |
Initialize project | ralph init |
ralph tasks |
List all tasks | ralph tasks --status pending |
ralph history |
Show iteration log | ralph history -n 20 |
ralph projects |
List all projects | ralph projects |
ralph validate |
Check plan file | ralph validate ./plan.md |
ralph reset |
Clear state | ralph reset --yes |
ralph run
The main command. Runs Claude autonomously on your tasks.
ralph run [OPTIONS]
Input Options (pick one):
| Option | Description |
|---|---|
--prompt, -p |
Direct task description |
--plans |
Directory of plan files |
--prd |
PRD markdown file or directory |
--files |
Specific plan files |
--config, -c |
JSON config file |
--id |
Resume project by ID (full or partial) |
--name |
Resume project by name |
Execution Options:
| Option | Default | Description |
|---|---|---|
--max, -m |
50 | Max iterations |
--timeout, -t |
60 | Seconds to wait for Claude |
--model |
- | Claude model to use |
--dry-run |
- | Preview without executing |
--no-commit |
- | Skip auto-commits |
--yes, -y |
- | Auto-confirm prompts |
Examples:
# Simple prompt
ralph run -p "Add logout button"
# From PRD file (single file)
ralph run --prd ./docs/PRD.md
# From PRD directory (generated format)
ralph run --prd ./PRDs/
# From plans directory
ralph run --plans ./my-feature/
# With custom settings
ralph run --plans ./plans/ --max 100 --timeout 120
# Preview only (no execution)
ralph run --plans ./plans/ --dry-run
# Auto-confirm all prompts
ralph run --plans ./plans/ --yes
# Resume by project ID (from ralph projects)
ralph run --id abc123de
# Resume by project name
ralph run --name "auth service"
Resume Workflow:
# List all projects with their IDs
$ ralph projects
ID Name Status Progress
abc123.. auth in_progress 5/10
def456.. payments pending 0/8
# Resume by ID (partial match works)
$ ralph run --id abc123
# Or resume by name
$ ralph run --name auth
ralph generate prd
Generate a Product Requirements Document from a natural language description.
ralph generate prd [OPTIONS]
| Option | Description |
|---|---|
--prompt, -p |
Feature description |
--from-file, -f |
Read prompt from file |
--output, -o |
Output directory (default: ./PRDs) |
--name, -n |
Project name |
--dry-run |
Preview prompt only |
Examples:
# From prompt
ralph generate prd -p "User authentication with OAuth and JWT"
# From file
ralph generate prd -f ./requirements.txt -o ./docs/PRD.md
# Preview what will be sent to Claude
ralph generate prd -p "New feature" --dry-run
ralph generate plans
Generate phased implementation plans from a prompt or PRD.
ralph generate plans [OPTIONS]
| Option | Description |
|---|---|
--prompt, -p |
Feature description |
--from-file, -f |
Read prompt from file |
--from-prd |
Convert existing PRD to plans |
--output, -o |
Output directory (default: ./plans) |
--phases |
Number of phases (default: auto) |
--max-tasks |
Max tasks per phase (default: 10) |
--dry-run |
Preview prompt only |
Examples:
# From prompt
ralph generate plans -p "Refactor authentication system"
# From PRD file
ralph generate plans --from-prd ./PRD.md -o ./.ide/tasks/plans/
# Specify number of phases
ralph generate plans -p "Build REST API" --phases 4
ralph status
Show current project progress.
ralph status [OPTIONS]
| Option | Description |
|---|---|
--detailed |
Show all tasks |
--json |
Output as JSON |
--dir, -d |
Working directory |
ralph tasks
List all tasks with their status.
ralph tasks [OPTIONS]
| Option | Description |
|---|---|
--status |
Filter: pending, completed, failed, blocked |
--dir, -d |
Working directory |
Examples:
ralph tasks # All tasks
ralph tasks --status pending # Only pending
ralph tasks --status completed # Only completed
ralph resume
Continue an interrupted session.
ralph resume [OPTIONS]
| Option | Default | Description |
|---|---|---|
--max, -m |
50 | Additional iterations |
--dir, -d |
. |
Working directory |
Tip: You can also just re-run the original command. Ralph auto-detects and resumes.
Plan File Format
Ralph parses markdown files with phases and tasks:
# Project: My Feature
## Phase 1: Setup
- [ ] TASK-101: Initialize project structure
- [ ] TASK-102: Configure dependencies
## Phase 2: Core Implementation
- [ ] TASK-201: Build the main component
- [ ] TASK-202: Add state management
- [ ] TASK-203: Connect to API
## Phase 3: Polish
- [ ] TASK-301: Add error handling
- [ ] TASK-302: Write tests
- [ ] TASK-303: Update documentation
Task ID Convention
Use globally unique IDs across all files:
- Phase 1:
TASK-101,TASK-102,TASK-103 - Phase 2:
TASK-201,TASK-202,TASK-203 - Phase 3:
TASK-301,TASK-302,TASK-303
Task Metadata (Optional)
Add details under each task:
- [ ] TASK-101: Create user authentication
- Priority: High
- Description: Implement JWT-based auth with refresh tokens
- Dependencies: TASK-100
Configuration
Config File (ralph.json)
Create a config file for repeated use:
{
"version": "1.0",
"project": {
"name": "my-project",
"description": "Project description"
},
"input": {
"type": "plans",
"path": ".ide/tasks/plans",
"pattern": "*.md"
},
"execution": {
"max_iterations": 50,
"idle_timeout": 60,
"sleep_between": 2,
"retry_attempts": 3
},
"claude": {
"model": "opus",
"skip_permissions": true
},
"completion": {
"update_source": true,
"commit_changes": true,
"commit_prefix": "feat:"
}
}
Then run:
ralph run --config ./ralph.json
How It Works
┌─────────────────────────────────────────────────────────────┐
│ RALPH EXECUTION LOOP │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. PARSE 2. SELECT 3. EXECUTE │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Plans │──────▶│ Next │──────▶│ Claude │ │
│ │ /PRD │ │ Task │ │ CLI │ │
│ └─────────┘ └─────────┘ └─────────┘ │
│ │ │
│ 6. REPEAT 5. UPDATE 4. PARSE │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Next │◀──────│ Mark │◀──────│ Output │ │
│ │ Task │ │ Done │ │ Stream │ │
│ └─────────┘ └─────────┘ └─────────┘ │
│ │
│ ✓ All tasks complete │
└─────────────────────────────────────────────────────────────┘
- Parse - Read plans, PRD, or prompt
- Select - Pick the next pending task
- Execute - Run Claude with task context
- Parse - Monitor output for completion
- Update - Mark task done, update checkboxes
- Repeat - Continue until all tasks complete
Multi-Project Support
Ralph tracks multiple projects independently:
# Work on feature A
ralph run --plans ./feature-a/
# Work on feature B (separate state)
ralph run --plans ./feature-b/
# See all projects
ralph projects
Each input source gets isolated state in .ralph/projects/.
Tips & Best Practices
Writing Good Tasks
# Good - Specific and actionable
- [ ] TASK-101: Add email validation to signup form with error messages
# Bad - Too vague
- [ ] TASK-101: Fix signup
Handling Interruptions
If Ralph is interrupted (Ctrl+C, timeout, etc.):
# Option 1: Run the same command again (re-parses files)
ralph run --plans ./my-feature/
# Option 2: Resume by ID (uses saved state)
ralph projects # Find your project ID
ralph run --id abc123de # Resume from saved state
# Option 3: Resume by name
ralph run --name "my feature"
# Or use resume
ralph resume
Ralph automatically continues from where it stopped.
Dry Run First
Preview what will happen before executing:
ralph run --plans ./plans/ --dry-run
Monitor Long Runs
In another terminal:
watch ralph status --detailed
Development
# Install dev dependencies
make dev
# Run tests
make test
# Lint & format
make lint
make format
# Build package
make build
License
MIT License - see LICENSE for details.
Metadata
Release files for ralph-agent 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ralph_agent-1.1.1.tar.gz | 49.6 kB | With provenance | Details for ralph_agent-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ralph_agent-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for ralph_agent-1.1.1-py3-none-any.whl |
Total release size: 115.2 kB
Release files / ralph_agent-1.1.1.tar.gz
| Download URL | ralph_agent-1.1.1.tar.gz |
|---|---|
| Size | 49.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b43cbd0353a67d784bf056c1058d06c7a65e294957d1e7dbb3801f8951e2c047
|
|
BLAKE2b-256 checksum How to use checksums |
cfa41d6531498b20781b6659ccd10d70e2515c576da58446bbae63878fd3ec4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.
Transparency logRelease files / ralph_agent-1.1.1-py3-none-any.whl
| Download URL | ralph_agent-1.1.1-py3-none-any.whl |
|---|---|
| Size | 65.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed253d672a79761532ba3574ad9324a2f3c8a8ffc778fcaa04f6093ce2c09c33
|
|
BLAKE2b-256 checksum How to use checksums |
764ea9bf1ad3f286c97cb914491fd2984701db0a902e9d4c09874c7fc66a28fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.
Transparency logSecurity for ralph-agent 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ralph_agent-1.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.