# How Ralph Maintains Context Between AI Instances: A Deep Dive into State Persistence

> Discover how Ralph sustains AI context using Git history, a JSON task registry, and a progress log. Learn about its state persistence for stateless LLM processes.

- Repository: [Ryan Carson/ralph](https://github.com/snarktank/ralph)
- Tags: deep-dive
- Published: 2026-04-13

---

**Ralph maintains context between AI instances through three coordinated persistence mechanisms—Git history, a structured [`prd.json`](https://github.com/snarktank/ralph/blob/main/prd.json) task registry, and an append-only [`progress.txt`](https://github.com/snarktank/ralph/blob/main/progress.txt) log—that allow stateless LLM processes to resume work across independent iterations.**

The snarktank/ralph repository solves a critical challenge in autonomous AI development: every iteration spawns a fresh Amp or Claude Code process with a clean context window. Because each LLM invocation starts from scratch without prior memory, Ralph implements an external persistence layer using specific files that survive script executions and enable continuous