ralph-orchestrator
Ralph Orchestrator
Ralph Loop = a Stop hook that re-feeds the same prompt on every session exit, letting Claude iterate until a completion promise appears.
Plugin location: ~/.claude/plugins/cache/claude-plugins-official/ralph-loop/1.0.0/
Core Principle
The orchestrator's job is before and after the loop — not inside it. Keep this conversation context lean; the loop runs autonomously.
Three phases:
- Pre-flight — define the task, write a great prompt, set limits
- Launch — hand off to ralph-loop
- Monitor — check progress, detect stuck loops, adjust if needed
Phase 1: Pre-flight
Assess the task
Ask if unclear (max 2 questions):
- "What's the task? One sentence."
- "How will we know it's done — tests passing, a file existing, a specific output?"
Ralph is a good fit when:
- Clear, verifiable completion criteria exist (tests pass, linter clean, file produced)
- Task benefits from iteration (TDD, bug fixing, code generation)
- You can walk away and let it run
Ralph is NOT a good fit when:
- Task requires human design decisions mid-way
- No automatic way to verify completion
- One-shot operation (use
/gsd-fastinstead)
Draft the prompt
A good ralph prompt has four parts:
[TASK DESCRIPTION]
What to build/fix in concrete terms.
[SELF-CORRECTION LOOP]
Run tests after each change. If any fail, read the errors, fix them, and run again.
Check [linter/build/output] before declaring done.
[ESCAPE HATCH]
After [N-3] iterations, if still not complete:
- Document what's blocking
- List approaches tried
- Suggest alternatives
[COMPLETION PROMISE]
Output exactly: <promise>COMPLETE</promise>
Only output this when ALL criteria are unequivocally met.
Present the drafted prompt to the user and ask: "Does this capture what you want? Adjust anything before we launch."
Set safe limits
Recommend --max-iterations based on task complexity:
| Task type | Suggested limit |
|---|---|
| Simple fix, clear criteria | 10–15 |
| Feature with tests | 20–30 |
| Greenfield small project | 30–50 |
| Complex multi-phase | 50+ (monitor closely) |
Always set a limit. Always include an escape hatch in the prompt at limit - 3 iterations.
Phase 2: Launch
Show the final command for the user to run:
/ralph-loop "[prompt]" --completion-promise "COMPLETE" --max-iterations N
Tell the user:
"Ralph is now running. Each time Claude tries to exit, the hook re-feeds the prompt. You'll see iteration progress in git history. Come back and tell me when it finishes, gets stuck, or you want a status check."
Do not keep talking or consuming context during the loop. Hand off cleanly.
Phase 3: Monitor
When the user reports back, check progress:
git log --oneline -20
Detecting a stuck loop
Signs the loop is stuck:
- Same commit messages repeating
- Test failures not decreasing after 5+ iterations
- "attempting" the same approach repeatedly in git messages
If stuck → suggest prompt adjustment:
- Add more specific instructions about the failing step
- Add a hint: "The error is in [file/line] — focus there"
- Reduce scope: break into smaller sub-tasks
- Cancel with
/cancel-ralphand relaunch with refined prompt
Completion
When the completion promise fires:
- Review final state:
git log --oneline, run tests manually - Ask: "Was the output what you expected? Any follow-up needed?"
- Suggest:
/gsd-fast "cleanup/polish"for any small finishing touches
Windows Note
If the Stop hook fails with WSL errors, fix the hook to use Git Bash:
"command": "\"C:/Program Files/Git/bin/bash.exe\" ${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh"
Edit: ~/.claude/plugins/cache/claude-plugins-official/ralph-loop/<hash>/hooks/hooks.json
More from tebjan/agent-skills
caveman-smart
Intelligent token-efficiency mode. Compresses routine chat and thinking but stays in full prose for reasoning, architecture, and safety-critical topics. Applies per response, not per session. Use when the user says 'caveman', 'terse', 'kurz', 'kurz&knapp', 'kurz bitte', 'weniger text', 'less tokens', 'smart mode', or invokes /caveman-smart. Stays active until the user says 'normal mode', 'verbose', or 'ausführlich'. Built for HPC, real-time, graphics, embedded, and kernel work where technical precision matters more than word count but explanation-of-why still demands full prose.
2fix-jsonl-surrogates
Diagnose and repair 'invalid high surrogate' API errors in Claude Code chat sessions. Use this skill when the user encounters API Error 400 with 'invalid high surrogate in string', 'not valid JSON', surrogate-related errors, or wants to fix/scan/repair a broken Claude Code JSONL chat file. Also use when a session refuses to resume due to JSON encoding errors, or when the user mentions request IDs (req_...) alongside JSON parse failures.
2swarm-advisor
Advises on multi-agent swarm design using Claude Code's TeammateTool and Task system. Use when the user wants to parallelize work across agents, asks 'should I use a swarm for this?', wants help designing team topology, needs to break a task into parallel workstreams, or is getting started with swarm-orchestration. Assesses whether a swarm is worth the overhead, recommends team size and structure, helps decompose tasks with correct dependencies, and tracks swarm health. Complements the swarm-orchestration skill by adding the 'think before you spawn' layer.
1gsd-orchestrator
Orchestrates and advises on complete GSD (Get Shit Done) development workflows. Acts as both workflow driver and expert consultant — reads context, suggests the right tools, asks clarifying questions when intent is unclear, spawns subagents for each step, and never loses focus on workflow completion. Use when the user wants to build something, asks which GSD command to use, says 'help me with GSD', 'run the GSD workflow', 'let's start a project', 'what should I do next', or describes any dev task that might benefit from structured planning. Also triggers when the task scope is ambiguous and needs routing to fast/quick/full GSD flow.
1install-github-plugin
Installs Claude Code plugins from GitHub repos that lack a marketplace manifest. Use this skill whenever a `claude plugin install` fails due to SSH key errors, missing `.claude-plugin/marketplace.json`, or a GitHub repo that wasn't designed as a Claude plugin marketplace. Also use when the user says \"install plugin from GitHub\", \"add skills from a repo\", or \"the plugin install failed\". Handles the full workflow: cloning via gh CLI, inspecting repo structure, generating the marketplace manifest, and running the install.
1addy-orchestrator
Orchestrates end-to-end software development using the addyosmani/agent-skills framework. Guides the user through define → plan → build → verify → review → ship phases, spawns subagents for each step, tracks state persistently, and never loses focus on workflow completion. Use when the user says \"let's build X\", \"help me implement X\", \"walk me through X\", or wants structured multi-phase dev guidance. Also triggers when a task is clearly non-trivial and would benefit from phased execution.
1