ralph-loop-mcp
This server implements the Ralph Loop — a multi-model iterative development workflow where a "worker" AI model performs tasks and a "reviewer" AI model provides feedback, cycling until the reviewer decides to "SHIP" the work.
Core capabilities:
Initialize a session (
ralph_loop_initialize) — Start a new iterative cycle for a task, configuring worker/reviewer models, providers, max iterations, and cross-model review enforcement.Retrieve the current task (
ralph_loop_get_task) — Fetch the task description for the worker phase.Submit completed work (
ralph_loop_submit_work) — Submit the worker's output and summary, transitioning the session to the review phase.Retrieve submitted work (
ralph_loop_get_work) — Fetch the worker's output so the reviewer model can evaluate it.Submit a review decision (
ralph_loop_submit_review) — SubmitSHIP(accept) orREVISE(iterate) with optional feedback.Retrieve reviewer feedback (
ralph_loop_get_feedback) — Get feedback for the next worker iteration, or confirm completion ifSHIP.Check session status (
ralph_loop_get_status) — Get the current iteration number, phase (work/review), and overall state.Get model configuration (
ralph_loop_get_config) — Retrieve the worker/reviewer model and provider setup for a session.Reset a session (
ralph_loop_reset) — Clear all state files to restart a session fresh.Block an iteration (
ralph_loop_block) — Signal the worker is stuck with a reason, creating aRALPH-BLOCKED.mdmarker to halt the loop.Run a full automated loop (
ralph_loop_run) — Execute the complete workflow from initialization through orchestration automatically.
Session state is persisted in a file-based system (~/.goose/ralph/{sessionId}/), and supported LLM providers include Anthropic, OpenAI, Google, GitHub Copilot, and Goose.
Allows using GitHub Copilot as worker or reviewer in the Ralph Loop.
Allows using Google's Gemini models as worker or reviewer in the Ralph Loop.
Allows using OpenAI's models (e.g., GPT-4) as worker or reviewer in the Ralph Loop.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ralph-loop-mcpstart a Ralph Loop session to implement JWT auth"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ralph-loop-runner
A cross-platform implementation of the Ralph Loop — a multi-model iterative development technique where a "worker" model does the work and a "reviewer" model provides cross-model review, iterating until the reviewer says "SHIP".
Based on:
Ralph Wiggum as a "software engineer" by Geoffrey Huntley
Overview
The Ralph Loop implements a two-phase iterative workflow:
┌─────────────────────────────────────────────────────────────┐
│ RALPH LOOP │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────┐ WORK PHASE ┌─────────┐ │
│ │ TASK │ ──────────────────▶ │ WORKER │ │
│ │ │ fresh context │ (Model A)│ │
│ └─────────┘ └────┬────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Submit Work + │ │
│ │ Summary │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ │
│ ┌─────────┐ REVIEW PHASE ┌─────────┐ │
│ │ REVIEWER│ ◀─────────────────── │ WORK │ │
│ │(Model B)│ cross-model review │ OUTPUT │ │
│ └────┬────┘ └─────────┘ │
│ │ │
│ ▼ │
│ ┌─────────┐ │
│ │ DECISION│ │
│ │ SHIP │──────▶ COMPLETE ✓ │
│ │ REVISE │──────▶ Next Iteration (fresh context) │
│ └─────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘Related MCP server: ralph-wiggum-mcp
Features
Cross-platform Native: Single script per platform (Bash for Linux/macOS, PowerShell for Windows) — no Node.js runtime required
Dual Mode Operation:
MCP Server Mode — JSON-RPC 2.0 over stdio for integration with AI agents
CLI Mode — Run the full loop directly from command line
Session-based: Multiple concurrent Ralph Loop sessions supported
File-based State: Persistent state stored in
~/.goose/ralph/{sessionId}/11 MCP Tools: Complete workflow control via MCP tools, including
ralph_loop_runfor full automationCross-Model Review: Worker/reviewer model configuration with validation
Multiple LLM Providers: Anthropic (Claude), OpenAI, Google (Gemini), GitHub Copilot, Goose
Flexible Configuration: Environment variables, CLI arguments, or MCP tool calls
Implementations
Platform | File | Requirements |
Linux/macOS |
| bash, jq |
Windows |
| PowerShell 5.1+, jq |
Both implementations provide identical functionality in a single script file each.
Installation
Prerequisites
jq - JSON processor (required for both Bash and PowerShell)
Linux:
apt-get install jq/yum install jq/apk add jqmacOS:
brew install jqWindows:
choco install jq/winget install jqlang.jq/scoop install jq
Bash (Linux/macOS) or PowerShell 5.1+ (Windows)
LLM CLI (for
ralph_loop_runand CLI mode):claude(Anthropic)openai(OpenAI)gemini(Google)copilot(GitHub Copilot) —npm install -g @github/copilotgoose(Goose) —go install github.com/aaif-goose/goose@latest
Setup
# Clone the repository
git clone https://github.com/sheldonrobinson/ralph-loop-mcp
cd ralph-loop-mcp
# Make executable (Linux/macOS)
chmod +x ralph-loop-runner.sh
# Configure in Claude Desktop (MCP mode):
{
mode):
{
"mcpServers": {
"ralph-loop": {
"command": "/path/to/ralph-loop-runner.sh",
"args": []
}
}
}Windows (PowerShell):
# Configure in claude_desktop_config.json:
{
"mcpServers": {
"ralph-loop": {
"command": "powershell.exe",
"args": ["-File", "C:\\path\\to\\ralph-loop-runner.ps1"]
}
}
}Usage
CLI Mode (Direct Execution)
Run the complete Ralph Loop directly from the command line:
# Linux/macOS - task as argument
./ralph-loop-runner.sh "Implement user authentication with JWT tokens"
# Linux/macOS - task from file
./ralph-loop-runner.sh ./task.md
# Windows
.\ralph-loop-runner.ps1 "Implement user authentication with JWT tokens"
.\ralph-loop-runner.ps1 .\task.mdWith environment variables:
RALPH_WORKER_MODEL=claude-3-5-sonnet \
RALPH_WORKER_PROVIDER=anthropic \
RALPH_REVIEWER_MODEL=gpt-4o \
RALPH_REVIEWER_PROVIDER=openai \
RALPH_MAX_ITERATIONS=5 \
./ralph-loop-runner.sh "Your task here"With command-line arguments:
./ralph-loop-runner.sh "Your task here" \
--worker-model claude-3-5-sonnet \
--worker-provider anthropic \
--worker-agent goose \
--reviewer-model gpt-4o \
--reviewer-provider openai \
--reviewer-agent goose \
--max-iterations 5 \
--work-guidelines ./recipes/ralph-work.yaml \
--review-guidelines ./recipes/ralph-review.yaml \
--session-id my-featureMCP Server Mode
When run without arguments, the script runs as an MCP server over stdio:
# Linux/macOS
./ralph-loop-runner.sh
# Windows
powershell.exe -File ralph-loop-runner.ps1Quick Start: Full Automated Loop (Recommended)
Use the ralph_loop_run tool to run the complete worker/reviewer loop automatically:
{
"method": "tools/call",
"params": {
"name": "ralph_loop_run",
"arguments": {
"sessionId": "my-feature",
"task": "Implement user authentication with JWT tokens",
"maxIterations": 5,
"workerModel": "claude-3-5-sonnet",
"workerProvider": "anthropic",
"workerAgent": "goose",
"reviewerModel": "gpt-4o",
"reviewerProvider": "openai",
"reviewerAgent": "goose",
"crossModelReviewEnforced": true,
"workGuidelines": "/path/to/ralph-work.yaml",
"reviewGuidelines": "/path/to/ralph-review.yaml"
}
}
}This tool handles:
Initialization - Creates session with worker/reviewer configuration
Orchestration - Loops through WORK → REVIEW phases
Execution - Calls LLM providers via CLI (claude, openai, gemini, copilot, goose)
State Management - Persists all state to
~/.goose/ralph/{sessionId}/
Manual Step-by-Step Workflow
For more control, use individual tools:
Initialize Session
{
"method": "tools/call",
"params": {
"name": "ralph_loop_initialize",
"arguments": {
"sessionId": "my-feature",
"task": "Implement user authentication with JWT tokens",
"maxIterations": 5,
"workerModel": "claude-3-5-sonnet",
"workerProvider": "anthropic",
"workerAgent": "goose",
"reviewerModel": "gpt-4o",
"reviewerProvider": "openai",
"reviewerAgent": "goose"
}
}
}Worker Phase - Get Task
{
"method": "tools/call",
"params": { "name": "ralph_loop_get_task", "arguments": { "sessionId": "my-feature" } }
}Worker Phase - Submit Work
{
"method": "tools/call",
"params": {
"name": "ralph_loop_submit_work",
"arguments": {
"sessionId": "my-feature",
"iteration": 1,
"work": "// Complete JWT implementation...",
"summary": "Implemented JWT auth with access/refresh tokens, middleware, and tests"
}
}
}Reviewer Phase - Get Work
{
"method": "tools/call",
"params": { "name": "ralph_loop_get_work", "arguments": { "sessionId": "my-feature" } }
}Reviewer Phase - Submit Review
{
"method": "tools/call",
"params": {
"name": "ralph_loop_submit_review",
"arguments": {
"sessionId": "my-feature",
"iteration": 1,
"decision": "REVISE",
"feedback": "Add token expiration handling and improve error messages"
}
}
}Next Iteration - Get Feedback
{
"method": "tools/call",
"params": { "name": "ralph_loop_get_feedback", "arguments": { "sessionId": "my-feature" } }
}Available Tools
Tool | Description |
| Initialize a new Ralph Loop session with a task |
| Get the current task for the worker phase |
| Submit work results and summary from worker |
| Get worker's submitted work for reviewer |
| Submit review decision (SHIP/REVISE) with feedback |
| Get reviewer feedback for next iteration |
| Get current session status (iteration, phase, state) |
| Get worker/reviewer model configuration |
| Reset/clear a session |
| Block current iteration with reason |
| Run complete automated loop (initialization → orchestration → execution → state management) |
State Management
State is stored in ~/.goose/ralph/{sessionId}/:
~/.goose/ralph/my-feature/
├── config.json # Worker/reviewer model configuration
├── task.json # Original task
├── work.json # Current work submission
├── review.json # Current review
├── work-complete.txt # Worker completion flag
├── review-result.txt # SHIP/REVISE decision
├── review-feedback.txt # Reviewer feedback
├── RALPH-BLOCKED.md # Blocking reason (if blocked)
└── iteration.txt # Current iteration numberCross-Model Review Setup
For true cross-model review, use different models for worker and reviewer:
Worker (e.g., Claude Sonnet):
Gets fresh context each iteration
Receives only task + feedback
Does the actual work
Reviewer (e.g., GPT-4, Gemini, or another Claude):
Reviews worker's output
Provides SHIP/REVISE decision
Gives specific feedback for revision
The crossModelReviewEnforced option (default: true) validates that worker and reviewer use different models/providers, warning if they are the same.
Blocking
If the worker gets stuck, they can block the iteration:
{
"method": "tools/call",
"params": {
"name": "ralph_loop_block",
"arguments": {
"sessionId": "my-feature",
"reason": "Cannot proceed - missing API credentials for external service"
}
}
}This creates RALPH-BLOCKED.md and stops the loop until resolved.
Configuration
Environment Variables
Variable | Description | Default |
| Worker model name | — |
| Worker provider (anthropic/openai/google/copilot/goose) | — |
| Worker agent (goose/claude/openai/gemini/copilot) | goose |
| Reviewer model name | — |
| Reviewer provider (anthropic/openai/google/copilot/goose) | — |
| Reviewer agent (goose/claude/openai/gemini/copilot) | goose |
| Max iterations (-1 for unlimited) | 10 |
| Path to work guidelines/recipe |
|
| Path to review guidelines/recipe |
|
| Base directory for recipes |
|
Command-Line Arguments (CLI Mode)
Argument | Description |
| Worker model name |
| Worker provider (anthropic/openai/google/copilot/goose) |
| Worker agent (goose/claude/openai/gemini/copilot) |
| Reviewer model name |
| Reviewer provider (anthropic/openai/google/copilot/goose) |
| Reviewer agent (goose/claude/openai/gemini/copilot) |
| Max iterations (-1 for unlimited) |
| Work guidelines/recipe file |
| Review guidelines/recipe file |
| Custom session ID |
Supported Providers
Provider | CLI Command | Notes |
Anthropic |
| Requires Anthropic API key |
OpenAI |
| Requires OpenAI API key |
| Requires Google API key | |
GitHub Copilot |
| Requires |
Goose |
| Uses Goose recipes for structured workflows |
API Reference
ralph_loop_initialize
{
sessionId?: string; // default: "default"
task: string; // required
maxIterations?: number; // default: 10, -1 = unlimited
workerModel?: string; // e.g., "claude-3-5-sonnet"
workerProvider?: string; // e.g., "anthropic"
workerAgent?: string; // e.g., "goose"
reviewerModel?: string; // e.g., "gpt-4o"
reviewerProvider?: string; // e.g., "openai"
reviewerAgent?: string; // e.g., "goose"
crossModelReviewEnforced?: boolean; // default: true
workGuidelines?: string; // path to work guidelines
reviewGuidelines?: string; // path to review guidelines
}ralph_loop_get_task
{ sessionId?: string; } // default: "default"ralph_loop_submit_work
{
sessionId?: string; // default: "default"
work: string; // required
summary: string; // required
iteration: number; // required, >= 1
}ralph_loop_get_work
{ sessionId?: string; } // default: "default"ralph_loop_submit_review
{
sessionId?: string; // default: "default"
decision: "SHIP" | "REVISE"; // required
feedback?: string; // required for REVISE
iteration: number; // required, >= 1
}ralph_loop_get_feedback
{ sessionId?: string; } // default: "default"ralph_loop_get_status
{ sessionId?: string; } // default: "default"ralph_loop_get_config
{ sessionId?: string; } // default: "default"ralph_loop_reset
{ sessionId?: string; } // default: "default"ralph_loop_block
{
sessionId?: string; // default: "default"
reason: string; // required
}ralph_loop_run
{
sessionId?: string; // default: "default"
task: string; // required
maxIterations?: number; // default: 10, -1 = unlimited
workerModel: string; // required
workerProvider: string; // required
workerAgent?: string; // default: "goose"
reviewerModel: string; // required
reviewerProvider: string; // required
reviewerAgent?: string; // default: "goose"
crossModelReviewEnforced?: boolean; // default: true
workGuidelines?: string; // path to work guidelines
reviewGuidelines?: string; // path to review guidelines
}License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sheldonrobinson/ralph-loop-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server