Documentation Index
Fetch the complete documentation index at: https://mintlify.com/snarktank/ralph/llms.txt
Use this file to discover all available pages before exploring further.
Memory Persistence
Since each Ralph iteration starts with a fresh context, the agent has no memory of previous iterations. All memory must be explicitly persisted to disk. Ralph uses four mechanisms to maintain state across iterations.The Four Persistence Layers
Let’s explore each layer in detail.
1. Git History
What It Stores
Every completed user story is committed to git:How It’s Used
- The next iteration sees all code changes from previous stories
- Commit messages provide high-level context
git diffshows exactly what changed- Branches keep Ralph work isolated from main
Commit Format
Ralph uses a consistent commit message format:All changes from an iteration (implementation + prd.json update + progress.txt update + AGENTS.md updates) are committed together in a single commit.
Branch Strategy
The PRD specifies abranchName:
- Check if the branch exists
- Create it from
mainif it doesn’t - Check it out
- Make all commits on this branch
2. progress.txt
What It Stores
An append-only log where each iteration records:- What was implemented
- Which files were changed
- Learnings for future iterations (most important!)
Structure
Codebase Patterns Section
The Codebase Patterns section at the top is critical:- It’s the FIRST thing each iteration reads
- Contains the most important, reusable patterns
- Gets updated when iterations discover general patterns
Per-Iteration Sections
Each iteration appends its own section with:- Timestamp and Story ID - When it ran and what it worked on
- Thread URL (for Amp) - Link to the full conversation for deep dives
- Implementation summary - High-level what was done
- Files changed - Which files to look at
- Learnings - Patterns, gotchas, and useful context
How It’s Used
Each fresh iteration:- Reads
progress.txtimmediately after reading the PRD - Looks at the Codebase Patterns section first
- Scans recent iterations to understand what’s been done
- Uses learnings to avoid repeating mistakes
- Appends its own learnings at the end
3. prd.json
What It Stores
The structured task list with completion status:The passes Field
The passes boolean is the key to Ralph’s state machine:
passes: false- Story is not yet completepasses: true- Story is complete and quality checks passed
How It’s Used
- Task Selection - Each iteration picks the highest priority story where
passes: false - Completion Tracking - After successful implementation, the agent updates
passes: true - Stop Condition - When ALL stories have
passes: true, Ralph outputs<promise>COMPLETE</promise>
The PRD is both read (to pick the next task) and written (to mark tasks complete) during each iteration.
Story Structure
Each story includes:- id - Unique identifier (used in commit messages)
- title - Short description (used in commit messages)
- priority - Order of execution (lowest number = highest priority)
- passes - Completion status
- description - Detailed explanation of what to build
- acceptanceCriteria - Specific requirements that must be met
4. AGENTS.md Files
What They Store
Distributed knowledge files throughout the codebase that document:- Patterns and conventions for that module
- Gotchas and non-obvious requirements
- Dependencies between files
- Testing approaches
- Configuration requirements
Where They Live
AGENTS.md files can exist at any level of your project:How They’re Used
AI coding tools (Amp, Claude Code, etc.) automatically read AGENTS.md files:- When viewing/editing files in a directory
- When navigating the codebase
- When the agent mentions the directory
AGENTS.md is a convention supported by many AI coding tools. It’s like a README for AI agents.
What to Include
Add to AGENTS.md when you discover: ✅ Good additions:- “When modifying X, also update Y to keep them in sync”
- “This module uses pattern Z for all API calls”
- “Tests require the dev server running on PORT 3000”
- “Field names must match the template exactly”
- Story-specific implementation details
- Temporary debugging notes
- Information already in progress.txt
Example AGENTS.md
How the Layers Work Together
Each layer serves a specific purpose:- Git - What code exists
- progress.txt - Why it was built that way
- prd.json - What still needs to be done
- AGENTS.md - How to work with this code
Archiving
When starting a new feature (differentbranchName), Ralph archives the old state:
AGENTS.md files are NOT archived—they stay in the codebase permanently as living documentation.
Debugging Memory Issues
If an iteration seems to “forget” something:-
Check if it was committed to git
-
Check if it’s documented in progress.txt
-
Check if the story is marked complete
-
Check if the pattern is in AGENTS.md
Best Practices
Commit Frequently
Each completed story should be committed immediately. Don’t accumulate multiple stories in one commit.
Write Detailed Progress Reports
The learnings section in progress.txt is future-you’s only memory. Be thorough.
Update Codebase Patterns
When you discover a reusable pattern, add it to the Codebase Patterns section at the top of progress.txt.
Maintain AGENTS.md Files
Update AGENTS.md files when you discover module-specific patterns that would help future iterations.
Summary
Ralph’s memory is entirely explicit:- Git stores code and changes
- progress.txt stores context and learnings
- prd.json stores task status
- AGENTS.md stores patterns and conventions

