A unified Ralph setup framework with a three-layer architecture that abstracts orchestration patterns across coding agent platforms (Cursor, Claude Code, Amp, Codex) while respecting platform-specific capabilities and model-specific behaviors.
Get started with Ralph in three steps:
-
Install and initialize:
./install.sh ralph init cursor claude-opus-4.5
-
Create specifications:
mkdir specs # Write your requirements in specs/*.md files -
Run Ralph:
ralph run # Auto-detects: plan if no plan exists, build if plan exists
Or use explicit modes:
ralph plan- Generate or update implementation planralph build- Implement from existing planralph orchestrate- Execute hierarchical plans (plan of plans)
Monitor progress:
ralph status- Show current task status and context usageralph monitor- Real-time monitoring dashboard
The framework uses a three-layer architecture:
┌─────────────────────────────────────────────────────────┐
│ ORCHESTRATOR LAYER │
│ (Task Management, Loop Control, Completion Detection) │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ PLATFORM ADAPTER LAYER │
│ (Coding Agent Interface - Cursor, Claude Code, etc.) │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ MODEL PROFILE LAYER │
│ (LLM Characteristics - Opus, GPT-4, Gemini, etc.) │
└─────────────────────────────────────────────────────────┘
Orchestrator Layer:
- Platform-agnostic task management and loop control
- Uses Model Profiles to make decisions about task sizing, context allocation, prompt optimization
- Coordinates multi-loop patterns (supervisor, classifier loops)
- Handles completion detection based on model behaviors
- Context optimization and eventual consistency
Platform Adapter Layer:
- Platform-specific implementations (Cursor, Claude Code, Amp, Codex)
- Handles platform differences (rules system, skills system, MCP integration)
- Maps platform model identifiers to Model Profile IDs
- Exposes platform capabilities to orchestrator
Model Profile Layer:
- Describes underlying LLM characteristics (independent of platform)
- Context window specifications (advertised, usable, overhead)
- Behavioral patterns (forgetful areas, prompt preferences, response styles)
- Token efficiency preferences
- Smart zone thresholds and task sizing recommendations
Following Geoffrey Huntley's principles from HOW_TO_RALPH.md:
- Context is an array - allocate deliberately
- One goal per context window
- Fresh context each iteration (zero auto-compaction)
- Deterministic allocation (first 5K tokens for specs)
- Human on the loop, not in the loop
- Eventual consistency - Ralph will get there eventually
- Minimal context usage - optimize everything for token efficiency
- Strong linkage - Structured markdown format (checkboxes + hierarchy) makes plans machine-parseable
- Specifications are critical - Good specs = good output
- Three-Layer Architecture: Clean separation of orchestration, platform adaptation, and model characteristics
- Model Profile System: Centralized knowledge of LLM characteristics that inform decisions
- Platform Abstraction: Unified orchestrator interface with platform-specific adapters
- Unified Interface: Same workflow across all platforms
- Model-Aware Decisions: Orchestrator uses model profiles for task sizing, context allocation, prompt optimization
- Context Optimization: Built-in token counting, usage warnings, optimization recommendations
- Eventual Consistency: Retry logic, backpressure handling, failure recovery patterns
- Guardrails System: Config validation, task validation, safety checks
- Tool Integrations: Tmux, Headless Chrome, MCP-CLI, git work trees
- Extensibility: Skills/extensions system for custom capabilities
# Clone the repository git clone https://github.com/your-org/ralph-framework.git cd ralph-framework # Run installer ./install.sh # Initialize in your project cd /path/to/your/project ralph init cursor claude-opus-4.5
ralph init [platform] [model]
Example:
ralph init cursor claude-opus-4.5
Generate or update an implementation plan:
ralph plan
This will:
- Analyze
specs/directory - Study existing code
- Generate/update
IMPLEMENTATION_PLAN.mdwith prioritized tasks
Implement from existing plan:
ralph build
This will:
- Read
IMPLEMENTATION_PLAN.md - Implement unchecked tasks
[ ] - Update checkboxes
[x]as tasks complete
ralph run
Automatically detects:
- No plan → runs planning mode
- Plan exists → runs building mode
ralph status # Show current status ralph monitor # Real-time dashboard
your-project/
├── .ralph/ # Ralph state directory
│ ├── config.json # Configuration
│ ├── activity.log # Activity tracking
│ ├── errors.log # Error logging
│ └── token.log # Token usage tracking
├── specs/ # Specifications (first 5K tokens)
│ └── *.md
├── PROMPT_plan.md # Planning mode prompt
├── PROMPT_build.md # Building mode prompt
└── IMPLEMENTATION_PLAN.md # Task plan with checkboxes
Model profiles describe LLM characteristics that inform orchestrator decisions:
- Context window: Advertised, usable, overhead
- Smart zone: Thresholds for optimal performance
- Behaviors: Forgetful areas, prompt preferences, completion reliability
- Token efficiency: Preferred formats, compact mode
- Task sizing: Recommended max tokens per task
Example profiles included:
claude-opus-4.5.jsongpt-4-turbo.jsongemini-pro-1.5.json
- Rules system integration
- MCP (Model Context Protocol) integration
- Token tracking and rotation
- Session resume capability
- Simple loop implementation
- Minimal setup
- Maximum determinism
- Skills system integration
- Markdown task format
- Model-specific harness
- OpenAI Codex CLI integration
- Image input support
- Web search integration
Configuration is stored in .ralph/config.json:
{
"platform": "cursor",
"model": "claude-opus-4.5",
"orchestrator": {
"max_iterations": 20,
"task_format": "markdown",
"completion_detection": "agent_signal"
},
"adapter_config": {
"cursor": {
"token_tracking": true,
"rotation_threshold": 80000,
"output_format": "stream-json"
}
}
}- Architecture Documentation
- Model Profiles
- Context Optimization
- Eventual Consistency
- Tool Integrations
- Planning vs Building Modes
- Hierarchical Orchestration
See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE file.
- HOW_TO_RALPH.md - Geoffrey Huntley's core principles
- Based on implementations from:
snarktank/ralphralph-wiggum-cursorhow-to-ralph-wiggum