Fresh-context loop: pick one incomplete story from prd.json, implement it, run backpressure checks, commit, and update progress before the next iteration.
Read .ralph/prd.json and .ralph/progress.md. Resume any story marked inProgress, else pick the lowest-priority story with passes: false.
Implement exactly one user story with minimal scope. Mark it inProgress in prd.json before coding.
Run the project's test, lint, and build commands from AGENTS.md. Fix failures before committing.
Commit with a story-scoped message. Set passes: true in prd.json and append learnings to progress.md.
All stories in prd.json have passes: true
{
"stories": [
{
"id": "story-1",
"title": "Example user story",
"description": "Replace with your first atomic task",
"priority": 1,
"passes": false,
"inProgress": false
}
]
}
# Ralph progress Append one short learning per iteration. The next fresh context reads this file first. ## Iteration log
# Guardrails Signs learned from failures. The agent must read this before each story. - Run tests before every commit. - One story per iteration β no scope creep.
# Ralph Story Executor Filesystem-backed Ralph loop. Each /ralph-loop or kickoff iteration implements one story. ## Files - `.ralph/prd.json` β task list with passes/inProgress flags - `.ralph/progress.md` β iteration learnings - `.ralph/guardrails.md` β failure signs Inspired by Geoffrey Huntley's Ralph pattern and fresh-context agent 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.