Guardrails Learning Loop
When a check fails twice the same way, append a guardrail sign to .ralph/guardrails.md so the next iteration avoids repeating it.
5 copies · 0 installs · 13 views
by loops!
Use loop copies the kickoff. Share copies the loop link. Open in Cursor / Claude Code only pre-fill that prompt — they do not install hook files. Click Install files, extract the zip into your repo, then restart your agent. Full install guide
- Do not modify the check command or exit criteria to force success
- Do not skip, disable, or bypass checks to pass the exit condition
- If stuck after several iterations, stop and report blockers instead of gaming metrics
Two separate pieces
- Kickoff prompt — tells the agent the goal, check command, exit condition, and how to self-pace between passes.
- Install files — optional hooks under
.cursor/or.claude/that fire on events (save, commit, etc.). You must download and extract these into your repo.
- 1
Download and extract install files
Click Install files on this loop, unzip, and merge into your project root so paths like
.ralph/guardrails.mdexist on disk.Restart Cursor or reload the Claude Code session so hooks are picked up. Until then, nothing is “installed” — the browser cannot write into your repo.
- 2
Copy or open the kickoff prompt
Use Use loop to copy the kickoff, or Open in Cursor / Open in Claude Code to pre-fill the prompt in that app. Those links only carry text, not hook files.
- 3
Paste and let the agent self-pace
Paste the kickoff into agent chat. The agent should run your check command between iterations and stop when the exit condition passes.
Full guide with Cursor /loop notes: How to install loops
1. Read guardrails
Read .ralph/guardrails.md before any work. Treat each sign as a hard constraint.
2. Run checks
Run the project's backpressure commands.
npm test && npm run lint
3. Record failure sign
If the same error occurred before, append a concise sign to guardrails.md: what failed and how to avoid it.
4. Fix with guardrails
Apply a fix that respects all guardrail signs. Do not repeat prior failed approaches.
Start the "Guardrails Learning Loop" loop. Goal: tests and lint pass without repeating prior failure patterns Max iterations: 12 Between iterations run: npm test && npm run lint Exit when: all checks pass Step 1: Read .ralph/guardrails.md, run checks, and if a failure repeats, add a sign before fixing. Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.
Related loops
Start the "Ralph Story Executor" loop. Goal: every story in .ralph/prd.json has passes: true Max iterations: 20 Between iterations run: npm test && npm run lint && npm run build Exit when: no stories remain with passes: false (respond "ALL STORIES ARE COMPLETE") Step 1: Read .ralph/prd.json and .ralph/progress.md. Pick one incomplete story, implement it, run backpressure checks, commit, update prd.json and progress.md, then stop this iteration. Self-pace this loop. Each iteration does exactly one story. State lives on disk, not in chat history.