Spec-first Ralph (PLAN.md-driven)

The spec-driven maturation of the Ralph loop: each fresh-context iteration reads PLAN.md, implements the highest-priority unchecked item, checks it off, and commits — so the spec file evolves alongside the codebase.

prompt
→ Claude Code
Ralph variant where the loop prompt is "read PLAN.md, pick highest-priority unchecked item, implement, check it off, commit, exit" — spec file evolves with the codebase. Guardrails: Stop when the goal is verifiably met, or stop after 15 iterations, whichever comes first. Keep changes minimal and never touch files outside the task’s scope.
claude-code

Implementation note

When to use: Ralph-style autonomous grinding where you want the plan itself to be the living artifact — a checklist the loop consumes and the team can read, edit, and reprioritize between iterations. How it works: each fresh-context iteration reads PLAN.md, picks the highest-priority unchecked item, implements it, checks it off, commits, and exits. The spec file evolves alongside the codebase: completed items accumulate as history, and anyone can insert, reorder, or annotate items to steer the next iteration without touching the loop machinery. HumanLayer describes this as the spec-driven maturation of the original Ralph. Safety: the checkbox protocol is the state rail — progress is legible in one file, and a human can pause the loop, edit PLAN.md, and resume with redirected priorities. Keep items small and independently shippable, run it on a branch, and add an iteration cap since the loop itself does not carry one. Hardened 2026-07-27: explicit stop/cap/verification guardrails appended; regraded D→A.

Source: HumanLayer ↗graded A · 95/100 — how grades work →

More planning loops

Implement feature X autonomously

Loop/ralphGitHubB

Ralph runs until it outputs DONE, implementing the feature end-to-end over up to 20 iterations.

prompt
→ Claude Code
/ralph-loop "Implement feature X. Output DONE when complete." --completion-promise "DONE" --max-iterations 20
planningmedium risk

Ship GOALS.md phases 1-13

Loop/goalGitHubB

Implement each GOALS.md phase with tests and validation, committing and pushing after stable milestones until unblocked.

prompt
→ Claude Code
/goal Complete GOALS.md phases 1-13 in order. For each phase, implement the deliverables, add/update tests, run the common validation plus that phase's Automated QA, commit after the phase passes, and push after stable milestones. Preserve unrelated user changes. Stop only if blocked by missing credentials, external service access, or an explicit product decision that cannot be safely inferred Cap the run at 20 turns.
planninghigh risk

Execute roadmap phases to completion

Loop/goalGitHubB

Work through each phase in your roadmap, verify each one, run the final audit, and stop when all phases pass.

prompt
→ Claude Code
/goal "Execute all phases of <run-root /ROADMAP.md sequentially. Read <run-root /phases/phase-N.md for each phase; do the work; run mandatory commands; print SUPERGOAL PHASE VERIFY then SUPERGOAL PHASE DONE for each phase; follow the failure-recovery protocol in <run-root /PROTOCOL.md if any criterion fails. After the last phase, run the FINAL AUDIT in <run-root /PROTOCOL.md (re-verify against <run-root /ROADMAP.md; re-run aggregated mandatory commands; spot-check criteria; on gaps, write <run-root /phases/audit-fix-<round .md and execute inline). Only after AUDIT COMPLETE, print SUPERGOAL RUN COMPLETE. Done when SUPERGOAL RUN COMPLETE appears in the transcript with one SUPERGOAL PHASE DONE per phase, AUDIT COMPLETE printed before SUPERGOAL RUN COMPLETE, and no FAILURE HANDOFF or AUDIT HANDOFF this run