ralph-loop

A command that starts an iterative development loop for a coding task, with Codex review gates. It can limit work iterations and review cycles, disable reviews, or enable debug logging.

In plain words
What is it for?
Use it to run tasks such as building an API or fixing a bug, with optional limits and review behavior.
Why use it?
It keeps an agent working through a task while checking claimed completion and continuing after rejected reviews.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/alleneubank/claude-code/ralph-loop
Clone the repo
git clone --depth 1 https://github.com/alleneubank/claude-code
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 763 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00007 $0.00763
Opus 5 $0.00003 $0.00381
Sonnet 5 $0.00001 $0.00153
Haiku 4.5 $0.00001 $0.00076

Measured 2d ago against content hash 14fcbb315a7c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

ralph-loop scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf /tmp/rl-build &&
plugins/ralph-reviewed/commands/ralph-loop.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Start Ralph Reviewed Loop

Initialize an iterative development loop with Codex review gates.

Parse Arguments

Arguments: $ARGUMENTS

Parse the following from arguments:

  • PROMPT: Everything before the first -- flag (the task description)
  • --max-iterations: Number (default: 30)
  • --max-reviews: Number (optional, defaults to --max-iterations if not specified)
  • --no-review: Boolean flag (default: false)
  • --debug: Boolean flag (default: false)

Setup

  1. Ensure the rl CLI is installed. If not on PATH, build from source:

    command -v rl >/dev/null 2>&1 || (
      echo "Installing rl CLI..." &&
      git clone https://github.com/0xbigboss/rl /tmp/rl-build 2>/dev/null &&
      cd /tmp/rl-build &&
      bun install --frozen-lockfile &&
      mkdir -p ~/.local/bin &&
      bun build src/cli.ts --compile --outfile ~/.local/bin/rl &&
      rm -rf /tmp/rl-build &&
      echo "rl installed to ~/.local/bin/rl"
    )
    

    Verify it's available:

    rl --version
    
  2. Initialize the loop (creates .rl/ with state.json, prompt.md, and .rl/rl wrapper):

    rl init "{PROMPT}" --max-iterations {MAX_ITERATIONS} --max-reviews {MAX_REVIEWS} {--no-review if set} {--debug if set}
    
  3. Verify setup:

    .rl/rl status
    

All subsequent rl calls use .rl/rl (wrapper created by init).

Completion and Escape

  • Done: run .rl/rl done — triggers Codex review on next stop.
  • Blocked: run .rl/rl done --blocked — terminates without review.

Working Guidelines

Pacing. Each iteration should produce thoughtful work. Researching, loading skills, and studying patterns IS productive — don't rush to .rl/rl done.

Churn breaker. If a reviewer flags the same area twice, your next iteration must be research — load skills, read docs, study the codebase. No code fix until you understand why the previous fix was wrong.

Depth before breadth. Complete each phase fully before starting the next.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 80 lines · 0 tokens per session scan C 14fcbb315a7c

Subscribe to this mod's changes

ralph-loop is a command published in the GitHub repository alleneubank/claude-code (52 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 7 tokens to every session and 763 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.