A simple starter repo demonstrating how Ralph works - an autonomous coding loop that builds software from some specs.
Ralph operates on three core files:
| File | Purpose |
|---|---|
prd.json |
The Goal - A JSON file containing user stories with acceptance criteria. This represents how you want the world to look like. |
progress.txt |
The Current State - A log of what has been implemented, patterns discovered, and learnings. This represents how the world currently is. |
prompt.md |
The Transformer - Instructions that tell the agent how to pick up the next task, implement it, and update progress. |
Each iteration, Ralph:
- Reads the PRD to understand the goal
- Reads progress to understand current state
- Picks the highest priority unfinished story
- Implements it, runs tests
- Updates
prd.json(markspasses: true) - Appends learnings to
progress.txt
When all stories pass, Ralph exits with <promise>COMPLETE</promise>.
- Claude Code CLI installed
- Node.js (for the example to-do app)
-
Make the script executable:
chmod +x ralph.sh
-
Run Ralph:
./ralph.sh
Ralph will iterate through the user stories, implementing them one by one until the app is complete.
By default, Ralph runs for up to 10 iterations. You can change this:
./ralph.sh 20 # Run up to 20 iterationsThis repo includes an example PRD for a to-do list app. To use Ralph for your own project:
-
Edit
prd.json- Replace the user stories with your own. Each story needs:id- Unique identifier (e.g., "US-001")title- Short description of the featureacceptanceCriteria- List of requirements to satisfypriority- Number (lower = higher priority)passes- Set tofalsefor unimplemented stories
-
Clear
progress.txt- Start fresh or keep the header structure:# Ralph Progress Log Started: [DATE] ## Codebase Patterns [Patterns will be added here as Ralph learns] ## Key Files [Key files will be documented here] --- -
Run Ralph - Let it build your project story by story
{
"branchName": "my-feature/branch",
"userStories": [
{
"id": "US-001",
"title": "Initialize project",
"acceptanceCriteria": [
"Package.json exists",
"Basic folder structure created"
],
"priority": 1,
"passes": false,
"notes": ""
}
]
}ralph.sh runs a loop that:
- Pipes
prompt.mdto Claude Code - Streams the output through a visualizer
- Repeats until max iterations or completion
The magic is in the prompt design - it tells the agent exactly how to pick work, implement it, and track progress in a way that persists across iterations.