AI-powered autonomous development swarm orchestrator. Uses Claude Code and Beads to manage iterative, spec-driven development.
Ensure you have the required dependencies installed first.
# Clone the repository
git clone https://github.com/your-org/ralph-swarm.git
cd ralph-swarm
# Build and install locally
./build.sh publish-localAfter installation, the ralph command will be available globally.
# Create and enter project directory
mkdir my-project && cd my-project
# Initialize the project
ralph init
# Research technologies and best practices (optional)
ralph research
# Define V0 specifications interactively
ralph specify
# Create epics and stories from specs
ralph plan
# Start building with workers
ralph build --workers 2
# Check progress
ralph statusRalph Swarm follows a five-stage workflow that takes a project from idea to implementation. Each stage builds on the previous one, creating a structured pipeline for autonomous development.
┌───────────────────────────────────────────────────────────────────────────────────┐
│ RALPH SWARM WORKFLOW │
└───────────────────────────────────────────────────────────────────────────────────┘
┌────────┐ ┌──────────┐ ┌─────────┐ ┌────────┐ ┌────────┐
│ INIT │ ──▶ │ RESEARCH │ ──▶ │ SPECIFY │ ──▶ │ PLAN │ ──▶ │ BUILD │
└────────┘ └──────────┘ └─────────┘ └────────┘ └────────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
Project setup Research docs Spec documents Beads issues Working code
AGENTS.md docs/research/ in specs/ (epics/tasks) Git commits
Subagents (optional) Review rules Dependencies ADRs
┌────────────────────────┐
│ STATUS/SHUTDOWN/CLEANUP│
│ (anytime) │
└────────────────────────┘
Command: ralph init
Purpose: Bootstrap a new project with the required structure and configuration for ralph-swarm to operate.
- Prompts for project information:
- Project objective (what it does)
- Problem statement (why it exists)
- Tech stack (languages, frameworks, libraries)
- Initializes git repository (if not exists)
- Initializes beads issue tracking
- Creates project scaffolding
| Input | Source | Description |
|---|---|---|
| Objective | User prompt | What the project does |
| Problem | User prompt | What problem it solves |
| Tech Stack | User prompt | Technologies to use |
| Output | Location | Description |
|---|---|---|
AGENTS.md |
Project root | Project context for Claude agents |
specs/ |
Directory | Empty directory for specifications |
adr/ |
Directory | Empty directory for Architecture Decision Records |
.beads/ |
Directory | Beads issue tracking database |
.claude/agents/ |
Directory | Subagent definitions |
build.sh |
Project root | Build script scaffold |
.gitignore |
Project root | Standard ignores |
| Agent | File | Purpose |
|---|---|---|
code-reviewer |
.claude/agents/code-reviewer.md |
Reviews code changes for quality and security |
are-we-done |
.claude/agents/are-we-done.md |
Verifies build/tests pass before task completion |
adr |
.claude/agents/adr.md |
Documents architectural decisions |
$ mkdir my-cli-tool && cd my-cli-tool
$ ralph init
╭──────────────────────────────────────────────╮
│ Ralph Swarm - Project Initialization │
│ Directory: my-cli-tool │
╰──────────────────────────────────────────────╯
What is the main objective of this project?
> A CLI tool for managing Docker containers
What problem does it solve?
> Simplifies common Docker operations for developers
What tech stack will you use?
> Python, Click, Rich, Docker SDK
╭──────────────────────────────────────────────╮
│ Project initialized successfully! │
│ │
│ Next steps: │
│ 1. Run ralph specify to define V0 specs │
│ 2. Run ralph plan to create epics │
│ 3. Run ralph build to start building │
╰──────────────────────────────────────────────╯
Command: ralph research
Purpose: Research technologies, libraries, tools, and best practices before defining specifications. Useful for complex projects where you need to evaluate options.
- Prompts for research topic and goal
- Launches an interactive Claude session with web search
- Searches for relevant documentation, blog posts, and comparisons
- Creates research documents in
docs/research/ - Summarizes findings and recommendations
| Input | Source | Description |
|---|---|---|
AGENTS.md |
Project root | Project context for relevant research |
| Topic | User prompt | What to research (e.g., "authentication libraries") |
| Goal | User prompt | What to learn/decide (e.g., "choose best option") |
| Output | Location | Description |
|---|---|---|
| Research docs | docs/research/ |
Findings, comparisons, recommendations |
# Research: <Topic>
## Goal
What we wanted to learn or decide.
## Summary
Key findings in 2-3 sentences.
## Options Evaluated
### Option 1: <Name>
- Pros: ...
- Cons: ...
- Links: ...
## Recommendations
Based on our tech stack and goals...
## Sources
- [Title](url) - Description$ ralph research
╭──────────────────────────────────────────────╮
│ Ralph Swarm - Research Mode │
│ Model: opus │
╰──────────────────────────────────────────────╯
Research Topic
What do you want to research?
Topic: authentication libraries for Python APIs
Research Goal
What do you want to learn or decide?
Goal: choose the best auth library for our FastAPI backend
How this works:
1. An interactive Claude session will start
2. Claude will search the web for relevant information
3. You can guide the research and ask follow-up questions
4. Research findings will be saved to docs/research/
Ready to start? [y/n]: y
# Claude session begins...
# After completion:
New research created:
● docs/research/authentication-libraries-for-python-apis.md
╭──────────────────────────────────────────────╮
│ Research session complete! │
│ │
│ Next steps: │
│ 1. Review research: ls docs/research/ │
│ 2. Define specs: ralph specify │
│ 3. Run planning: ralph plan │
╰──────────────────────────────────────────────╯
Command: ralph specify
Purpose: Define what the project should do through interactive specification writing. Creates detailed requirements that drive planning and implementation.
- Launches an interactive Claude session
- Analyzes AGENTS.md and any prior art references
- Works with user to define V0 (minimum viable) scope
- Creates specification documents
- Updates code-reviewer with project-specific rules
| Mode | Flag | Best For |
|---|---|---|
| Iterative (default) | none | Most projects - start small, iterate |
| Incremental | (automatic when V0 exists) | Adding features to existing specs |
| Full | --full |
Complex projects needing upfront planning |
| Input | Source | Description |
|---|---|---|
AGENTS.md |
Project root | Project context and objectives |
| Prior art references | User prompt | URLs/repos for inspiration |
| Existing specs | specs/ |
Previous specifications (incremental mode) |
| Output | Location | Description |
|---|---|---|
v0-*.md |
specs/ |
V0 specification documents |
| Component specs | specs/ |
Separate specs for distinct components |
| Updated review rules | .claude/agents/code-reviewer.md |
Project-specific code review criteria |
Each spec file follows this structure:
# <Component> - V0 Specification
## Purpose
One sentence describing the component's role.
## Core Features
- Feature 1: Brief description
- Feature 2: Brief description
(3-5 features maximum for V0)
## User Flows
### Primary Flow
1. User does X
2. System responds with Y
3. Result is Z
## Technical Approach
- Key technology choices
- Integration points
## Out of Scope (V0)
- Deferred feature 1
- Deferred feature 2
## Success Criteria
- Measurable completion criteria$ ralph specify
╭──────────────────────────────────────────────╮
│ Ralph Swarm - Specify Mode │
│ Initial V0 | Model: opus │
╰──────────────────────────────────────────────╯
Prior Art
Are there existing projects we should look at?
Reference (or press Enter to skip): https://github.com/docker/compose
Added: https://github.com/docker/compose
Reference (or press Enter to skip):
How this works:
1. An interactive Claude session will start
2. Work with Claude to define your specifications
3. Claude will create spec files in specs/
4. When finished, type /exit or press Ctrl+C
Ready to start? [y/n]: y
# Claude session begins...
# After completion:
New specs created:
● specs/v0-cli.md
● specs/v0-docker-client.md
Command: ralph plan
Purpose: Transform specifications into actionable work items. Creates a structured backlog of epics and tasks in beads.
- Loads workflow context via
bd prime - Reads all specification documents
- Scans existing code for gaps
- Creates epics for major features
- Breaks epics into small, actionable tasks
- Links dependencies between tasks
- Ensures documentation tasks exist
| Input | Source | Description |
|---|---|---|
AGENTS.md |
Project root | Project context |
| Spec files | specs/ |
Requirements to implement |
| Existing code | src/, etc. |
Current implementation state |
| Existing issues | .beads/ |
Previously created work items |
| Output | Location | Description |
|---|---|---|
| Epics | .beads/ |
High-level feature groupings |
| Tasks | .beads/ |
Actionable implementation items |
| Dependencies | .beads/ |
Blocking relationships |
| Type | Purpose | Size |
|---|---|---|
epic |
Groups related tasks | Large (decomposed, not implemented) |
task |
Implementation work | Small (1-2 hours of work) |
bug |
Defect fixes | Varies |
feature |
New capabilities | Small-medium |
- Every epic includes a documentation task
- Tasks are small and focused (1-2 hours)
- Foundation/infrastructure before features
- Tests alongside implementation
- Clear dependencies prevent parallel conflicts
$ ralph plan
╭──────────────────────────────────────────────╮
│ Ralph Swarm - Planning Mode │
│ Model: opus │
╰──────────────────────────────────────────────╯
┌─────────────────────────────────────────────┐
│ Current Beads State │
├─────────────────────────────────────────────┤
│ Total Issues │ 0 │
│ Open │ 0 │
│ In Progress │ 0 │
│ Closed │ 0 │
└─────────────────────────────────────────────┘
Running Claude in planning mode...
Created 12 new issue(s)
Ready issues:
my-cli-tool-1 [task] Set up project structure
my-cli-tool-2 [task] Implement Docker client wrapper
my-cli-tool-3 [task] Create CLI entry point
╭──────────────────────────────────────────────╮
│ Planning complete! │
│ │
│ Next steps: │
│ 1. Review: bd list │
│ 2. Check deps: bd ready │
│ 3. Start building: ralph build │
╰──────────────────────────────────────────────╯
Command: ralph build
Purpose: Execute implementation by running autonomous worker agents that pick up tasks, implement them, and verify quality.
- Each worker loads context via
bd prime - Claims an unassigned task from the ready queue
- Implements the task (or decomposes if it's an epic)
- Documents architectural decisions (via
adrsubagent) - Reviews changes (via
code-reviewersubagent) - Verifies build/tests pass (via
are-we-donesubagent) - Commits and closes the task
- Loops to pick up next task
┌─────────────────────────────────────────────────────────────────────┐
│ BUILD WORKER LOOP │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────┐
│ Load Context│ ◀──────────────────────────────────────────┐
│ bd prime │ │
└──────┬──────┘ │
│ │
▼ │
┌─────────────┐ No work │
│ Check Queue │ ───────────────────▶ (idle/shutdown) │
│ bd ready │ │
└──────┬──────┘ │
│ Has work │
▼ │
┌─────────────┐ │
│ Claim Task │ │
│ bd update │ │
└──────┬──────┘ │
│ │
▼ │
┌─────────────┐ Is Epic? ┌─────────────┐ │
│ Check Type │ ────────────────▶│ Decompose │──────────┤
└──────┬──────┘ │ into tasks │ │
│ Task/Bug/Feature └─────────────┘ │
▼ │
┌─────────────┐ │
│ Implement │ │
│ │ │
└──────┬──────┘ │
│ │
▼ │
┌─────────────┐ Made arch ┌─────────────┐ │
│ ADR Check │ ─────decisions───▶│ adr agent │ │
└──────┬──────┘ └──────┬──────┘ │
│◀────────────────────────────────┘ │
▼ │
┌─────────────┐ │
│code-reviewer│ │
│ agent │ │
└──────┬──────┘ │
│ │
▼ │
┌─────────────┐ NOT READY ┌─────────────┐ │
│are-we-done │ ─────────────────▶│ Fix Issues │─────┐ │
│ agent │ └─────────────┘ │ │
└──────┬──────┘ ▲ │ │
│ READY └────────────┘ │
▼ │
┌─────────────┐ │
│ Commit & │ │
│ Close Task │ │
└──────┬──────┘ │
│ │
└───────────────────────────────────────────────────┘
| Input | Source | Description |
|---|---|---|
| Ready tasks | .beads/ |
Unassigned tasks with satisfied dependencies |
AGENTS.md |
Project root | Build/test instructions |
adr/ |
Directory | Existing architectural decisions |
| Existing code | Project | Current implementation |
| Output | Location | Description |
|---|---|---|
| Implementation code | Project | New/modified source files |
| Tests | Project | Test files for new code |
| Git commits | .git/ |
Atomic commits per task |
| ADRs | adr/ |
Architectural decision records |
| Closed tasks | .beads/ |
Completed work items |
| New issues | .beads/ |
Discovered bugs/follow-ups |
| Subagent | When Used | Must Pass? |
|---|---|---|
adr |
After adding dependencies or making architectural choices | No (advisory) |
code-reviewer |
After implementation, before verification | CRITICAL issues block |
are-we-done |
Before closing any task | Yes, must return "READY TO COMPLETE" |
| Mode | Flag | Behavior |
|---|---|---|
| Single | (default) | One worker, interactive output |
| Swarm | --workers N |
N parallel workers, logged to files |
| Once | --once |
Single iteration, then exit |
| Auto-shutdown | --auto-shutdown |
Exit when no work remains |
$ ralph build --workers 2
╭──────────────────────────────────────────────╮
│ Ralph Swarm - Build Mode │
│ Workers: 2 | Model: sonnet │
╰──────────────────────────────────────────────╯
┌─────────────────────────────────────────────┐
│ Work Queue │
├─────────────────────────────────────────────┤
│ Ready Issues │ 8 │
│ Unassigned │ 8 │
└─────────────────────────────────────────────┘
Logs: logs/2024-01-15_10-30-00/
Spawning 2 workers...
Started ralph-1 (PID: 12345)
Started ralph-2 (PID: 12346)
Workers running!
PIDs: [12345, 12346]
View logs:
tail -f logs/2024-01-15_10-30-00/ralph-1.log
tail -f logs/2024-01-15_10-30-00/ralph-2.log
⠋ Workers running: 2/2
View project progress at any time:
$ ralph status --tree
╭──────────────────────────────────────────────╮
│ Ralph Swarm - Project Status │
╰──────────────────────────────────────────────╯
Progress: ████████░░░░░░░░ 45% (9/20)
┌─────────────────────────────────────────────┐
│ Summary │
├─────────────────────────────────────────────┤
│ Open │ 8 │
│ In Progress │ 3 │
│ Closed │ 9 │
└─────────────────────────────────────────────┘
Dependency Tree:
├── [closed] Epic: CLI Framework
│ ├── [closed] Set up Click
│ ├── [closed] Add Rich output
│ └── [closed] Document: CLI Framework
├── [in_progress] Epic: Docker Integration
│ ├── [in_progress] Docker client wrapper
│ ├── [open] Container listing
│ └── [open] Document: Docker Integration
Gracefully stop workers after their current task:
$ ralph shutdown
Shutdown requested — workers will stop after their current task.
# To cancel and let workers continue:
$ ralph shutdown --cancel
Shutdown cancelled — workers may continue.
Recover from crashed workers:
$ ralph cleanup
Found 2 orphaned tasks:
my-cli-tool-5 [in_progress] assigned to ralph-1
my-cli-tool-8 [in_progress] assigned to ralph-2
Reset these tasks to open? [y/n]: y
Reset my-cli-tool-5
Reset my-cli-tool-8
# 1. Create project directory
mkdir weather-cli && cd weather-cli
# 2. Initialize
ralph init
# Answer prompts:
# Objective: "CLI tool to check weather forecasts"
# Problem: "Quick weather checks without opening a browser"
# Tech stack: "Python, Click, httpx, Rich"
# 3. Research (optional but recommended for complex projects)
ralph research
# Topic: "weather APIs for Python"
# Goal: "choose best free weather API"
# Creates: docs/research/weather-apis-for-python.md
# 4. Specify V0
ralph specify
# Work with Claude to create:
# - specs/v0-cli.md (commands, output format)
# - specs/v0-weather-api.md (API integration)
# 5. Plan implementation
ralph plan
# Creates tasks like:
# - Set up project structure
# - Implement weather API client
# - Create 'current' command
# - Create 'forecast' command
# - Add error handling
# - Document usage
# 6. Build with workers
ralph build --workers 2 --auto-shutdown
# Workers implement, test, and commit each task
# 7. Check progress
ralph status
# 8. Add a feature later
ralph specify
# Choose "Add a new feature"
# Define the feature spec
ralph plan
ralph buildInitialize a ralph-swarm project in the current directory:
- Define objective and problem statement
- Choose tech stack
- Initialize git and beads
- Create AGENTS.md scaffold
Fails fast if the project is already initialized.
Research technologies, libraries, and best practices interactively:
- Searches web for documentation, blog posts, comparisons
- Evaluates options against project tech stack
- Creates research documents in
docs/research/
Options:
--model, -m- Model to use (sonnet, opus, haiku)--verbose, -v- Show real-time output--dry-run- Show prompt without executing
Build specifications interactively. Two modes available:
Iterative mode (default):
- Start with minimal V0 specs
- Add features incrementally as needed
- Best for most projects - ship early, iterate often
Full specification mode:
- Comprehensive Q&A to fully understand the project upfront
- Claude asks many questions before writing any specs
- Best for complex projects where upfront planning saves time
Options:
--model, -m- Model to use (sonnet, opus, haiku)--full- Use full specification mode (skip interactive selection)--verbose, -v- Show real-time output--dry-run- Show prompt without executing
Run planning mode to create structured work breakdown:
- Analyzes specs and existing code
- Creates epics for major features
- Breaks down into actionable tasks
- Links dependencies
Options:
--model, -m- Model to use (sonnet, opus, haiku)--iterations, -n- Number of planning iterations--verbose, -v- Show real-time output--dry-run- Show prompt without executing
Run build mode with worker swarm:
- Picks up issues from beads
- Implements with full code quality checks
- Supports parallel workers
Options:
--workers, -w- Number of parallel workers (default: 1)--model, -m- Model to use (sonnet, opus, haiku)--once- Single iteration instead of looping--auto-shutdown/--no-auto-shutdown- Shutdown when no work remains (default: enabled)--idle-limit- Iterations before auto-shutdown--verbose, -v- Show real-time output
Gracefully stop running workers:
- Creates a
.ralph-stopfile that workers check before claiming new work - Workers finish their current task, then exit
- Use
--cancelto remove the stop file and allow builds to resume
Options:
--cancel- Cancel a pending shutdown (remove stop file)
Show project progress:
- Issue summary by status and type
- Ready work queue
- Running workers
- Progress bar
Options:
--verbose, -v- Show all issues--tree, -t- Show dependency tree
Clean up orphaned work from crashed workers:
- Finds in-progress issues without active workers
- Resets them to open status
Options:
--force, -f- Skip confirmation--discard-changes- Also discard uncommitted changes
- Spec-driven: Features follow specifications
- Small units: Do the smallest useful work
- Two paths: V0-first for fast iteration, or full specification for complex projects
- Visibility: Always show what's happening
- Quality gates: Code review and verification before completion
- Claude Code - AI coding assistant
- Beads - Issue tracking
- Git
MIT