TL;DR

Ralph Wiggum is an official Claude Code plugin that turns one prompt into a persistent loop: a Stop hook blocks the agent from exiting and feeds the same prompt back until the task is actually finished.

Summary

The failure mode it targets is the agent that declares victory too early. Ralph Wiggum installs a Stop hook that fires when Claude Code tries to end its turn; instead of exiting, the hook re-injects the original prompt, so the next iteration starts with the previous iteration’s edited files still on disk. Progress therefore accumulates across passes rather than restarting. The loop is bounded from two sides: a max iteration count and a completion promise — a literal string the agent may only emit when the work is genuinely done. The author frames the useful cases as legacy refactors, chasing test coverage and greenfield builds, and stresses the two costs: unbounded loops burn tokens, and a loop with a weak completion signal will happily keep “fixing” working code.

Key takeaways

  1. The mechanism is a Stop hook, not a prompt trick: it intercepts the exit and replays the prompt.
  2. Give the loop a completion promise the agent must print only when done, plus a hard iteration cap — one without the other is not a control.
  3. Persistence comes free from the filesystem: each pass reads the state the previous pass wrote, so a loop is only as good as its tests.
  4. Scope the task so success is mechanically checkable (tests pass, linter clean); a subjective goal turns the loop into an expensive opinion generator.

Tools and concepts

ItemRole in the page
ClaudeClaude Code, the harness the plugin extends
Agent SkillsAdjacent mechanism for packaging repeatable agent behaviour
AI AgentsBroader topic of autonomous loops
Stop hookThe Claude Code extension point used to block exit
HermesAlternative harness with its own loop and delegation behaviour

When to use

  1. When an agent repeatedly stops halfway through a mechanical refactor.
  2. When designing a bounded autonomous loop and you need a concrete completion-signal pattern.
  3. When test coverage or a lint gate can decide success objectively.

Caveats

  • Blog explainer, not documentation: the exact plugin name and flags should be checked against the Claude Code docs before use.
  • Persisted on Medium, so the full text depends on the author’s account; the argument is thin on cost numbers.
  • Nothing here stops an agent from looping on a broken test forever — the cap is the only guard.

Related: Claude AI Agents Agent Skills Hermes Prompt Engineering