ralph-loop

Run Claude in a loop with persistent state for iterative task execution.

47|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/belumume/claude-skills --skill ralph-loop-belumume
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ralph-loop
Source: https://github.com/belumume/claude-skills/tree/main/ralph-loop
Command: npx skills add https://github.com/belumume/claude-skills --skill ralph-loop-belumume

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables autonomous, iterative task execution by running Claude in a loop that preserves context across iterations. It helps teams tackle well-defined tasks where completion criteria can be verified programmatically, reducing manual check-ins.

Core Features & Use Cases

  • Stateful Loop Execution: Maintains a persistent state between iterations via a local state file to progress tasks without starting over.
  • Structured Activation Protocol: Provides step-by-step activation including state file creation, TODO management, and controlled iteration until completion.
  • Safe Completion: Uses explicit completion criteria (e.g., a completed TODO.md or a completion promise) to stop the loop, with safe manual interruption options.

Quick Start

  1. Create the state file at .claude/ralph-loop.local.md with frontmatter similar to the example.
  2. Create a TODO.md at the project root detailing tasks and mark completion when done.
  3. Start Claude with claude to begin autonomous looping; monitor checkpoints and progress at each iteration.

Frequently Asked Questions about ralph-loop

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

FAQPage Schema
How do I run autonomous iterative task execution with Claude while preserving context?

Autonomous iterative task execution uses a stateful loop that preserves context across iterations via a local state file, enabling Claude to progress tasks without starting over. It targets well-defined tasks with clear completion criteria like refactoring or code migrations.

What is the best way to automate batch processing tasks with Claude in a loop?

Batch processing in a loop is handled by running Claude with a persistent local state file and a TODO.md file. This structured activation protocol maintains state between iterations, reducing manual check-ins until the batch task is verified complete.

How do I configure state management for an autonomous Claude task loop?

State management is configured by creating a frontmatter-driven state file at .claude/ralph-loop.local.md. This file preserves context across iterations, allowing the autonomous loop to resume task progress reliably without manual state tracking.

How does the loop know when to stop autonomous task execution?

The loop terminates safely using explicit completion criteria, specifically a completed TODO.md file or a defined completion promise. These signals ensure the autonomous iteration stops precisely when the task's completion criteria are met.

Can I use this autonomous loop for code migrations and refactoring tasks?

Code migrations and refactoring are ideal use cases for this autonomous loop because they are well-defined tasks with verifiable completion criteria. The persistent state file ensures progress is maintained across iterations without restarting the migration.

How do I manually interrupt an autonomous task loop if something goes wrong?

The autonomous loop provides safe manual interruption options alongside its explicit completion signals. You can monitor checkpoints and progress at each iteration, allowing you to manually stop the loop if the task deviates from expected behavior.