Ralph

Run the Ralph autonomous agent loop. Executes user stories from prd.json until complete. Use after /prd and /prd-json.

Simcoe-House updated 6mo ago
Claude CodeGeneric
View source ↗
---
name: ralph
description: "Run the Ralph autonomous agent loop. Executes user stories from prd.json until complete. Use after /prd and /prd-json."
---

# Ralph - Autonomous Agent Runner

Run the Ralph autonomous loop to implement user stories from `prd.json`.

## Pre-flight Checks

Before starting, verify:

1. **PRD exists**: Check `.claude/ralph/prd.json` exists
2. **Git branch**: Verify current branch matches PRD `branchName` (or create it)
3. **Progress file**: Ensure `.claude/ralph/progress.txt` exists

## Execute

Run the Ralph loop:

```bash
bash .claude/scripts/ralph.sh [max_iterations]

Default: 50 iterations

Arguments:

  • max_iterations (optional): Maximum number of iterations before stopping

What Happens

  1. Each iteration spawns a fresh Claude instance (no context rot)
  2. Claude reads the PRD, picks the next incomplete story, implements it
  3. Runs quality checks (typecheck, lint, test)
  4. Commits if checks pass, updates PRD and progress
  5. Loop continues until all stories pass or max iterations reached
  6. Completion signal: <promise>COMPLETE</promise>

Monitoring Progress

# See which stories are done
cat .claude/ralph/prd.json | jq '.userStories[] | {id, title, passes}'

# See learnings from previous iterations
cat .claude/ralph/progress.txt

# Check git history
git log --oneline -10

Canceling

To stop a running Ralph loop, use /cancel-ralph or:

kill $(cat .claude/ralph/.ralph-pid)

Workflow

/prd "feature description"    # Generate PRD
/prd-json tasks/prd-*.md      # Convert to JSON
/ralph-preflight              # (optional) Health check
/ralph                        # Run autonomous loop

Maintain Ralph?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Ralph on getagentictools](https://getagentictools.com/loops/simcoe-house-ralph-autonomous-agent-runner?ref=badge)
npx agentictools info loops/simcoe-house-ralph-autonomous-agent-runner

The second line is the CLI lookup for this page — handy in READMEs and docs.