agentleFS
RiyanKothariRiyanKothari/riyans-claude-skills/skills/ralph-loop/SKILL.md

ralph-loop

Skill1 starsChanged 37 days agoMITView on GitHub

Run a bounded self-correcting loop that re-feeds the same prompt every time Claude stops, until a completion promise is genuinely true or an iteration cap is reached. Use when a task has a machine-checkable finish line such as a passing test suite or a clean linter, and iterating unattended beats steering each step by hand.

26 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use to-issues and review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    to-issues

    Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 1

    Distinctive

    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. Very specific:

    When invoked as /ralph-loop <task>, start the loop with the task and continue working on it in the same turn:

    line 18
  2. Very specific:

    Use single quotes, so the shell leaves $ and backticks in the prompt alone.

    line 28
  3. Very specific:

    Check it with rcskills loop status and stop it with rcskills loop cancel.

    line 30
  4. Very specific:

    Every iteration re-reads the whole context, so a loop multiplies whatever the session already costs.

    line 54
  5. Distinctive:

    Only the session that started a loop is ever blocked by it.

    line 60

“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “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

Ralph Loop

The Ralph technique (Geoffrey Huntley) is a loop around one prompt. You work, try to stop, and get the same prompt back. Your earlier work is still there in the files and git history, so each pass picks up where the last one left off.

This is an independent Node implementation. It needs no jq or perl, so it runs under Git Bash on Windows, and it requires the standard or strict profile, which wires its Stop hook.

Start

When invoked as /ralph-loop <task>, start the loop with the task and continue working on it in the same turn:

rcskills loop start 'Make npm test pass with no skipped tests' --completion-promise 'ALL TESTS PASS' --max-iterations 15
  • --max-iterations defaults to 10 and is capped at 100. There is no unlimited mode.
  • --completion-promise is the exact phrase that ends the loop. Without one, the loop runs to the cap.
  • Use single quotes, so the shell leaves $ and backticks in the prompt alone.

Check it with rcskills loop status and stop it with rcskills loop cancel.

The promise rule

End the loop only by writing <promise>PHRASE</promise> in your own reply, and only when that statement is completely true and verified by output you actually saw. Do not write the tag to explain, plan or quote it — a written tag counts. If you are stuck, say so plainly and let the cap end the loop; a false promise is a lie told to escape, and it ships broken work as finished.

Write prompts that can finish

A loop is only as good as its finish line.

  • Name a check a command can prove: tests pass, tsc is clean, the linter reports 0.
  • Break large goals into phases the prompt lists in order.
  • Say what to do when blocked: record what was tried and what is in the way.

Good fits: getting a suite green, clearing lint or type errors, working through a mechanical migration. Bad fits: design decisions, anything needing human judgment, production incidents, tasks with no objective check.

Cost

Every iteration re-reads the whole context, so a loop multiplies whatever the session already costs. Keep caps small, prefer a fresh session for a long loop, and expect the [next] compaction line to appear sooner than usual.

Guarantees

  • Only the session that started a loop is ever blocked by it.
  • State lives in ~/.claude/token-harness/loops/, never in the project.
  • Unreadable state ends the loop rather than trapping the session.

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.