ralph-loop

Decompose oversized tasks into verifiable pass/fail stories for iterative execution.

2|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/thesyntaxninja/syntaxninja-dojo --skill ralph-loop-thesyntaxninja
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ralph-loop
Source: https://github.com/thesyntaxninja/syntaxninja-dojo/tree/main/skills/ralph-loop
Command: npx skills add https://github.com/thesyntaxninja/syntaxninja-dojo --skill ralph-loop-thesyntaxninja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When a task is too large to complete within a single context window, coordinating implementation, verification, and iteration across multiple stories becomes error-prone and manual. The ralph loop automates the training-loop pattern so the assistant can execute one verifiable story per iteration, persist loop state, and continue work inside the same interactive session until all stories pass.

Core Features & Use Cases

  • Automatic decomposition integration: Chains to story-decomposition and prd-generator to produce a prd.json with verifiable stories.
  • Stateful Stop-hook loop: Writes a .claude state file and uses the Stop hook to keep the session alive and enforce one-story-per-iteration execution.
  • Verification and safety rules: Runs per-story verification commands, updates progress, enforces max attempts, and self-exits on block or repeated failure.
  • Use Case: Large refactors, multi-feature pull requests, or migrations that require breaking work into independent, testable stories and iterating until all acceptance criteria pass.

Quick Start

Approve the proposed decomposition and instruct the assistant to activate the ralph loop so it can iterate through prd.json stories one by one.

Frequently Asked Questions about ralph-loop

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

FAQPage Schema
How do I break down large coding tasks that exceed a single context window?

You can break down large coding tasks by decomposing them into independent pass/fail stories for iterative implementation. This requires a prd.json with per-story acceptance criteria to execute one verifiable story per iteration inside a single interactive session.

How does the Stop hook work for autonomous iteration in coding sessions?

The Stop hook keeps an interactive session alive by writing a .claude state file and enforcing one-story-per-iteration execution. It automatically persists loop state and continues work until all stories pass their verification commands.

What do I need to set up before running verifiable iteration loops?

Running verifiable iteration loops requires a prd.json containing per-story acceptance criteria, writable .claude state files for loop state persistence, and verification commands for automated pass/fail checks during each iteration.

When should I use autonomous iteration for large refactors or migrations?

Autonomous iteration is ideal for large refactors, multi-feature pull requests, or migrations requiring independent, testable stories. It automates the training-loop pattern to execute verifiable stories and iterate until all acceptance criteria pass.

What happens when a story fails verification during an autonomous iteration loop?

When a story fails verification, the loop updates progress, enforces a maximum number of attempts, and self-exits on block or repeated failure. This prevents infinite loops while maintaining stateful execution across iterations.