Skip to content
Claudekit.ai

Ralph Loop Plugin: Run Claude Code in a Self-Repeating Loop

ralph-loop is Anthropic's plugin for the Ralph Wiggum technique: a Stop hook re-feeds one prompt so Claude keeps iterating until a completion promise appears.

By Claudekit Team Published 1 min read

Type
Plugin
Pricing
Open Source
Repository
github.com
Website
github.com

ralph-loop is an Anthropic plugin that implements the Ralph Wiggum technique in Claude Code. You give it one prompt, and a Stop hook blocks Claude from exiting and feeds the same prompt back, so Claude keeps improving its own work in files until it outputs a completion phrase or hits an iteration limit.

Checked 24 Oct 2026 against the plugin’s README, hooks.json and marketplace.json.

Who it is for

Developers with well-defined tasks that have automatic verification, such as getting a test suite to pass, who are happy to let Claude iterate unattended.

Install

/plugin install ralph-loop@claude-plugins-official

Start a loop:

/ralph-loop "Build a REST API for todos. Requirements: CRUD operations, input validation, tests. Output <promise>COMPLETE</promise> when done." --completion-promise "COMPLETE" --max-iterations 50

Stop it early with /cancel-ralph.

What it does

  • Registers a Stop hook that intercepts Claude’s exit and re-sends your original prompt.
  • The prompt never changes; progress lives in your files and git history, which Claude reads on each pass.
  • --completion-promise ends the loop on an exact string match.
  • --max-iterations caps the number of passes.

Use cases

  • Drive a feature to green tests with a TDD-style prompt.
  • Greenfield prototypes you can leave running.
  • Phased tasks where each phase has a clear, checkable outcome.

Pros

  • No external scripts; it runs inside your session.
  • Simple mental model: one prompt, repeated.
  • Works well when tests or linters can judge success.

Cons and caveats

  • Unlimited by default. The README recommends always setting --max-iterations as your main safety net.
  • The completion promise is a single exact string, so you cannot signal different outcomes like success versus blocked.
  • Long loops consume a lot of usage.

Frequently asked questions

How does the loop stop?

When Claude outputs the exact --completion-promise text, when it reaches --max-iterations, or when you run /cancel-ralph. Without --max-iterations the default is unlimited.

Does it run outside my session?

No. The loop happens inside your current Claude Code session through a Stop hook, so you do not need an external bash loop.

Does it work on Windows?

The stop hook is a bash script that needs Git for Windows. The README documents a workaround when bash resolves to WSL instead of Git Bash.

When is it a bad fit?

Tasks needing human judgment or design decisions, one-shot operations, unclear success criteria and production debugging.

Get the weekly Claude digest

New skills, MCP servers, prompts and Claude updates — one short email a week. No spam, unsubscribe anytime.

The newsletter is launching soon. Follow the RSS feed in the meantime.