ralph-loop

Loop user task prompts back into the agent for iterative refinement.

2.6k|204|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/cursor/plugins --skill ralph-loop-cursor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ralph-loop
Source: https://github.com/cursor/plugins/tree/main/ralph-loop/skills/ralph-loop
Command: npx skills add https://github.com/cursor/plugins --skill ralph-loop-cursor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Start an automated iterative development loop that refines tasks by feeding the user's prompt and the agent's prior outputs back into subsequent iterations.

Core Features & Use Cases

  • Iterative refinement: Re-feeds the prompt and previous outputs into each new turn to improve results.
  • Configurable controls: Supports max_iterations and completion_promise to manage loop duration and termination.
  • Stateful persistence: Creates .cursor/ralph/ directories and writes a scratchpad.md to track iteration state for resume and audit.

Quick Start

Start a Ralph loop by asking the agent to begin an iterative loop for your task, and optionally specify max_iterations and a completion_promise.

Frequently Asked Questions about ralph-loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate iterative self-improvement for development tasks?

Automate iterative self-improvement by looping your task prompt back into the agent after each turn, feeding previous outputs into subsequent iterations to refine results. The ralph-loop skill executes this deterministic workflow by writing a scratchpad state file to track progress for resume and audit.

How do I set up state persistence for an iterative development loop?

Set up state persistence for iterative development loops by creating a .cursor/ralph/ directory and writing a scratchpad.md state file. This scratchpad tracks iteration state automatically, enabling you to resume automated refinement loops and audit previous outputs.

Can I control the duration of an automated prompt feedback loop?

You can control prompt feedback loop duration by configuring max_iterations and a completion_promise. These guardrails enforce deterministic termination, stopping the iterative refinement process once limits are reached or the promise condition is met.

What is the best way to stop an iterative refinement loop early?

The best way to stop iterative refinement early is by defining a completion_promise when starting the loop. The ralph-loop exposes a stop hook that enforces guardrails, automatically terminating the sequence once the promise condition evaluates successfully.

Does iterative self-referential development work without external dependencies?

Iterative self-referential development works without external dependencies because the skill operates entirely within the agent environment. It creates local .cursor/ralph/ directories and manages state internally via a scratchpad.md file, requiring no external packages.

Why do I need a scratchpad file for repeated agent task refinement?

You need a scratchpad file for repeated agent task refinement to maintain state persistence across iterations. The scratchpad.md file logs each turn's output, ensuring the agent receives accurate prior context when feeding the prompt back into subsequent self-improvement cycles.