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
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.
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.

Source: HumanLayer

More planning loops

loop-init, loop-audit, loop-cost CLI patterns

/ralphnew

Three starter CLI tools that turn loop design into a repeatable workflow: scaffold a loop with a goal, budget, and verify step; audit an existing loop design; and estimate cost before you run.

prompt
→ Claude
Starter CLI tools: `loop-init` scaffolds a loop (goal, budget, verify step), `loop-audit` reviews an existing loop design, `loop-cost` estimates spend before running.
planningmedium risk

Ralph the PRD backlog

The canonical Ralph loop: each iteration starts fresh, reads the PRD and guardrails, ships exactly one backlog item end-to-end, and records what it learned.

prompt
→ Claude
/loop start each iteration with fresh context: read PROMPT.md, prd.json, and .ralph/guardrails.md; pick the single highest-priority item in prd.json not marked done, implement it with tests, run the full check suite, commit and mark it done only if green; if blocked or a check fails twice the same way, append the lesson to .ralph/guardrails.md and move on; stop when every item is done or after 30 turns
planninghigh risk

Set agent continuation budget

/goalnew

Configure max turns before agent stops, preventing runaway loops and controlling execution cost.

prompt
→ Claude
/goal budget <n Set max continuation turns
planninglow risk