The open-source project Ralph takes a pragmatic approach to autonomous AI coding: treat AI agents as disposable and use git as the system of record.
Ralph repeatedly drives AI coding tools to implement user stories from a PRD until all quality checks pass. Each iteration runs in a fresh AI instance, with progress preserved only through git commits, a structured prd.json, and an append-only progress.txt. The result is an incremental, auditable workflow that feels closer to traditional software development—just automated.
How the loop works
Ralph is orchestrated by a shell script that resumes purely from repository state:
- Create a feature branch defined in the PRD
- Select the highest-priority story with
passes: false - Implement the story using an AI coding tool
- Run type checks and tests
- Commit on success
- Mark the story as passing in
prd.json - Append learnings to
progress.txt
The loop continues until all stories pass or a maximum iteration count is reached.
Because no AI context is reused, failures are visible and debuggable—nothing is hidden in agent memory.
Tooling and setup
Ralph currently supports two AI coding backends:
- Amp CLI — https://ampcode.com (default)
- Claude Code — https://docs.anthropic.com/en/docs/claude-code
The main runner lives at:
scripts/ralph/ralph.sh
Usage examples:
# Amp (default)
./scripts/ralph/ralph.sh [max_iterations]
# Claude Code
./scripts/ralph/ralph.sh --tool claude [max_iterations]
From PRD to executable plan
The workflow starts with planning:
- Generate a markdown PRD using the
prdskill - Convert it into a machine-readable
prd.json - Let Ralph execute each story, one at a time
Stories are intentionally small and right-sized, ensuring each fits within a single AI context window.
Why stateless agents matter
A core design choice is that every iteration starts with a brand-new AI instance. Anything worth remembering must be written down—in code, tests, progress.txt, or the auto-updated AGENTS.md.
That constraint makes runs predictable, debuggable, and easy to audit, while preventing subtle failures from compounding across iterations.