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:
1. Create a feature branch defined in the PRD 2. Select the highest-priority story with `passes: false` 3. Implement the story using an AI coding tool 4. Run type checks and tests 5. Commit on success 6. Mark the story as passing in `prd.json` 7. 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:
```bash scripts/ralph/ralph.sh ```
Usage examples:
```bash # 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:
1. Generate a markdown PRD using the `prd` skill 2. Convert it into a machine-readable **`prd.json`** 3. 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.