agentleFS
drinkspillerdrinkspiller/skills/ralph_loop/SKILL.md

ralph_loop

Skill1 starsChanged 5 days agoUnlicenseView on GitHub

Implements the Ralph Wiggum technique for iterative, self-referential AI development loops in Gemini. Named after Ralph Wiggum from The Simpsons, embodying the philosophy of persistent iteration despite setbacks. Not good for: A <promise>PHRASE</promise> tag that signals genuine completion. The agent MUST NOT output this until the statement is completely and unequivocally TRUE. Safety limit to prevent infinite loops on impossible tasks. Use the /ralph_loop workflow: Or invoke directly: The loop state is tracked in .ralph-loop-state.json: Delete the state file or…

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    MUST NOT output this until the statement is completely and unequivocally TRUE.

    line 45
  2. Very specific:

    Use the /ralph_loop workflow:

    line 55
  3. Very specific:

    Delete the state file or use /cancel_ralph:

    line 93
  4. Distinctive:

    Always set max iterations as a safety net:

    line 148
  5. Distinctive:

    When running a Ralph loop, follow this pattern each iteration:

    line 161
  6. Very specific:

    Read State: Check .ralph-loop-state.json for current iteration

    line 163
  7. Very specific:

    Output Promise: If genuinely complete, output <promise>PHRASE</promise>

    line 166
  8. Distinctive:

    Iterate: If not complete, increment iteration and continue

    line 168
  9. Distinctive:

    Never lie to exit: Do NOT output a false promise to escape the loop

    line 172

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- glint: disable=DevSiteLinter_g3doc --><!-- linter off -->

name: Ralph Loop description: Run iterative, self-referential AI development loops. Use when asked to "ralph loop", "iterate until done", "keep trying until tests pass", or for tasks requiring persistent iteration with clear completion criteria.

Ralph Loop

Implements the Ralph Wiggum technique for iterative, self-referential AI development loops in Gemini. Named after Ralph Wiggum from The Simpsons, embodying the philosophy of persistent iteration despite setbacks.

When to Use

Good for:

  • Well-defined tasks with clear success criteria
  • Tasks requiring iteration and refinement (e.g., getting tests to pass)
  • Greenfield projects where you can walk away
  • Tasks with automatic verification (tests, linters, builds)

Not good for:

  • Tasks requiring human judgment or design decisions
  • One-shot operations
  • Tasks with unclear success criteria
  • Production debugging (use targeted debugging instead)

Core Concepts

The Loop

while not complete:
    1. Work on task
    2. Check completion criteria
    3. If not complete, iterate with same prompt
    4. Previous work persists in files/git

Completion Promise

A <promise>PHRASE</promise> tag that signals genuine completion. The agent MUST NOT output this until the statement is completely and unequivocally TRUE.

Max Iterations

Safety limit to prevent infinite loops on impossible tasks.

Usage

Starting a Ralph Loop

Use the /ralph_loop workflow:

/ralph_loop "Build a REST API for todos. Requirements: CRUD operations, input validation, tests."

Or invoke directly:

Start a Ralph loop with:
- Task: <description>
- Completion promise: <phrase that signals done>
- Max iterations: <number>

State File

The loop state is tracked in .ralph-loop-state.json:

{
  "active": true,
  "iteration": 1,
  "max_iterations": 50,
  "completion_promise": "ALL TESTS PASSING",
  "started_at": "2026-03-18T23:00:00Z",
  "prompt": "Build a REST API..."
}

Checking Status

cat .ralph-loop-state.json | jq .

Canceling

Delete the state file or use /cancel_ralph:

rm .ralph-loop-state.json

Writing Effective Prompts

1. Clear Completion Criteria

❌ Bad: "Build a todo API and make it good."

✅ Good:

Build a REST API for todos. When complete:
- All CRUD endpoints working
- Input validation in place
- Tests passing (coverage > 80%)
- README with API docs
Output: <promise>COMPLETE</promise>

2. Incremental Goals

❌ Bad: "Create a complete e-commerce platform."

✅ Good:

Phase 1: User authentication (JWT, tests)
Phase 2: Product catalog (list/search, tests)
Phase 3: Shopping cart (add/remove, tests)
Output <promise>COMPLETE</promise> when all phases done.

3. Self-Correction

❌ Bad: "Write code for feature X."

✅ Good:

Implement feature X following TDD:
1. Write failing tests
2. Implement feature
3. Run tests
4. If any fail, debug and fix
5. Refactor if needed
6. Repeat until all green
7. Output: <promise>COMPLETE</promise>

4. Escape Hatches

Always set max iterations as a safety net:

After 15 iterations, if not complete:
- Document what's blocking progress
- List what was attempted
- Suggest alternative approaches

Implementation

Loop Execution Pattern

When running a Ralph loop, follow this pattern each iteration:

  1. Read State: Check .ralph-loop-state.json for current iteration
  2. Execute Task: Work on the prompt
  3. Check Completion: Evaluate if completion criteria are met
  4. Output Promise: If genuinely complete, output <promise>PHRASE</promise>
  5. Iterate: If not complete, increment iteration and continue

Critical Rules

  • Never lie to exit: Do NOT output a false promise to escape the loop
  • Trust the process: Even if stuck, continue iterating
  • Document progress: Each iteration should make measurable progress
  • Check files: Your previous work persists - read and build on it

Reference

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.