Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ralph-loop

БесплатноЗапускает вложенные скриптыНе проверен

Autonomous iteration loop with dual-mode support. Standalone mode uses Stop hooks (RALPH_ACTIVE=1). Multi-agent mode uses router-managed iteration. Never…

oimiragieoот oimiragieo★ 48 звёзд на GitHub

Об этом скилле

Ralph Loop

Autonomous iteration loop for Claude Code with dual-mode support. Named after the Ralph Wiggum technique popularized in the Claude Code community (Dec 2025 - Feb 2026).

Purpose

Enable Claude Code to work autonomously on well-defined tasks until genuine completion, without manual re-prompting. The skill provides:

  1. Dual-mode architecture — Standalone mode (Stop hook) or multi-agent mode (router-managed iteration)
  2. RALPH_ACTIVE env var guard — Stop hook only activates when RALPH_ACTIVE=1 is set, preventing host/router trapping
  3. State persistence — JSON state file tracks iteration count, timestamps, findings
  4. Circuit breaker — Detects repeated failures and exits gracefully
  5. Verification-first exit — Completion signal only accepted when validation commands pass
  6. Guardrails — Accumulated lessons from past failures prevent repeated mistakes

When to Use

  • Well-defined tasks with clear, testable success criteria
  • Iterative work (get tests passing, fix lint errors, audit codebase)
  • Overnight or background autonomous runs
  • Multi-phase audits with structured findings logs

When NOT to Use

  • Subjective goals ("make the code better")
  • One-off fixes that don't need iteration
  • Tasks requiring human judgment at each step
  • Exploratory research without clear deliverables

Architecture — Two Modes

Mode 1: Standalone (Stop Hook)

For single-session use. The Stop hook keeps the session alive until completion. Requires RALPH_ACTIVE=1 env var (set by the launcher scripts).

User runs ralph-audit.sh/bat (sets RALPH_ACTIVE=1)
    |
    v
Claude works on task (reads PROMPT.md)
    |
    v
Claude attempts to exit
    |
    v
Stop hook intercepts (ralph-stop-hook.cjs)
    |
    +-- RALPH_ACTIVE != '1'? --> YES --> exit(0) immediately (no-op)
    |
    +-- Completion signal found? --> YES --> Clear state, exit(0)
    |
    +-- Max iterations reached? --> YES --> Clear state, exit(0)
    |
    +-- NO --> Increment iteration, save state, re-inject prompt, block exit

Mode 2: Router-Managed (Multi-Agent) -- Primary mode for agent-studio

This is the primary mode within agent-studio. The router manages iteration by spawning and re-spawning QA agents via Task(). No Stop hook is involved -- the router itself controls the loop lifecycle. The state file at .claude/context/runtime/ralph-state.json within agent-studio tracks iteration progress.

Router receives /ralph-loop command
    |
    v
Router spawns QA agent with audit prompt via Task()
    |
    v
QA agent completes, reports findings via TaskUpdate()
    |
    v
Router checks audit state file (.claude/context/runtime/ralph-state.json)
    |
    +-- RALPH_AUDIT_COMPLETE_NO_FINDINGS? --> Done
    |
    +-- RALPH_ITERATION_COMPLETE? --> Spawn another QA agent
    |
    +-- Max iterations? --> Report and stop

Why two modes: Stop hooks fire on the host session, not on subagents. In multi-agent setups (like agent-studio), the Stop hook would trap the router. The RALPH_ACTIVE guard ensures the hook is a no-op unless explicitly activated by a standalone launcher. In agent-studio, Mode 2 is used exclusively -- the router orchestrates iteration without any Stop hook registration.

Components

Skill Bundle (included in this skill directory)

File Relative Path Purpose
Main script scripts/main.cjs CLI for status/reset/config of ralph loop state
Pre-execute hook hooks/pre-execute.cjs Input validation before skill execution
Post-execute hook hooks/post-execute.cjs Output validation after skill execution
Input schema schemas/input.schema.json Input validation schema
Output schema schemas/output.schema.json Output contract schema
Implementation template templates/implementation-template.md PROMPT.md and launcher templates
Skill rule rules/ralph-loop.md Skill-specific rules

Project-Level Files (set up per-project by the user)

These files are NOT part of the skill bundle. They live in the hosting project's .claude/ directory and must be created/configured by the user or via the implementation template.

File Project Path Purpose
Stop hook .claude/hooks/ralph-stop-hook.cjs Loop controller (stdin -> transcript check
Полный SKILL.md на GitHub

Установить ralph-loop в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash
Glob
Grep

Вложенные файлы

commands/ralph-loop.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/ralph-loop.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

Что делает скилл ralph-loop?

Autonomous iteration loop with dual-mode support. Standalone mode uses Stop hooks (RALPH_ACTIVE=1). Multi-agent mode uses router-managed iteration. Never traps the host/router session.

Как установить скилл ralph-loop?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ralph-loop запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить ralph-loop с