diff --git a/README.md b/README.md index 07bcf84..34aca30 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ ![Ralph](assets/diagrams/ralph.webp) -Ralph is a minimal, file-based agent loop for autonomous coding. Each iteration starts fresh, reads on-disk state, and commits work for one story at a time. +> **Ship while you sleep.** Define what you want built, then walk away. Return to completed, committed, working code. + +Ralph is a minimal, file-based agent loop for autonomous coding. Each iteration starts fresh, reads on-disk state, and commits work for one story at a time. Ralph works tirelessly on features and stories while you focus on what matters most. ## Quick Start (5 minutes) @@ -366,8 +368,9 @@ Set environment variables and Ralph agents automatically gain access to these to ## Documentation +- **[Vision](VISION.md)** - Philosophy and long-term vision for autonomous development +- **[Roadmap](ROADMAP.md)** - Current progress and planned features - **[Testing Guide](TESTING.md)** - Comprehensive testing documentation -- **[Roadmap](ROADMAP.md)** - Future plans and features - **[Agent Guide (CLAUDE.md)](CLAUDE.md)** - For AI agents working with Ralph - **[Additional Documentation](documentation/)** - Deployment guides, design system, and more - **[Web Documentation](https://asktinnguyen.github.io/ralph-cli/)** - Interactive guides and tutorials diff --git a/ROADMAP.md b/ROADMAP.md index 979e39e..fef6660 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,8 +1,12 @@ # Ralph CLI Roadmap: Q1 2026 +> **For the full vision, see [VISION.md](VISION.md)** β€” Ralph's philosophy of autonomous development that lets you ship while you sleep. + ## Vision Statement -Transform Ralph from a minimal agent loop into the **premier autonomous development platform** - enabling developers and teams to ship production code at unprecedented velocity while maintaining full cost visibility and control. +Transform Ralph from a minimal agent loop into the **premier autonomous development platform** β€” a tireless AI partner that executes features autonomously while developers focus on architecture, strategy, and life outside of code. + +**Core Promise:** Define what you want, walk away, return to working code. --- @@ -16,20 +20,53 @@ Transform Ralph from a minimal agent loop into the **premier autonomous developm --- +## Autonomy Milestones + +Progress toward **fully unattended operation** β€” the ability to run Ralph for hours or days without human intervention. + +| Milestone | Target Runtime | Key Features | Status | +|-----------|----------------|--------------|--------| +| **Level 1: Supervised** | 30 minutes | Basic retry, manual recovery | βœ… Complete | +| **Level 2: Semi-Autonomous** | 2-4 hours | Checkpoint/resume, agent switching | πŸ”„ In Progress | +| **Level 3: Autonomous** | 8-12 hours | Watchdog, self-healing, notifications | πŸ“‹ Planned | +| **Level 4: Overnight** | 24+ hours | Full recovery, pattern learning | πŸ“‹ Planned | +| **Level 5: Continuous** | Unlimited | Cloud infrastructure, queue management | πŸ“‹ Planned | + +### Current State: Level 1-2 Transition + +**What works today:** +- βœ… Basic retry with exponential backoff +- βœ… Agent fallback chain on failures +- βœ… Parallel streams in isolated worktrees +- βœ… Budget limits prevent runaway costs +- βœ… Risk assessment flags dangerous changes + +**Blocking full autonomy:** +- ⏳ Checkpoint system (resume after crash) +- ⏳ Graceful shutdown (clean state on interrupt) +- ⏳ Watchdog process (restart stalled builds) +- ⏳ Complete notification system (alert on completion) + +--- + ## Month 1: Stability, Polish & Developer Experience ### Theme: Production-Ready Foundation **Goal**: Make Ralph reliable enough for daily production use with excellent developer experience. -### 1.1 Core Reliability +### 1.1 Core Reliability (Autonomy-Critical) + +These features are **essential for unattended operation**. Without them, Ralph requires human supervision. -| Feature | Description | Status | -| --------------------- | ------------------------------------------------------------------ | ----------- | -| **Retry & Recovery** | Automatic retry with exponential backoff on agent failures | PARTIAL | -| **Checkpoint System** | Save/restore loop state for resumable builds | NOT STARTED | -| **Graceful Shutdown** | Handle SIGINT/SIGTERM, save progress, clean up worktrees | PARTIAL | -| **Health Checks** | Pre-flight validation of agent availability, git state, disk space | PARTIAL | +| Feature | Description | Autonomy Impact | Status | +| ------- | ----------- | --------------- | ------ | +| **Retry & Recovery** | Automatic retry with exponential backoff on agent failures | Handles transient failures | PARTIAL | +| **Checkpoint System** | Save/restore loop state for resumable builds | **CRITICAL:** Resume after crash/restart | NOT STARTED | +| **Graceful Shutdown** | Handle SIGINT/SIGTERM, save progress, clean up worktrees | **CRITICAL:** Clean state on interrupt | PARTIAL | +| **Watchdog Process** | Monitor builds, restart stalled executions | Recover from hangs | NOT STARTED | +| **Health Checks** | Pre-flight validation of agent availability, git state, disk space | Fail fast, not mid-build | PARTIAL | +| **Heartbeat System** | Periodic health signals, detect unresponsive builds | Identify hung processes | NOT STARTED | ### 1.2 Developer Experience @@ -187,3 +224,72 @@ Priority areas for community contribution: - UI themes and components - Documentation and tutorials - Integration plugins (Jira, Linear, etc.) + +--- + +## Future: Day in the Life + +What autonomous development looks like when this roadmap is complete: + +### Morning (15 minutes) + +```bash +# Review PRs from overnight builds +gh pr list --author=ralph-bot + +# Merge completed features +ralph stream merge 1 +ralph stream merge 2 + +# Define today's features +ralph prd "Add user analytics dashboard" +ralph prd "Implement webhook system" +ralph plan +``` + +### Workday (Focus on other things) + +```bash +# Start parallel builds and walk away +ralph stream build 1 50 & +ralph stream build 2 50 & + +# Notifications arrive via Slack: +# βœ… PRD-1: US-001 completed (commit abc123) +# βœ… PRD-1: US-002 completed (commit def456) +# ⚠️ PRD-2: US-003 flagged for review (high risk) +``` + +### Evening (10 minutes) + +```bash +# Check status +ralph stream status + +# Review flagged changes +git diff main..ralph/PRD-2 -- src/payments/ + +# Approve and continue +ralph stream build 2 --continue + +# Start overnight run +ralph build 100 --notify-on-complete +``` + +### Results + +- **Features shipped:** 2-3 per day +- **Developer time:** < 1 hour +- **Build time:** 8-12 hours (parallel) +- **Cost:** $20-50 per day (optimized routing) + +**Ralph does the work. You do the thinking.** + +--- + +## Quick Links + +- [VISION.md](VISION.md) β€” Philosophy and long-term vision +- [CLAUDE.md](CLAUDE.md) β€” Complete reference for AI agents +- [documentation/](documentation/) β€” Detailed guides +- [ui/public/docs/](ui/public/docs/) β€” Web documentation diff --git a/VISION.md b/VISION.md new file mode 100644 index 0000000..20ae1cc --- /dev/null +++ b/VISION.md @@ -0,0 +1,371 @@ +# Ralph CLI Vision & Roadmap + +> **Ship while you sleep.** Ralph is your tireless AI development partner that autonomously executes features and stories while you focus on what matters most. + +--- + +## The Vision: Autonomous Development at Scale + +### The Problem + +Modern software development is bottlenecked by human attention. Even with AI coding assistants, developers must: +- Manually break down features into tasks +- Babysit each code generation session +- Context-switch constantly between planning and execution +- Handle failures, retries, and edge cases themselves +- Stay tethered to their terminal during builds + +**The result:** Developers become supervisors instead of architects. AI amplifies productivity, but attention remains the constraint. + +### The Ralph Solution + +Ralph inverts this relationship. Instead of AI assisting humans, **humans guide Ralph, then step away**. + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ TRADITIONAL AI CODING β”‚ +β”‚ β”‚ +β”‚ Human ──prompt──> AI ──code──> Human ──review──> AI ──fix──> β”‚ +β”‚ ↑ ↓ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ (repeat endlessly) β”‚ +β”‚ β”‚ +β”‚ Bottleneck: Human attention at every step β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ RALPH WORKFLOW β”‚ +β”‚ β”‚ +β”‚ Human ──PRD──> Ralph ────────────────────────────> Commits β”‚ +β”‚ β”‚ ↑ β”‚ +β”‚ └──plan──>build──>test──>fix──>commitβ”€β”˜ β”‚ +β”‚ (autonomous loop, hours/days) β”‚ +β”‚ β”‚ +β”‚ Bottleneck: None. Human attention optional. β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +**Ralph's Promise:** Define what you want built, then go live your life. Return to completed, committed, working code. + +--- + +## Core Philosophy + +### 1. Files as Memory, Git as Truth + +Ralph stores all state in plain text files (`.ralph/`). No databases, no cloud dependencies, no lock-in. + +- **PRDs** define requirements (`prd.md`) +- **Plans** break down work (`plan.md`) +- **Progress** tracks iterations (`progress.md`) +- **Git commits** prove work actually happened + +**Why this matters:** You can inspect, version, and restore any state. The system is fully transparent. + +### 2. Stateless Iterations + +Each build iteration: +1. Reads current state from disk +2. Picks the next story +3. Executes autonomously +4. Commits results +5. Updates progress +6. Starts fresh for next iteration + +**Why this matters:** Crashes, timeouts, and interruptions don't corrupt state. Resume from any point. + +### 3. Parallel by Design + +Multiple PRDs run simultaneously in isolated git worktrees: + +```bash +ralph stream build 1 & # Feature A (background) +ralph stream build 2 & # Feature B (background) +ralph stream build 3 & # Feature C (background) +# Go to lunch. Return to 3 features completed. +``` + +**Why this matters:** Your development velocity scales with compute, not with your availability. + +### 4. Self-Healing Execution + +Ralph doesn't just runβ€”it recovers: +- **Retry with context:** Failed attempts inform next try +- **Agent switching:** If Claude struggles, try Codex +- **Rollback on failure:** Bad commits are automatically reverted +- **Graceful degradation:** Partial progress is saved + +**Why this matters:** Ralph keeps working even when individual operations fail. + +--- + +## Current Capabilities + +### What Ralph Does Today + +| Capability | Status | Description | +|------------|--------|-------------| +| **PRD Generation** | βœ… Complete | Natural language β†’ structured requirements | +| **Story Planning** | βœ… Complete | PRD β†’ ordered implementation stories | +| **Build Loop** | βœ… Complete | Autonomous iteration through stories | +| **Multi-Agent** | βœ… Complete | Claude, Codex, Droid support | +| **Parallel Streams** | βœ… Complete | Multiple PRDs simultaneously | +| **Git Integration** | βœ… Complete | Auto-commit, auto-branch, worktrees | +| **Cost Optimization** | βœ… Complete | Smart model routing (Haiku/Sonnet/Opus) | +| **Budget Control** | βœ… Complete | Daily/monthly spending limits | +| **Risk Assessment** | βœ… Complete | Flag high-risk changes for review | +| **Retry & Recovery** | βœ… Partial | Automatic retry with enhanced context | +| **Checkpoint/Resume** | ⏳ In Progress | Save and restore loop state | +| **Web Dashboard** | βœ… Complete | Track progress, view logs, manage PRDs | + +### The Workflow + +```bash +# 1. Define what you want (5 minutes) +ralph prd "Build a user authentication system with OAuth" + +# 2. Generate implementation plan (2 minutes) +ralph plan + +# 3. Start autonomous execution (then walk away) +ralph build 20 + +# 4. Return to completed feature +git log # See all the commits Ralph made +``` + +--- + +## Roadmap: The Path to Fully Autonomous Development + +### Phase 1: Bulletproof Foundation +**Goal:** Zero-maintenance operation for hours at a time + +| Feature | Priority | Impact | Status | +|---------|----------|--------|--------| +| **Complete Checkpoint System** | P0 | Resume after crashes/restarts | πŸ”„ In Progress | +| **Graceful Shutdown** | P0 | Clean exit on SIGINT/SIGTERM | πŸ”„ In Progress | +| **Enhanced Error Recovery** | P0 | Auto-fix common failures | βœ… Partial | +| **Watchdog Process** | P1 | Restart stalled builds | πŸ“‹ Planned | +| **Health Heartbeats** | P1 | Detect hung processes | πŸ“‹ Planned | +| **Notification System** | P1 | Alert on completion/failure | βœ… Partial | + +**Success Metric:** Run `ralph build 50` overnight, wake up to working code. + +### Phase 2: Intelligent Autonomy +**Goal:** Ralph makes smart decisions without human input + +| Feature | Priority | Impact | Status | +|---------|----------|--------|--------| +| **Context-Aware Agent Switching** | P0 | Right agent for each task | πŸ“‹ Planned | +| **Smart Story Ordering** | P0 | Dependencies first | βœ… Complete | +| **Automatic Story Splitting** | P1 | Break large stories into smaller ones | πŸ“‹ Planned | +| **Cross-Project Learning** | P1 | Apply patterns from past work | πŸ”„ Partial | +| **Codebase Understanding** | P1 | Deep semantic indexing | πŸ”„ Partial | +| **Test Generation** | P2 | Auto-create tests for new code | πŸ“‹ Planned | + +**Success Metric:** Story success rate > 95% without human intervention. + +### Phase 3: Scale Without Limits +**Goal:** Run Ralph across teams, projects, and organizations + +| Feature | Priority | Impact | Status | +|---------|----------|--------|--------| +| **Ralph Cloud Dashboard** | P0 | Centralized monitoring | πŸ“‹ Planned | +| **Team Workspaces** | P0 | Shared PRDs and progress | πŸ“‹ Planned | +| **Build Queue** | P1 | Prioritized job scheduling | πŸ“‹ Planned | +| **Remote Execution** | P1 | Run on cloud infrastructure | πŸ“‹ Planned | +| **Custom Agent Integration** | P1 | Bring your own LLM | πŸ“‹ Planned | +| **Audit Logging** | P2 | Enterprise compliance | πŸ“‹ Planned | +| **Role-Based Access** | P2 | Admin/Developer/Viewer roles | πŸ“‹ Planned | + +**Success Metric:** Teams running 100+ concurrent streams across projects. + +--- + +## Use Cases: When to Use Ralph + +### Perfect For + +| Scenario | Example | Why Ralph Excels | +|----------|---------|------------------| +| **Feature Implementation** | "Add user settings page" | Complete PRD β†’ code pipeline | +| **Bug Fixes** | "Fix all TypeScript errors" | Iterative, testable work | +| **Refactoring** | "Migrate to new API format" | Systematic file-by-file changes | +| **Documentation** | "Add JSDoc to all exports" | Repetitive, well-defined tasks | +| **Testing** | "Increase coverage to 80%" | Generate tests story-by-story | +| **Overnight Development** | Large feature while you sleep | Autonomous execution | +| **Parallel Features** | Multiple PRDs simultaneously | Stream isolation | + +### Not Ideal For + +| Scenario | Better Approach | +|----------|-----------------| +| Quick one-liner fixes | Direct AI chat | +| Exploratory prototyping | Interactive development | +| Highly ambiguous requirements | Clarify first, then Ralph | +| Security-critical code | Human review required | + +--- + +## Architecture Principles + +### 1. Offline-First +Ralph works without internet for core operations. Only agent API calls require connectivity. + +### 2. No Lock-In +- State is plain Markdown +- Git is the database +- Switch agents anytime +- No proprietary formats + +### 3. Incremental Adoption +```bash +# Start simple +ralph prd "Add dark mode" +ralph build 5 + +# Scale up gradually +ralph stream build 1 & ralph stream build 2 & + +# Eventually run CI/CD +ralph build --ci --headless +``` + +### 4. Transparent Operations +Every decision Ralph makes is logged: +- Why a story was selected +- Which agent handled it +- What commands were run +- Why something failed +- What the fix attempt was + +--- + +## Metrics & Goals + +### Current Performance (Baseline) + +| Metric | Current State | +|--------|---------------| +| Story success rate | ~75% | +| Mean time to recovery | Manual intervention | +| Cost per story | ~$0.50-2.00 | +| Max unattended runtime | ~1-2 hours | +| Parallel streams | 3-4 stable | + +### Target Performance (6 months) + +| Metric | Target | How | +|--------|--------|-----| +| Story success rate | **95%** | Enhanced retry, agent switching | +| Mean time to recovery | **< 30 seconds** | Automatic checkpoint/resume | +| Cost per story | **$0.20-0.80** | Smart model routing | +| Max unattended runtime | **24+ hours** | Watchdog, heartbeats | +| Parallel streams | **10+ stable** | Improved isolation | + +### Target Performance (12 months) + +| Metric | Target | How | +|--------|--------|-----| +| Story success rate | **98%** | Cross-project learning | +| Mean time to recovery | **Automatic** | Self-healing loop | +| Cost per story | **$0.10-0.50** | Pattern caching | +| Max unattended runtime | **Unlimited** | Cloud infrastructure | +| Parallel streams | **50+** | Distributed execution | + +--- + +## Getting Started Today + +### Quick Start (5 minutes) + +```bash +# Install Ralph +curl -fsSL https://raw.githubusercontent.com/AskTinNguyen/ralph-cli/main/install.sh | bash + +# Navigate to your project +cd my-project + +# Install Ralph locally +ralph install + +# Create your first PRD +ralph prd "Build a REST API for user management" + +# Generate implementation plan +ralph plan + +# Start autonomous development (then go do something else) +ralph build 10 +``` + +### Recommended Workflow + +1. **Morning:** Define PRDs for the day's features +2. **Midday:** Start builds, go to meetings +3. **Evening:** Review completed work, merge PRs +4. **Overnight:** Run larger features with `ralph build 50` + +### Best Practices + +- **Start small:** 5-10 iteration runs until you trust the system +- **Define clear acceptance criteria:** Better PRDs = better results +- **Use streams for isolation:** Parallel work without conflicts +- **Set budget limits:** `RALPH_BUDGET_DAILY=25.00` +- **Review before merge:** Trust but verify + +--- + +## Contributing to the Vision + +### Priority Areas + +1. **Reliability** - Improve checkpoint/resume system +2. **Intelligence** - Better agent switching logic +3. **Documentation** - Tutorials and examples +4. **Integrations** - New agent adapters (Gemini, local LLMs) +5. **Enterprise** - Team features, audit logging + +### How to Contribute + +1. Check `.ralph/` for existing PRDs with open stories +2. Run `ralph stream status` to see what's in progress +3. Pick an unclaimed story or create a new PRD +4. Submit PR with your changes + +--- + +## The Future We're Building + +Imagine a world where: + +- **Feature requests become features overnight** β€” Define requirements before bed, wake up to pull requests +- **Technical debt gets cleaned automatically** β€” Ralph refactors during off-hours +- **Test coverage improves continuously** β€” Autonomous test generation fills gaps +- **Documentation stays current** β€” Changes trigger doc updates +- **Multiple features ship in parallel** β€” Limited only by compute, not attention + +**Ralph is the tireless team member who never sleeps, never gets distracted, and never loses context.** + +--- + +## Summary + +| Aspect | Ralph's Approach | +|--------|------------------| +| **State** | Files on disk, Git commits | +| **Execution** | Stateless iterations | +| **Reliability** | Self-healing, checkpoint/resume | +| **Scaling** | Parallel streams, worktrees | +| **Intelligence** | Multi-agent, smart routing | +| **Control** | Budget limits, risk flags | + +**One command to ship features while you focus on what matters:** + +```bash +ralph build 20 && echo "Going to lunch" +``` + +--- + +*Ralph CLI is open source under MIT license. Built by developers who believe AI should do the work while humans do the thinking.*