context-constitution: Letta's Constitution Treats Memory Like Law
A Markdown-first spec for agents that keep identity, tools, and memory under version control.

The agent is brand new - it doesn't know anything about you, and has [no] real history of prior interactions. In contrast, Letta Code is fully stateful. The idea is that you work with a small handful of agents that get better and better over time as they learn more about you and your codebase.
- Letta's Context Constitution treats memory as governed infrastructure, not a prompt-writing trick.
- MemFS gives agents a filesystem-shaped memory model that matches how LLMs already reason.
- Git makes agent state auditable, rollback-friendly, and easier to evolve across sessions.
- The real product shift is from stateless prompting to long-horizon context management.
Most AI repos add another wrapper. This one adds a constitution. That sounds grandiose until you notice the move underneath it: Letta is treating context as a governed resource, not a disposable prompt buffer. If an agent is going to remember, forget, and improve, those actions need rules.
Why a constitution at all?
The repository belongs to Letta, the company behind MemGPT, and it reads like the formal layer on top of that work. Letta's own blog says the Context Constitution is "a set of principles governing how AI agents manage context to learn from experience." That matters because the repo is not a library you import. It is a document the agent is meant to live under.
Today we are releasing the Context Constitution: a set of principles governing how AI agents manage context to learn from experience. We use the Constitution internally as the foundation of our prompting and for training memory-native models.
That is a different kind of software artifact. Instead of shipping more code paths, the project ships operating principles for identity, continuity, and memory management. The documentation is written in the second person because the audience is the agent itself. In other words, the docs are part of runtime behavior.
The two markdown files that do the real work
The repo is small on purpose. constitution/CONSTITUTION.md defines the identity layer. constitution/AFFORDANCES.md defines the interface layer. Together they say what the agent is, then what it can touch. The GitHub Actions check for whitespace sounds trivial, but in a prompt-heavy system, clean markdown is part of the runtime surface.
constitution/
CONSTITUTION.md identity, continuity, learning
AFFORDANCES.md tools, filesystem, memory access
.github/workflows/
check-whitespace.yml
Read that flow as an argument. Letta is saying that an agent does not need to cram everything into a single prompt. It needs a memory system with tiers, a place for procedural knowledge, a place for durable facts, and a way to revise the whole thing over time. The payoff is continuity without pretending the model weights are changing live.
Why git belongs in memory
This is the sharpest part of the design. Rather than inventing a proprietary memory API, Letta leans on a filesystem and Git, two abstractions developers already trust. That makes agent state inspectable, diffable, and rollback-friendly. If an agent becomes confused, you are not forced to throw away the whole system. You can inspect what changed and restore a known good state.
| Dimension | Stateless coding CLI | Letta Context Constitution |
|---|---|---|
| Memory ownership | The session owns the context, and it disappears when the chat ends. | The harness owns the context, and the agent keeps a durable memory filesystem. |
| Learning | Mostly prompt repetition and manual recontextualization. | Context is edited, versioned, and reorganized over time. |
| Operational model | Fast resets, low maintenance, little continuity. | Git-backed persistence, auditing, and rollback. |
| Best for | Single-shot assistance and short tasks. | Long-lived agents that should accumulate familiarity. |
The Context Constitution defines how agents should use these affordances to learn, build identity, and improve over time.
The competitive implication is clear. Stateless tools optimize for immediate throughput. Letta is optimizing for memory as a product surface. That is a different bet, and it pushes the engineering conversation away from prompt crafting and toward context governance, audit trails, and long-horizon behavior.
What this changes for builders
If you are building agents, the repo is a reminder that the hard part is no longer just making the model answer well. It is deciding what the agent should remember, where that memory should live, and how it should evolve without becoming chaotic. That is why this project feels bigger than its size. It is not a codebase first. It is a constitution for software that has to live with its own history.