[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74943":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":14,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},74943,"open-ralph-wiggum","Th0rgal\u002Fopen-ralph-wiggum","Th0rgal","Type `ralph \"prompt\"` to start open code in a ralph loop. Also supports a prompt file & status check. Open Code, Claude Code, Codex, Copilot","",null,"TypeScript",1777,137,17,7,0,31,92,51,99.12,"MIT License",false,"master",true,[26,27,28,29,30],"claude-code","open-code","opencode","ralph","ralph-wiggum","2026-06-12 04:01:16","\u003Cp align=\"center\">\n  \u003Ch1 align=\"center\">Open Ralph Wiggum\u003C\u002Fh1>\n  \u003Ch3 align=\"center\">Autonomous Agentic Loop for Claude Code, Codex, Copilot CLI, Cursor Agent & OpenCode\u003C\u002Fh3>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"screenshot.webp\" alt=\"Open Ralph Wiggum - Iterative AI coding loop for Claude Code and Codex\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cem>Works with \u003Cb>Claude Code\u003C\u002Fb>, \u003Cb>OpenAI Codex\u003C\u002Fb>, \u003Cb>Copilot CLI\u003C\u002Fb>, \u003Cb>Cursor Agent\u003C\u002Fb>, and \u003Cb>OpenCode\u003C\u002Fb> — switch agents with \u003Ccode>--agent\u003C\u002Fcode>.\u003C\u002Fem>\u003Cbr>\n  \u003Cem>Based on the \u003Ca href=\"https:\u002F\u002Fghuntley.com\u002Fralph\u002F\">Ralph Wiggum technique\u003C\u002Fa> by Geoffrey Huntley\u003C\u002Fem>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fopen-ralph-wiggum\u002Fblob\u002Fmaster\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg\" alt=\"MIT License\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fopen-ralph-wiggum\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fbuilt%20with-Bun%20%2B%20TypeScript-f472b6.svg\" alt=\"Built with Bun + TypeScript\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fopen-ralph-wiggum\u002Freleases\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FTh0rgal\u002Fralph-wiggum?include_prereleases\" alt=\"Release\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#supported-agents\">Supported Agents\u003C\u002Fa> •\n  \u003Ca href=\"#what-is-open-ralph-wiggum\">What is Ralph?\u003C\u002Fa> •\n  \u003Ca href=\"#installation\">Installation\u003C\u002Fa> •\n  \u003Ca href=\"#quick-start\">Quick Start\u003C\u002Fa> •\n  \u003Ca href=\"#commands\">Commands\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Tired of agents breaking your local environment?\u003C\u002Fstrong>\u003Cbr>\n  🏝️ \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fsandboxed.sh\">sandboxed.sh\u003C\u002Fa> gives each task an isolated Linux workspace. Self-hosted. Git-backed.\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  💬 \u003Cstrong>Join the community:\u003C\u002Fstrong> \u003Ca href=\"https:\u002F\u002Frelens.ai\u002Fcommunity\">relens.ai\u002Fcommunity\u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n\n## Supported Agents\n\nOpen Ralph Wiggum works with multiple AI coding agents. Switch between them using the `--agent` flag:\n\n| Agent | Flag | Description |\n|-------|------|-------------|\n| **Claude Code** | `--agent claude-code` | Anthropic's Claude Code CLI for autonomous coding |\n| **Codex** | `--agent codex` | OpenAI's Codex CLI for AI-powered development |\n| **Copilot CLI** | `--agent copilot` | GitHub Copilot CLI for agentic coding |\n| **Cursor Agent** | `--agent cursor-agent` | Cursor Agent CLI for headless AI coding |\n| **OpenCode** | `--agent opencode` | Default agent, open-source AI coding assistant |\n\n```bash\n# Use Claude Code\nralph \"Build a REST API\" --agent claude-code --max-iterations 10\n\n# Use OpenAI Codex\nralph \"Create a CLI tool\" --agent codex --max-iterations 10\n\n# Use Copilot CLI\nralph \"Refactor the auth module\" --agent copilot --max-iterations 10\n\n# Use Cursor Agent\nralph \"Add unit tests\" --agent cursor-agent --max-iterations 10\n\n# Use OpenCode (default)\nralph \"Fix the failing tests\" --max-iterations 10\n```\n\n---\n\n## What is Open Ralph Wiggum?\n\nOpen Ralph Wiggum implements the **Ralph Wiggum technique** — an autonomous agentic loop where an AI coding agent (Claude Code, Codex, Cursor Agent, or OpenCode) receives the **same prompt repeatedly** until it completes a task. Each iteration, the AI sees its previous work in files and git history, enabling self-correction and incremental progress.\n\nThis is a **CLI tool** that wraps any supported AI coding agent in a persistent development loop. No plugins required — just install and run.\n\n```bash\n# The essence of the Ralph loop:\nwhile true; do\n  claude-code \"Build feature X. Output \u003Cpromise>DONE\u003C\u002Fpromise> when complete.\"  # or codex, opencode\ndone\n```\n\n**Why this works:** The AI doesn't talk to itself between iterations. It sees the same prompt each time, but the codebase has changed from previous iterations. This creates a powerful feedback loop where the agent iteratively improves its work until all tests pass.\n\n### Multi-Agent Flexibility\n\nSwitch between AI coding agents without changing your workflow:\n\n- **Claude Code** (`--agent claude-code`) — Anthropic's powerful coding agent\n- **Codex** (`--agent codex`) — OpenAI's code-specialized model\n- **Copilot CLI** (`--agent copilot`) — GitHub's agentic coding tool\n- **Cursor Agent** (`--agent cursor-agent`) — Cursor's headless AI coding agent\n- **OpenCode** (`--agent opencode`) — Open-source default option\n\n## Key Features\n\n- **Multi-Agent Support** — Use Claude Code, Codex, or OpenCode with the same workflow\n- **Self-Correcting Loops** — Agent sees its previous work and fixes its own mistakes\n- **Autonomous Execution** — Set it running and come back to finished code\n- **Task Tracking** — Built-in task management with `--tasks` mode\n- **Live Monitoring** — Check progress with `--status` from another terminal\n- **Mid-Loop Hints** — Inject guidance with `--add-context` without stopping\n\n## Why Use an Agentic Loop?\n\n| Benefit | How it works |\n|---------|--------------|\n| **Self-Correction** | AI sees test failures from previous runs, fixes them |\n| **Persistence** | Walk away, come back to completed work |\n| **Iteration** | Complex tasks broken into incremental progress |\n| **Automation** | No babysitting—loop handles retries |\n| **Observability** | Monitor progress with `--status`, see history and struggle indicators |\n| **Mid-Loop Guidance** | Inject hints with `--add-context` without stopping the loop |\n\n## Installation\n\n**Prerequisites:**\n- [Bun](https:\u002F\u002Fbun.sh) runtime\n- At least one AI coding agent CLI:\n  - [Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code) — Anthropic's Claude Code CLI\n  - [Codex](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex) — OpenAI's Codex CLI\n  - [Copilot CLI](https:\u002F\u002Fgithub.com\u002Fgithub\u002Fcopilot-cli) — GitHub's Copilot CLI\n  - [Cursor Agent](https:\u002F\u002Fcursor.com\u002Fcli\u002F) — Cursor's headless Agent CLI\n  - [OpenCode](https:\u002F\u002Fopencode.ai) — Open-source AI coding assistant\n\n### npm (recommended)\n\n```bash\nnpm install -g @th0rgal\u002Fralph-wiggum\n```\n\n### Bun\n\n```bash\nbun add -g @th0rgal\u002Fralph-wiggum\n```\n\n### From source\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fopen-ralph-wiggum\ncd open-ralph-wiggum\n.\u002Finstall.sh\n```\n\n```powershell\ngit clone https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fopen-ralph-wiggum\ncd open-ralph-wiggum\n.\\install.ps1\n```\n\nThis installs the `ralph` CLI command globally.\n\n## Quick Start\n\n```bash\n# Simple task with iteration limit\nralph \"Create a hello.txt file with 'Hello World'. Output \u003Cpromise>DONE\u003C\u002Fpromise> when complete.\" \\\n  --max-iterations 5\n\n# Build something real\nralph \"Build a REST API for todos with CRUD operations and tests. \\\n  Run tests after each change. Output \u003Cpromise>COMPLETE\u003C\u002Fpromise> when all tests pass.\" \\\n  --max-iterations 20\n\n# Use Claude Code instead of OpenCode\nralph \"Create a small CLI and document usage. Output \u003Cpromise>COMPLETE\u003C\u002Fpromise> when done.\" \\\n  --agent claude-code --model claude-sonnet-4 --max-iterations 5\n\n# Use Codex instead of OpenCode\nralph \"Create a small CLI and document usage. Output \u003Cpromise>COMPLETE\u003C\u002Fpromise> when done.\" \\\n  --agent codex --model gpt-5-codex --max-iterations 5\n\n# Use Copilot CLI\nralph \"Create a small CLI and document usage. Output \u003Cpromise>COMPLETE\u003C\u002Fpromise> when done.\" \\\n  --agent copilot --max-iterations 5\n\n# Complex project with Tasks Mode\nralph \"Build a full-stack web application with user auth and database\" \\\n  --tasks --max-iterations 50\n```\n\n## Environment Variables\n\nConfigure agent binaries with these environment variables:\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `RALPH_OPENCODE_BINARY` | Path to OpenCode CLI | `\"opencode\"` |\n| `RALPH_CLAUDE_BINARY` | Path to Claude Code CLI | `\"claude\"` |\n| `RALPH_CODEX_BINARY` | Path to Codex CLI | `\"codex\"` |\n| `RALPH_COPILOT_BINARY` | Path to Copilot CLI | `\"copilot\"` |\n| `RALPH_CURSOR_AGENT_BINARY` | Path to Cursor Agent CLI | `\"cursor-agent\"` |\n\n**Note for Windows users:** Ralph automatically resolves `.cmd` extensions for npm-installed CLIs. If you encounter \"command not found\" errors, you can use these environment variables to specify the full path to the executable.\n\n## Commands\n\n### Running a Loop\n\n```bash\nralph \"\u003Cprompt>\" [options]\n\nOptions:\n  --agent AGENT            AI agent to use: opencode (default), claude-code, codex, copilot, cursor-agent\n  --min-iterations N       Minimum iterations before completion allowed (default: 1)\n  --max-iterations N       Stop after N iterations (default: unlimited)\n  --completion-promise T   Text that signals completion (default: COMPLETE)\n  --abort-promise TEXT     Phrase that signals early abort (e.g., precondition failed)\n  --tasks, -t              Enable Tasks Mode for structured task tracking\n  --task-promise T         Text that signals task completion (default: READY_FOR_NEXT_TASK)\n  --model MODEL            Model to use (agent-specific)\n  --rotation LIST          Agent\u002Fmodel rotation for each iteration (comma-separated)\n  --prompt-file, --file, -f  Read prompt content from a file\n  --prompt-template PATH   Use custom prompt template (see Custom Prompts)\n  --no-stream              Buffer agent output and print at the end\n  --verbose-tools          Print every tool line (disable compact tool summary)\n  --questions              Enable interactive question handling (default: enabled)\n  --no-questions           Disable interactive question handling (agent will loop on questions)\n  --no-plugins             Disable non-auth OpenCode plugins for this run (opencode only)\n  --no-commit              Don't auto-commit after iterations\n  --allow-all              Auto-approve all tool permissions (default: on)\n  --no-allow-all           Require interactive permission prompts\n  --config PATH            Use custom agent config file\n  --init-config [PATH]     Write default agent config to PATH and exit\n  --help                   Show help\n```\n\n### Tasks Mode\n\nTasks Mode allows you to break complex projects into smaller, manageable tasks. Ralph works on one task at a time and tracks progress in a markdown file.\n\n```bash\n# Enable Tasks Mode\nralph \"Build a complete web application\" --tasks --max-iterations 20\n\n# Custom task completion signal\nralph \"Multi-feature project\" --tasks --task-promise \"TASK_DONE\"\n```\n\n#### Task Management Commands\n\n```bash\n# List current tasks\nralph --list-tasks\n\n# Add a new task\nralph --add-task \"Implement user authentication\"\n\n# Remove task by index\nralph --remove-task 3\n\n# Show status (tasks shown automatically when tasks mode is active)\nralph --status\n```\n\n#### How Tasks Mode Works\n\n1. **Task File**: Tasks are stored in `.ralph\u002Fralph-tasks.md`\n2. **One Task Per Iteration**: Ralph focuses on a single task to reduce confusion\n3. **Automatic Progression**: When a task completes (`\u003Cpromise>READY_FOR_NEXT_TASK\u003C\u002Fpromise>`), Ralph moves to the next\n4. **Persistent State**: Tasks survive loop restarts\n5. **Focused Context**: Smaller contexts per iteration reduce costs and improve reliability\n\nTask status indicators:\n- `[ ]` - Not started\n- `[\u002F]` - In progress\n- `[x]` - Complete\n\nExample task file:\n```markdown\n# Ralph Tasks\n\n- [ ] Set up project structure\n- [x] Initialize git repository\n- [\u002F] Implement user authentication\n  - [ ] Create login page\n  - [ ] Add JWT handling\n- [ ] Build dashboard UI\n```\n\n### Custom Prompt Templates\n\nYou can fully customize the prompt sent to the agent using `--prompt-template`. This is useful for integrating with custom workflows or tools.\n\n```bash\nralph \"Build a REST API\" --prompt-template .\u002Fmy-template.md\n```\n\n**Available variables:**\n\n| Variable | Description |\n|----------|-------------|\n| `{{iteration}}` | Current iteration number |\n| `{{max_iterations}}` | Maximum iterations (or \"unlimited\") |\n| `{{min_iterations}}` | Minimum iterations |\n| `{{prompt}}` | The user's task prompt |\n| `{{completion_promise}}` | Completion promise text (e.g., \"COMPLETE\") |\n| `{{abort_promise}}` | Abort promise text (if configured) |\n| `{{task_promise}}` | Task promise text (for tasks mode) |\n| `{{context}}` | Additional context added mid-loop |\n| `{{tasks}}` | Task list content (for tasks mode) |\n\n**Example template (`my-template.md`):**\n\n```markdown\n# Iteration {{iteration}} \u002F {{max_iterations}}\n\n## Task\n{{prompt}}\n\n## Instructions\n1. Check beads for current status\n2. Decide what to do next\n3. When the epic in beads is complete, output:\n   \u003Cpromise>{{completion_promise}}\u003C\u002Fpromise>\n\n{{context}}\n```\n\n### Monitoring & Control\n\n```bash\n# Check status of active loop (run from another terminal)\nralph --status\n\n# Add context\u002Fhints for the next iteration\nralph --add-context \"Focus on fixing the auth module first\"\n\n# Clear pending context\nralph --clear-context\n```\n\n### Status Dashboard\n\nThe `--status` command shows:\n- **Active loop info**: Current iteration, elapsed time, prompt\n- **Pending context**: Any hints queued for next iteration\n- **Current tasks**: Automatically shown when tasks mode is active (or use `--tasks`)\n- **Iteration history**: Last 5 iterations with tools used, duration\n- **Struggle indicators**: Warnings if agent is stuck (no progress, repeated errors)\n\n```\n╔══════════════════════════════════════════════════════════════════╗\n║                    Ralph Wiggum Status                           ║\n╚══════════════════════════════════════════════════════════════════╝\n\n🔄 ACTIVE LOOP\n   Iteration:    3 \u002F 10\n   Elapsed:      5m 23s\n   Promise:      COMPLETE\n   Prompt:       Build a REST API...\n\n📊 HISTORY (3 iterations)\n   Total time:   5m 23s\n\n   Recent iterations:\n   🔄 #1: 2m 10s | Bash:5 Write:3 Read:2\n   🔄 #2: 1m 45s | Edit:4 Bash:3 Read:2\n   🔄 #3: 1m 28s | Bash:2 Edit:1\n\n⚠️  STRUGGLE INDICATORS:\n   - No file changes in 3 iterations\n   💡 Consider using: ralph --add-context \"your hint here\"\n```\n\n### Mid-Loop Context Injection\n\nGuide a struggling agent without stopping the loop:\n\n```bash\n# In another terminal while loop is running\nralph --add-context \"The bug is in utils\u002Fparser.ts line 42\"\nralph --add-context \"Try using the singleton pattern for config\"\n```\n\nContext is automatically consumed after one iteration.\n\n## Troubleshooting\n\n### Plugin errors\n\nThis package is **CLI-only**. If OpenCode tries to load a `ralph-wiggum` or `open-ralph-wiggum` plugin,\nremove it from your OpenCode `plugin` list (opencode.json), or run:\n\n```bash\nralph \"Your task\" --no-plugins\n```\n\n### ProviderModelNotFoundError \u002F Model not configured\n\nIf you see `ProviderModelNotFoundError` or \"Provider returned error\", you need to configure a default model:\n\n**For OpenCode:**\n1. Edit `~\u002F.config\u002Fopencode\u002Fopencode.json`:\n   ```json\n   {\n     \"$schema\": \"https:\u002F\u002Fopencode.ai\u002Fconfig.json\",\n     \"model\": \"your-provider\u002Fmodel-name\"\n   }\n   ```\n2. Or use the `--model` flag: `ralph \"task\" --model provider\u002Fmodel`\n\n**For other agents:**\nUse the `--model` flag to specify the model explicitly.\n\n### \"command not found\" on Windows\n\nRalph automatically tries `.cmd` extensions on Windows. If you still have issues:\n1. Set the full path using environment variables:\n   ```powershell\n   $env:RALPH_OPENCODE_BINARY = \"C:\\path\\to\\opencode.cmd\"\n   ```\n2. Or add the CLI to your PATH\n\n### \"bun: command not found\"\n\nInstall Bun: https:\u002F\u002Fbun.sh\n\n## Writing Good Prompts\n\n### Include Clear Success Criteria\n\n❌ Bad:\n```\nBuild a todo API\n```\n\n✅ Good:\n```\nBuild a REST API for todos with:\n- CRUD endpoints (GET, POST, PUT, DELETE)\n- Input validation\n- Tests for each endpoint\n\nRun tests after changes. Output \u003Cpromise>COMPLETE\u003C\u002Fpromise> when all tests pass.\n```\n\n### Use Verifiable Conditions\n\n❌ Bad:\n```\nMake the code better\n```\n\n✅ Good:\n```\nRefactor auth.ts to:\n1. Extract validation into separate functions\n2. Add error handling for network failures\n3. Ensure all existing tests still pass\n\nOutput \u003Cpromise>DONE\u003C\u002Fpromise> when refactored and tests pass.\n```\n\n### Always Set Max Iterations\n\n```bash\n# Safety net for runaway loops\nralph \"Your task\" --max-iterations 20\n```\n\n## Recommended PRD Format\n\nRalph treats prompt files as plain text, so any format works. For best results, use a concise PRD with:\n\n- **Goal**: one sentence summary of the desired outcome\n- **Scope**: what is in\u002Fout\n- **Requirements**: numbered, testable items\n- **Constraints**: tech stack, performance, security, compatibility\n- **Acceptance criteria**: explicit success checks\n- **Completion promise**: include `\u003Cpromise>COMPLETE\u003C\u002Fpromise>` (or match your `--completion-promise`)\n\nExample (Markdown):\n\n```markdown\n# PRD: Add Export Button\n\n## Goal\nLet users export reports as CSV from the dashboard.\n\n## Scope\n- In: export current report view\n- Out: background exports, scheduling\n\n## Requirements\n1. Add \"Export CSV\" button to dashboard header.\n2. CSV includes columns: date, revenue, sessions.\n3. Works for reports up to 10k rows.\n\n## Constraints\n- Keep current UI styling.\n- Use existing CSV utility in utils\u002Fcsv.ts.\n\n## Acceptance Criteria\n- Clicking button downloads a valid CSV.\n- CSV opens cleanly in Excel\u002FSheets.\n- All existing tests pass.\n\n## Completion Promise\n\u003Cpromise>COMPLETE\u003C\u002Fpromise>\n```\n\n### JSON Feature List (Recommended for Complex Projects)\n\nFor larger projects, a structured JSON feature list works better than prose. Based on [Anthropic's research on effective agent harnesses](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Feffective-harnesses-for-long-running-agents), JSON format reduces the chance of agents inappropriately modifying test definitions.\n\nCreate a `features.json` file:\n\n```json\n{\n  \"features\": [\n    {\n      \"category\": \"functional\",\n      \"description\": \"Export button downloads CSV with current report data\",\n      \"steps\": [\n        \"Navigate to dashboard\",\n        \"Click 'Export CSV' button\",\n        \"Verify CSV file downloads\",\n        \"Open CSV and verify columns: date, revenue, sessions\",\n        \"Verify data matches displayed report\"\n      ],\n      \"passes\": false\n    },\n    {\n      \"category\": \"functional\",\n      \"description\": \"Export handles large reports up to 10k rows\",\n      \"steps\": [\n        \"Load report with 10,000 rows\",\n        \"Click 'Export CSV' button\",\n        \"Verify export completes without timeout\",\n        \"Verify all rows present in CSV\"\n      ],\n      \"passes\": false\n    },\n    {\n      \"category\": \"ui\",\n      \"description\": \"Export button matches existing dashboard styling\",\n      \"steps\": [\n        \"Navigate to dashboard\",\n        \"Verify button uses existing button component\",\n        \"Verify button placement in header area\"\n      ],\n      \"passes\": false\n    }\n  ]\n}\n```\n\nThen reference it in your prompt:\n\n```\nRead features.json for the feature list. Work through each feature one at a time.\nAfter verifying a feature works end-to-end, update its \"passes\" field to true.\nDo NOT modify the description or steps - only change the passes boolean.\nOutput \u003Cpromise>COMPLETE\u003C\u002Fpromise> when all features pass.\n```\n\n**Why JSON?** Agents are less likely to inappropriately modify JSON test definitions compared to Markdown. The structured format keeps agents focused on implementation rather than redefining success criteria.\n\n## When to Use Ralph\n\n**Good for:**\n- Tasks with automatic verification (tests, linters, type checking)\n- Well-defined tasks with clear completion criteria\n- Greenfield projects where you can walk away\n- Iterative refinement (getting tests to pass)\n\n**Not good for:**\n- Tasks requiring human judgment\n- One-shot operations\n- Unclear success criteria\n- Production debugging\n\n## How It Works\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                                                             │\n│   ┌──────────┐    same prompt    ┌──────────┐              │\n│   │          │ ───────────────▶  │          │              │\n│   │  ralph   │                   │ AI Agent │              │\n│   │   CLI    │ ◀─────────────── │          │              │\n│   │          │   output + files  │          │              │\n│   └──────────┘                   └──────────┘              │\n│        │                              │                     │\n│        │ check for                    │ modify              │\n│        │ \u003Cpromise>                    │ files               │\n│        ▼                              ▼                     │\n│   ┌──────────┐                   ┌──────────┐              │\n│   │ Complete │                   │   Git    │              │\n│   │   or     │                   │  Repo    │              │\n│   │  Retry   │                   │ (state)  │              │\n│   └──────────┘                   └──────────┘              │\n│                                                             │\n└─────────────────────────────────────────────────────────────┘\n```\n\n1. Ralph sends your prompt to the selected agent\n2. The agent works on the task, modifies files\n3. Ralph checks output for completion promise\n4. If not found, repeat with same prompt\n5. AI sees previous work in files\n6. Loop until success or max iterations\n\n## Project Structure\n\n```\nralph-wiggum\u002F\n├── bin\u002Fralph.js                  # CLI entrypoint (npm wrapper)\n├── ralph.ts                      # Main loop implementation\n├── package.json                  # Package config\n├── install.sh \u002F install.ps1     # Installation scripts\n└── uninstall.sh \u002F uninstall.ps1 # Uninstallation scripts\n```\n\n### State Files (in .ralph\u002F)\n\nDuring operation, Ralph stores state in `.ralph\u002F`:\n- `ralph-loop.state.json` - Active loop state\n- `ralph-history.json` - Iteration history and metrics\n- `ralph-context.md` - Pending context for next iteration\n- `ralph-tasks.md` - Task list for Tasks Mode (created when `--tasks` is used)\n- `ralph-questions.json` - Pending user answers to agent questions\n\n## Uninstall\n\n```bash\nnpm uninstall -g @th0rgal\u002Fralph-wiggum\n```\n\n```powershell\nnpm uninstall -g @th0rgal\u002Fralph-wiggum\n```\n\n## Agent-Specific Notes\n\n### Claude Code\n\n[Claude Code](https:\u002F\u002Fdocs.anthropic.com\u002Fen\u002Fdocs\u002Fclaude-code) is Anthropic's official CLI for Claude. Use it with Open Ralph Wiggum for powerful autonomous coding:\n\n```bash\nralph \"Refactor the auth module and ensure tests pass\" \\\n  --agent claude-code \\\n  --model claude-sonnet-4 \\\n  --max-iterations 15\n```\n\n### OpenAI Codex\n\n[Codex](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex) is OpenAI's code-specialized agent. Perfect for code generation and refactoring tasks:\n\n```bash\nralph \"Generate unit tests for all utility functions\" \\\n  --agent codex \\\n  --model gpt-5-codex \\\n  --max-iterations 10\n```\n\n### OpenCode\n\n[OpenCode](https:\u002F\u002Fopencode.ai) is an open-source AI coding assistant. It's the default agent:\n\n```bash\nralph \"Fix all TypeScript errors\" --max-iterations 10\n```\n\n### Copilot CLI\n\n[Copilot CLI](https:\u002F\u002Fgithub.com\u002Fgithub\u002Fcopilot-cli) is GitHub's agentic coding tool (public preview). It requires a GitHub Copilot subscription and authentication via `GH_TOKEN`, `GITHUB_TOKEN`, or prior `copilot \u002Flogin`.\n\n**Install:**\n```bash\nnpm install -g @github\u002Fcopilot\n# or\nbrew install copilot-cli\n```\n\n**Usage:**\n```bash\nralph \"Refactor the auth module and add tests\" \\\n  --agent copilot \\\n  --max-iterations 15\n\n# With a specific model\nralph \"Build a REST API\" \\\n  --agent copilot \\\n  --model claude-opus-4.6 \\\n  --max-iterations 10\n```\n\n**Notes:**\n- Default model is Claude Sonnet 4.5; override with `--model`\n- `--allow-all` (default) maps to `--allow-all` + `--no-ask-user` in Copilot CLI\n- `--no-plugins` has no effect with Copilot CLI\n- Authentication: set `GH_TOKEN` \u002F `GITHUB_TOKEN` env var, or run `copilot \u002Flogin` first\n\n### Cursor Agent\n\n[Cursor Agent](https:\u002F\u002Fcursor.com\u002Fcli\u002F) is Cursor's headless CLI agent. It works with any model available through your Cursor subscription.\n\n**Install:**\n```bash\ncurl https:\u002F\u002Fcursor.com\u002Finstall -fsSL | bash\n```\n\n**Usage:**\n```bash\nralph \"Add integration tests for the API\" \\\n  --agent cursor-agent \\\n  --max-iterations 10\n\n# With a specific model\nralph \"Refactor the database layer\" \\\n  --agent cursor-agent \\\n  --model sonnet-4 \\\n  --max-iterations 15\n```\n\n**Notes:**\n- `--allow-all` (default) maps to `--force` in Cursor Agent CLI\n- `--no-plugins` has no effect with Cursor Agent\n- For headless environments (no Cursor window), set the `CURSOR_API_KEY` environment variable\n- The binary is `cursor-agent`; override with `RALPH_CURSOR_AGENT_BINARY` env var\n\n## Agent Rotation\n\nAgent rotation lets you cycle through different agent\u002Fmodel combinations across iterations. This is useful for leveraging the strengths of different models or comparing their performance on a task.\n\n### Format\n\nEach rotation entry uses the `agent:model` format:\n\n```\n--rotation \"agent1:model1,agent2:model2,agent3:model3\"\n```\n\n**Valid agents:** `opencode`, `claude-code`, `codex`, `copilot`, `cursor-agent`\n\n### Example Usage\n\n```bash\n# Alternate between OpenCode and Claude Code\nralph \"Build a REST API\" \\\n  --rotation \"opencode:claude-sonnet-4,claude-code:claude-sonnet-4\" \\\n  --max-iterations 10\n\n# Cycle through three different configurations\nralph \"Refactor the auth module\" \\\n  --rotation \"opencode:claude-sonnet-4,claude-code:claude-sonnet-4,codex:gpt-5-codex\" \\\n  --max-iterations 15\n\n# Include Copilot in the rotation\nralph \"Build a REST API\" \\\n  --rotation \"opencode:claude-sonnet-4,copilot:claude-sonnet-4\" \\\n  --max-iterations 10\n```\n\n### Flag Interaction\n\nWhen `--rotation` is used, the `--agent` and `--model` flags are **ignored**. The rotation list takes precedence for agent\u002Fmodel selection.\n\n### Cycling Behavior\n\nThe rotation cycles back to the first entry after reaching the end:\n\n- Iteration 1 → Entry 1\n- Iteration 2 → Entry 2\n- Iteration 3 → Entry 1 (wraps around for a 2-entry rotation)\n- ...and so on\n\n### Error Messages\n\nInvalid rotation entries produce clear error messages:\n\n**Invalid agent name:**\n```\nError: Invalid agent 'invalid' in rotation entry 'invalid:model'. Valid agents: opencode, claude-code, codex, copilot\n```\n\n**Malformed entry (missing colon):**\n```\nError: Invalid rotation entry 'opencode-model'. Expected format: agent:model\n```\n\n**Empty values:**\n```\nError: Invalid rotation entry 'opencode:'. Both agent and model are required.\n```\n\n### Status Display\n\nWhen using `--status` with an active rotation, the output shows all rotation entries and marks the current one:\n\n```\n🔄 ACTIVE LOOP\n   Iteration:    3 \u002F 10\n   Prompt:       Build a REST API...\n\n   Rotation (position 1\u002F2):\n   1. opencode:claude-sonnet-4  **ACTIVE**\n   2. claude-code:claude-sonnet-4\n```\n\n### Iteration History\n\nThe `--status` command shows which agent and model was used for each iteration:\n\n```\n📊 HISTORY (3 iterations)\n   Total time:   5m 23s\n\n   Recent iterations:\n   #1  2m 10s  opencode \u002F claude-sonnet-4  Bash(5) Write(3) Read(2)\n   #2  1m 45s  claude-code \u002F claude-sonnet-4  Edit(4) Bash(3) Read(2)\n   #3  1m 28s  opencode \u002F claude-sonnet-4  Bash(2) Edit(1)\n```\n\n## Learn More\n\n- [Original Ralph Wiggum technique by Geoffrey Huntley](https:\u002F\u002Fghuntley.com\u002Fralph\u002F)\n- [Ralph Orchestrator](https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fralph-orchestrator)\n\n## See Also\n\nCheck out 🏝️ [sandboxed.sh](https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Fsandboxed.sh) — a dashboard for orchestrating AI agents with workspace management, real-time monitoring, and multi-agent workflows.\n\n## License\n\nMIT\n","Open Ralph Wiggum 是一个实现自主代理循环的工具，支持多种AI编码助手如Claude Code、Codex、Copilot CLI等。其核心功能是通过输入`ralph \"prompt\"`启动一个持续迭代的开发循环，并允许用户指定不同的AI代理进行代码生成与优化，同时提供状态检查等功能。该项目基于TypeScript构建，具备良好的扩展性和兼容性。适用于需要利用AI辅助编程以提高效率或探索新解决方案的开发者和团队，在不破坏本地环境的前提下，通过迭代循环的方式快速推进项目进展。",2,"2026-06-11 03:51:31","high_star"]