Skip to content
Skills Library
AI & agents · Automation

harness-ralph-loop

/harness-ralph-loop

Runs iterate-until-pass loops with ralph-worker agents in a worktree. Use when running [ralph]-marked tasks or looping until verify passes.

Licence
MIT
Last repository change
05.08.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Runs iterate-until-pass loops with ralph-worker agents in a worktree. Use when running [ralph]-marked tasks or looping until verify passes.

Arguments

/harness-ralph-loop [task-id|help|--max-iter N|--verify CMD]
Original author description

Runs iterate-until-pass loops with ralph-worker agents in a worktree. Use when running [ralph]-marked tasks or looping until verify passes.

How it works

  1. Quick Reference
  2. Execution Flow
  3. Help Subcommand
  4. When to Use Ralph
  5. Reference Files
  6. Related Skills and Agents
Original SKILL.md headings · 60 lines, 432 words
SKILL.md preview
---
name: harness-ralph-loop
description: "Runs iterate-until-pass loops with ralph-worker agents in a worktree. Use when running [ralph]-marked tasks or looping until verify passes."
when_to_use: "ralph task, loop until pass, iterate until tests pass, ralph mode, run ralph loop, [ralph] task"
allowed-tools: ["Read", "Write", "Edit", "Bash", "Task", "Skill"]
argument-hint: "[task-id|help|--max-iter N|--verify CMD]"
model: sonnet
effort: high
user-invocable: false
---

# Harness Ralph Loop

Iterative-loop orchestrator for `[ralph]`-marked Plans.md tasks.
Spawns a fresh `harness:ralph-worker` subagent per attempt inside a single persistent worktree,
runs the Verify command authoritatively, and loops until both the `<promise>` text tag and verify exit 0 agree.

## Quick Reference

| Subcommand / Argument | Behavior |
|---|---|
| `help` | Print usage, philosophy, and link to prompt-best-practices.md |
| `<task-id>` | Run the loop for a Plans.md task that has `[ralph]` marker |
| `--max-iter N` | Override MaxIter (default: 10) |
| `--verify CMD` | Override the Verify command from the task |

## Execution Flow

See [`references/loop-flow.md`](${CLAUDE_SKILL_DIR}/references/loop-flow.md) for the complete orchestrator pseudocode.

Summary: On iteration 0 the orchestrator spawns a `ralph-worker` with `isolation="worktree"` to create the persistent worktree, capturing `RALPH_WORKTREE` from `result.worktreePath`. For iterations 1..N it fetches the `EnterWorktree` deferred-tool schema via `ToolSearch`, calls `EnterWorktree(path=RALPH_WORKTREE)`, then spawns the next worker without the isolation param. After each iteration the orchestrator runs the Verify command itself (anti-tamper), compares the exit code against `ralph-worker-report.v1.verify.exit_code`, scans the final assistant message for `<promise>…</promise>`, and diffs the worktree to detect stuck iterations. The loop terminates on success or on any of the three hard-stop failure modes (FT-RALPH-01 STUCK, FT-RALPH-02 VERIFY-MISMATCH, FT-RALPH-03 MAX-ITER).

## Help Subcommand

Running `harness-ralph-loop help` prints the following:

1. **Overview** — harness-ralph-loop is an iterative-loop orchestrator that spawns a fresh
   `ralph-worker` subagent per attempt inside a single persistent worktree, runs the Verify
   command authoritatively, and loops until both the `<promise>` text tag and verify exit 0 agree.

2. **Philosophy bullets:**
   - **Iteration > Perfection** — let the loop refine; don't aim for perfect on the first try
   - **Failures Are Data** — deterministically bad means tunable; each failure leaves context
   - **Operator Skill Matters** — prompt quality is the primary lever, not model strength
   - **Persistence Wins** — keep trying; the loop handles retry logic automatically

3. **Prompt guidance pointer:**
   For full prompt-writing guidance see [`prompt-best-practices.md`](${CLAUDE_SKILL_DIR}/references/prompt-best-practices.md)

4. **Task-pattern fit pointer:**
   For task-pattern fit see [`when-to-ralph.md`](${CLAUDE_SKILL_DIR}/references/when-to-ralph.md)

## When to Use Ralph

See [`references/when-to-ralph.md`](${CLAUDE_SKILL_DIR}/references/when-to-ralph.md) for guidance on which tasks are Ralph-suitable and which are not.

## Reference Files

| File | Purpose |
|------|---------|
| [`references/loop-flow.md`](${CLAUDE_SKILL_DIR}/references/loop-flow.md) | Full orchestrator pseudocode, prompt template, decision matrix, terminal-state handling |
| [`references/when-to-ralph.md`](${CLAUDE_SKILL_DIR}/references/when-to-ralph.md) | When to use Ralph (task patterns, DoD quality checks) |
| [`references/prompt-best-practices.md`](${CLAUDE_SKILL_DIR}/references/prompt-best-practices.md) | Prompt writing best practices (A1–A4), philosophy bullets, learn-more links |

## Related Skills and Agents

- `harness-plan` — Emits `[ralph]` marker + `Verify:` line for suitable tasks
- `harness-work` — Detects `[ralph]` marker and routes to this skill
- `harness:ralph-worker` — The per-iteration worker agent this skill dispatches
Files in this package (4)
  • SKILL.md 4 KB
  • references/loop-flow.md 11 KB
  • references/prompt-best-practices.md 7 KB
  • references/when-to-ralph.md 6 KB

Versions

The database has no other skills named harness-ralph-loop.

Database snapshot: 13.11.2026 · package version 15a61280899c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100ralph-new
    Set up a new ralph loop (ralph-harness) on a repository. Asks the user how it should run (where the work lands, auto-merge of its pull request, the verify gate, the reviewer, when it stops, model, plan mode, hours, notifications) and what every result must pass or never include…
  • 95ralph-loop-init
    Transform approved plans into ralph loop infrastructure. Triggers on: '/ralph-loop-init', '/ralph-init', 'setup ralph loop', 'generate ralph loop'. Creates .ralph/ directory with prd.json, loop.py, CLAUDE.md, and supporting files.
  • 100flux-ralph-init
    Scaffold repo-local Ralph autonomous harness under scripts/ralph/. Use when user runs /flux:ralph-init.
  • 100ralph-expert
    Build and launch well-structured Ralph Loop commands from a user's task description. Use when the user says "ralph this", "loop this until done", "set up a ralph", "run this iteratively", invokes `/ralph-expert`, or hands over a vague goal that needs to become an iterative loop…
  • 90ralph-loop
    Run, monitor, resume, merge, and debug Ralph loops. Use this skill whenever the user asks to operate `ralph run` or `ralph loops`, inspect loop state, recover suspended loops, analyze diagnostics, or unblock merge queue issues.
  • 100ralph
    This skill should be used when the user wants to set up an autonomous coding loop, plan a Ralph loop, prepare for headless Claude execution, create a spec and implementation plan for autonomous coding, or run an autonomous development workflow. Trigger phrases include "ralph",…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.