ralph-loop — autonomous task loop ralph-loop, Personal-AI-Employee, community, autonomous task loop, ide skills, install ralph-loop, ralph-loop documentation, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Autonomous Agents like Claude, needing advanced task management capabilities with defined completion states. ralph-loop is an autonomous task loop that keeps Claude working on a task until it reaches a defined completion state.

Features

Creates a loop state file with task prompt and completion criteria
Iterates through tasks using Claude
Checks task completion using the Stop hook
Re-injects prompts for incomplete tasks up to max iterations
Allows Claude to exit when task is complete or max iterations are reached

# Core Topics

Gen-AI4 Gen-AI4
[0]
[0]
Updated: 2/25/2026

Agent Capability Analysis

The ralph-loop skill by Gen-AI4 is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for autonomous task loop, install ralph-loop, ralph-loop documentation.

Ideal Agent Persona

Perfect for Autonomous Agents like Claude, needing advanced task management capabilities with defined completion states.

Core Value

Empowers agents to work autonomously on tasks until reaching a defined completion state, utilizing loop state files and iterative prompting with protocols like Stop hooks and max iterations criteria.

Capabilities Granted for ralph-loop

Automating task completion with iterative prompting
Managing tasks with defined completion criteria
Enhancing agent productivity with autonomous loop management

! Prerequisites & Limits

  • Requires loop state file creation
  • Dependent on max iterations setting
  • Limited to Claude or similar agent architectures
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

ralph-loop

Install ralph-loop, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Ralph Wiggum Autonomous Task Loop

Keep Claude working on a task autonomously until it reaches a defined completion state.

How It Works

  1. Start: Create a loop state file with the task prompt and completion criteria
  2. Iterate: Claude works on the task
  3. Check: At exit, the Stop hook checks if the task is complete
  4. Continue: If not complete, the prompt is re-injected (up to max iterations)
  5. Done: When complete (or max iterations hit), Claude is allowed to exit

Two Completion Strategies

Strategy 1: Promise-Based (Simple)

Claude outputs <promise>TASK_COMPLETE</promise> in its response to signal completion.

Example task prompt:
"Process all files in /Needs_Action.
When all items are processed and moved to /Done, output: <promise>TASK_COMPLETE</promise>"

Strategy 2: File-Movement-Based (Gold Tier)

The Stop hook watches for a specific task file to move to /Done. More reliable because completion is a natural part of the workflow.

Example: Start a loop watching for "TASK_20260223_inbox_sweep" in /Done
When the file appears in /Done, the loop exits naturally.

Usage

Start a Ralph Loop (Promise Strategy)

python
1from ralph_loop import RalphLoop 2 3loop = RalphLoop(vault_path="./vault") 4state = loop.start( 5 prompt="Process all pending items in /Needs_Action. " 6 "For each item, create a plan and move to /Done. " 7 "When ALL items are processed, output: <promise>TASK_COMPLETE</promise>", 8 completion_promise="TASK_COMPLETE", 9 max_iterations=10, 10) 11print(f"Loop started: {state.task_id}")

Start a Ralph Loop (File Movement Strategy)

python
1from ralph_loop import RalphLoop 2 3loop = RalphLoop(vault_path="./vault") 4state = loop.start( 5 prompt="Generate this week's CEO briefing and save to vault/Briefings/. " 6 "Move the trigger file to /Done when complete.", 7 completion_file="TASK_briefing_trigger.md", 8 max_iterations=5, 9)

Check Active Loops

python
1from ralph_loop import RalphLoop 2 3loop = RalphLoop(vault_path="./vault") 4active = loop.get_active_loops() 5for state in active: 6 print(f"Loop {state.task_id}: iteration {state.current_iteration}/{state.max_iterations}")

Stop Hook Configuration

To use the Ralph Wiggum loop, configure the Stop hook in Claude Code settings. The stop hook script at src/ralph_loop.py is called when Claude attempts to exit:

bash
1# In Claude Code settings (settings.json or CLAUDE.md): 2# Add stop hook: 3# python src/ralph_loop.py ./vault

The hook:

  • Reads Claude's output from stdin
  • Checks for completion promise OR looks for completion file in /Done
  • Returns exit code 0 (allow exit) or 1 (block and re-inject prompt)

Security Notes

  • Max iterations prevent infinite loops (default: 10)
  • All loop state stored in vault/Logs/ralph_*.json — visible audit trail
  • Loop state files are deleted when loops complete
  • Never loops on destructive operations without human approval first

Example: Complete Inbox Processing Loop

/ralph-loop "Process all items in vault/Needs_Action in priority order (high → medium → low).
For each item:
1. Read the item's frontmatter
2. Create a Plan.md in vault/Plans/
3. If approval needed, create approval request in vault/Pending_Approval/
4. Otherwise, process and move to vault/Done/
When ALL items in vault/Needs_Action have been moved to vault/Done,
output: <promise>TASK_COMPLETE</promise>"
--max-iterations 15

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is ralph-loop?

Perfect for Autonomous Agents like Claude, needing advanced task management capabilities with defined completion states. ralph-loop is an autonomous task loop that keeps Claude working on a task until it reaches a defined completion state.

How do I install ralph-loop?

Run the command: npx killer-skills add Gen-AI4/Personal-AI-Employee/ralph-loop. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for ralph-loop?

Key use cases include: Automating task completion with iterative prompting, Managing tasks with defined completion criteria, Enhancing agent productivity with autonomous loop management.

Which IDEs are compatible with ralph-loop?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for ralph-loop?

Requires loop state file creation. Dependent on max iterations setting. Limited to Claude or similar agent architectures.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add Gen-AI4/Personal-AI-Employee/ralph-loop. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use ralph-loop immediately in the current project.

Related Skills

Looking for an alternative to ralph-loop or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI