spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / plugins / ralph-wiggum / commands / help.md
126 lines · 3.2 KBPreviewCodeRaw
1---
2description: "Explain Ralph Wiggum technique and available commands"
3---
4
5# Ralph Wiggum Plugin Help
6
7Please explain the following to the user:
8
9## What is the Ralph Wiggum Technique?
10
11The Ralph Wiggum technique is an iterative development methodology based on continuous AI loops, pioneered by Geoffrey Huntley.
12
13**Core concept:**
14```bash
15while :; do
16 cat PROMPT.md | claude-code --continue
17done
18```
19
20The same prompt is fed to Claude repeatedly. The "self-referential" aspect comes from Claude seeing its own previous work in the files and git history, not from feeding output back as input.
21
22**Each iteration:**
231. Claude receives the SAME prompt
242. Works on the task, modifying files
253. Tries to exit
264. Stop hook intercepts and feeds the same prompt again
275. Claude sees its previous work in the files
286. Iteratively improves until completion
29
30The technique is described as "deterministically bad in an undeterministic world" - failures are predictable, enabling systematic improvement through prompt tuning.
31
32## Available Commands
33
34### /ralph-loop <PROMPT> [OPTIONS]
35
36Start a Ralph loop in your current session.
37
38**Usage:**
39```
40/ralph-loop "Refactor the cache layer" --max-iterations 20
41/ralph-loop "Add tests" --completion-promise "TESTS COMPLETE"
42```
43
44**Options:**
45- `--max-iterations <n>` - Max iterations before auto-stop
46- `--completion-promise <text>` - Promise phrase to signal completion
47
48**How it works:**
491. Creates `.claude/.ralph-loop.local.md` state file
502. You work on the task
513. When you try to exit, stop hook intercepts
524. Same prompt fed back
535. You see your previous work
546. Continues until promise detected or max iterations
55
56---
57
58### /cancel-ralph
59
60Cancel an active Ralph loop (removes the loop state file).
61
62**Usage:**
63```
64/cancel-ralph
65```
66
67**How it works:**
68- Checks for active loop state file
69- Removes `.claude/.ralph-loop.local.md`
70- Reports cancellation with iteration count
71
72---
73
74## Key Concepts
75
76### Completion Promises
77
78To signal completion, Claude must output a `<promise>` tag:
79
80```
81<promise>TASK COMPLETE</promise>
82```
83
84The stop hook looks for this specific tag. Without it (or `--max-iterations`), Ralph runs infinitely.
85
86### Self-Reference Mechanism
87
88The "loop" doesn't mean Claude talks to itself. It means:
89- Same prompt repeated
90- Claude's work persists in files
91- Each iteration sees previous attempts
92- Builds incrementally toward goal
93
94## Example
95
96### Interactive Bug Fix
97
98```
99/ralph-loop "Fix the token refresh logic in auth.ts. Output <promise>FIXED</promise> when all tests pass." --completion-promise "FIXED" --max-iterations 10
100```
101
102You'll see Ralph:
103- Attempt fixes
104- Run tests
105- See failures
106- Iterate on solution
107- In your current session
108
109## When to Use Ralph
110
111**Good for:**
112- Well-defined tasks with clear success criteria
113- Tasks requiring iteration and refinement
114- Iterative development with self-correction
115- Greenfield projects
116
117**Not good for:**
118- Tasks requiring human judgment or design decisions
119- One-shot operations
120- Tasks with unclear success criteria
121- Debugging production issues (use targeted debugging instead)
122
123## Learn More
124
125- Original technique: https://ghuntley.com/ralph/
126- Ralph Orchestrator: https://github.com/mikeyobrien/ralph-orchestrator