Ralph Loop logo

Ralph Loop

6

Continuous self-referential AI loops for iterative development, implementing the Ralph Wiggum technique. Run the agent in a while-true loop with the same prompt until task completion.

3 skills

cancel-ralph

Cancel an active Ralph Loop. Use when the user wants to stop, cancel, or abort a running ralph loop.

# Cancel Ralph ## Trigger The user wants to cancel or stop an active Ralph loop. ## Workflow 1. Check if `.cursor/ralph/scratchpad.md` exists. 2. **If it does not exist**: Tell the user "No active Ralph loop found." 3. **If it exists**: - Read `.cursor/ralph/scratchpad.md` to get the current iteration from the `iteration:` field. - Remove the state file and any done flag: ```bash rm -rf .cursor/ralph ``` - Report: "Cancelled Ralph loop (was at iteration N)." ## Output A short confirmation with the iteration count, or a message that no loop was active.

ralph-loop-help

Explain the Ralph Loop plugin, how it works, and available skills. Use when the user asks for help with ralph loop, wants to understand the technique, or needs usage examples.

# Ralph Loop Help ## Trigger The user asks what Ralph Loop is, how it works, or needs usage guidance. ## What to Explain ### What is Ralph Loop? Ralph Loop implements the Ralph Wiggum technique — an iterative development methodology based on continuous AI loops, pioneered by Geoffrey Huntley. Core concept: the same prompt is fed to the agent repeatedly. The "self-referential" aspect comes from the agent seeing its own previous work in the files and git history, not from feeding output back as input. Each iteration: 1. The agent receives the SAME prompt 2. Works on the task, modifying files 3. Tries to exit 4. Stop hook intercepts and feeds the same prompt again 5. The agent sees its previous work in the files 6. Iteratively improves until completion ### Starting a Ralph Loop Tell the agent your task along with options: ``` Start a ralph loop: "Build a REST API for todos" --max-iterations 20 --completion-promise "COMPLETE" ``` Options: - `--max-iterations N` — max iterations before auto-stop - `--completion-promise "TEXT"` — phrase to signal completion How it works: 1. Creates `.cursor/ralph/scratchpad.md` state file 2. Agent works on the task 3. Stop hook intercepts exit and feeds the same prompt back 4. Agent sees its previous work and iterates 5. Continues until promise detected or max iterations reached ### Cancelling a Ralph Loop Ask the agent to cancel the ralph loop. It will remove the state file and report the iteration count. ### Completion Promises To signal completion, the agent outputs a `<promise>` tag: ``` <promise>TASK COMPLETE</promise> ``` The stop hook looks for this specific tag. Without it (or `--max-iterations`), Ralph runs indefinitely. ### When to Use Ralph **Good for:** - Well-defined tasks with clear success criteria - Tasks requiring iteration and refinement - Iterative development with self-correction - Greenfield projects **Not good for:** - Tasks requiring human judgment or design decisions - One-shot operations - Tasks with unclear success criteria ### Learn More - Original technique: https://ghuntley.com/ralph/ - Ralph Orchestrator: https://github.com/mikeyobrien/ralph-orchestrator ## Output Present the above information clearly to the user, tailored to their specific question.

ralph-loop

Start a Ralph Loop for iterative self-referential development. Use when the user asks to run a ralph loop, start an iterative loop, or wants repeated autonomous iteration on a task until completion.

# Ralph Loop ## Trigger The user wants to start a Ralph loop. An iterative development loop where the same prompt is fed back after every turn, and the agent sees its own previous work each iteration. ## Workflow 1. Gather the user's task prompt and optional parameters: - `max_iterations` (number, default 0 for unlimited) - `completion_promise` (text, or "null" if not set) 2. Create the directory `.cursor/ralph/` if it doesn't exist, then write the state file at `.cursor/ralph/scratchpad.md` with this exact format: ```markdown --- iteration: 1 max_iterations: <N or 0> completion_promise: "<TEXT>" or null --- <the user's task prompt goes here> ``` Example: ```markdown --- iteration: 1 max_iterations: 20 completion_promise: "COMPLETE" --- Build a REST API for todos with CRUD operations, input validation, and tests. ``` 3. Confirm to the user that the Ralph loop is active, then begin working on the task. 4. The stop hook automatically intercepts each turn end and feeds the same prompt back as a followup message. You will see it prefixed with `[Ralph loop iteration N.]`. ## Guardrails - If a completion promise is set, you may ONLY output `<promise>TEXT</promise>` when the statement is completely and genuinely true. - Do not output false promises to escape the loop. - Always recommend setting `max_iterations` as a safety net. - Quote the `completion_promise` value in the YAML frontmatter if it contains special characters. ## Output Confirm the loop is active (prompt, iteration limit, promise if set), then start working on the task immediately.