Ralph Loop

by cursorccb5507cec15No license10K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today

Start a Ralph Loop for iterative self-referential development. Use when the user asks to run a ralph loop, start an iterative loop, or wants repeated autonomous iteration on a task until completion.

AI-generated overview

Sets up a Ralph loop that repeatedly re-feeds a task prompt to the agent until a completion promise or iteration limit is reached.

What it does
This skill instructs the agent to start a self-referential iterative development loop. It collects the user's task prompt plus optional max_iterations and completion_promise parameters, creates the .cursor/ralph/ directory, and writes a state file at .cursor/ralph/scratchpad.md with YAML frontmatter holding iteration, max_iterations and completion_promise, followed by the task prompt. The agent then confirms the loop is active and begins the task, with a stop hook feeding the same prompt back each turn as a followup message prefixed with the iteration number. It also sets guardrails on when a completion promise may be emitted.
When to use it
Use when the user asks to run a Ralph loop, start an iterative loop, or wants repeated autonomous iteration on a task until completion. It fits tasks where the agent should see its own previous work each iteration and keep going until a stated promise is genuinely met or an iteration cap is hit.
Requirements
No scripts ship with the skill; it is instructions only. It requires the ability to create directories and write files (specifically .cursor/ralph/scratchpad.md) and a stop hook that intercepts turn end and re-feeds the prompt. No packages, credentials or network access are specified.

Ralph Loop

Trigger

The user wants to start a Ralph loop. An iterative development loop where the same prompt is fed back after every turn, and the agent sees its own previous work each iteration.

Workflow

  1. Gather the user's task prompt and optional parameters:

    • max_iterations (number, default 0 for unlimited)
    • completion_promise (text, or "null" if not set)
  2. Create the directory .cursor/ralph/ if it doesn't exist, then write the state file at .cursor/ralph/scratchpad.md with this exact format:

    markdown
    ---iteration: 1max_iterations: <N or 0>completion_promise: "<TEXT>" or null---
    <the user's task prompt goes here>

    Example:

    markdown
    ---iteration: 1max_iterations: 20completion_promise: "COMPLETE"---
    Build a REST API for todos with CRUD operations, input validation, and tests.
  3. Confirm to the user that the Ralph loop is active, then begin working on the task.

  4. The stop hook automatically intercepts each turn end and feeds the same prompt back as a followup message. You will see it prefixed with [Ralph loop iteration N.].

Guardrails

  • If a completion promise is set, you may ONLY output <promise>TEXT</promise> when the statement is completely and genuinely true.
  • Do not output false promises to escape the loop.
  • Always recommend setting max_iterations as a safety net.
  • Quote the completion_promise value in the YAML frontmatter if it contains special characters.

Output

Confirm the loop is active (prompt, iteration limit, promise if set), then start working on the task immediately.

Source and attribution

Source:cursor/pluginsinralph-loop/skills/ralph-loopat commitccb5507

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal