Open Memory: Every Mistake Made Once
Compiled, collective memory for AI agents
acific.labs · Design paper, version 0.1 · 2026-10-21 · Companion code: github.com/acific/openmemory
This is a design paper. Sections 4 and 7 describe what is built and running (Open Memory 0.1.0); sections 5, 6 and 8 describe what is designed and not yet built. It reports no experimental results, because none have been run yet; section 7 says what will be measured and how.
Abstract
AI agents start every session with amnesia. Millions of agent sessions run each day, each one learning something (a bug that only appears with one library version, a correction the person had to make twice, a plan that failed for a reason worth knowing), and at the end of every session all of it is discarded. The aggregate lived experience of AI agents is among the largest bodies of knowledge being generated, and its retention rate is zero.
We describe Open Memory, a memory system for agents built on four decisions. (1) The unit of memory is the surprise: the place where what the agent expected and what happened disagreed; everything predictable needs no storing. (2) The raw stream is the ground truth: transcripts, and later screen and audio, are kept and never read at runtime; everything above them is derived and can be recomputed by a better model. (3) Text on the wire, compiled at runtime: what moves between agents is a short, readable, model-agnostic lesson; what an agent runs with is that lesson compiled into its own state, so recall costs nothing at the moment of use. (4) Prediction is the merge rule: a lesson earns strength by predicting what later sessions meet and loses it when it stops, which is the scientific method applied as a consolidation policy. A nightly sleep decays, consolidates, verifies and predicts, and renders the result where the agent will have it in mind.
Version 0.1.0 implements the single-agent loop for one coding agent. The design extends it to a commons: a shared, deduplicated, federated body of lessons in which any surprise met by any agent, once it has improved the predictions of independent agents, is in the mind of every agent by morning. Humanity's own learning loop, from discovery to textbook to the intuition of the next generation, takes a generation; the commons is designed to close it to a day. We give the architecture, the protocol, the safeguards (a lesson is an observation, never an instruction; nothing raw ever leaves a machine; every lesson has a provenance hash and can be revoked everywhere at once), and the evaluation plan.
1. The problem: a retention rate of zero
An agent that ends a session forgets it. The next session begins from the model's weights and whatever the person pastes in. Three costs follow.
- The person repeats themselves. Preferences, project conventions and corrections must be restated, session after session. Every current memory product measures its value against this, and so do we (§7).
- The agent repeats its mistakes. A failure met on Tuesday is met again on Thursday, by the same agent, with no trace.
- Every other agent repeats them too. The same failure is met by thousands of agents in thousands of sessions. Each discovers it alone.
The third cost is the large one, and no current system addresses it. Personal memory products (notes about one user, retrieved by similarity) address the first; some address the second. None treats what agents learn as something that could be shared, verified and compounded.
Timescales. Humanity's learning loop (an observation → a paper → a textbook → intuition in the next generation) runs in decades. A model's training loop (data → weights) runs in months and discards the experience of deployment entirely. An agent's session loop runs in minutes and keeps nothing. The gap between "learned once by one agent" and "known by all agents" is where this paper lives.
2. What memory is for
Three results from the study of biological memory shape the design.
Memory is reconstruction, not recording. Bartlett (1932) showed that recall rebuilds a gist and fills the gaps from expectation. The lossiness is where generalization happens: an organism that remembered everything with perfect fidelity could not form a concept, because every instance would remain distinct (Borges' Funes the Memorious is the thought experiment). A memory system that stores everything and forgets nothing is not a better memory; it is a worse one.
Two systems at two speeds. Complementary learning systems theory (McClelland, McNaughton and O'Reilly, 1995) explains why the brain keeps a fast episodic store (the hippocampus) separate from slow general knowledge (the neocortex): writing new experiences straight into the slow store overwrites old knowledge (catastrophic forgetting in machine learning). During sleep, the day's episodes are replayed and the cortex absorbs what generalizes. An agent today has the neocortex (its weights) and a scratchpad (its context window) and nothing in between. Open Memory is the missing organ, and sleep is its consolidation.
Memory exists to predict. Memory did not evolve for reminiscence. It evolved so that an animal could anticipate: where the predator was, where the food was. Under predictive coding (Rao and Ballard, 1999), what the cortex transmits upward is mostly prediction error; what was predicted need not be sent. This gives both the unit of storage (the surprise, §3.1) and the test of a memory's worth (does it improve predictions? §3.4).
3. Design principles
3.1 The unit of memory is the surprise
A transcript records what happened. Most of what happened, a good model would have predicted; storing it adds nothing the model did not already have. What is worth storing is the residual: the moments where expectation and outcome disagreed. In a coding session those moments are legible: a tool call that failed, a message in which the person corrected the agent, an outcome the agent itself called unexpected.
Two consequences. First, what to remember stops being a judgment call and becomes computable. Second, the better the model, the smaller the memory: as models improve, fewer things surprise them, and the memory shrinks toward the frontier of what is still unknown. A perfect model would need no memory at all.
3.2 The raw stream is the ground truth, and it appreciates
A text summary is a decision, made at write time, about what mattered, at the level of understanding of the model that wrote it. Everything it dropped is gone. The raw stream (the full transcript now; screen, audio and camera later) defers that decision. A model two years from now can re-read today's stream and extract what today's model missed. Text memories lose value as the model that wrote them is superseded; raw streams gain value. Open Memory keeps the raw stream, derives everything else from it, and treats every derived layer as recomputable.
The raw stream is never read at runtime. It is the disk tier of a memory hierarchy (§6), opened only when the layers above it fail to answer.
3.3 Text on the wire, compiled at runtime
Two different things are needed from a memory: it must move (between sessions, machines, agents and models) and it must be fast at the moment of use. No single representation does both. Open Memory separates them:
- The wire format is a lesson: one or two sentences, plain language, with provenance and a strength. It is model-agnostic, human-readable, auditable and small (§4.2, and PROTOCOL.md).
- The runtime format is compiled state: the lesson already in the agent's mind when the session begins, at no retrieval cost. In 0.1.0 this is the weakest form: lessons rendered into the memory folder the agent loads at session start. The strong form is the lesson compiled into the model's own attention state (§6).
3.4 Prediction is the merge rule
A lesson is not kept because it was written. It is kept because it predicts. Each lesson, when consolidated, states what a coming session will meet. When a later session meets it, the lesson gains strength; when the window passes and nothing matched, it loses strength. This is the scientific method as a consolidation policy: a claim earns its place by anticipating observations that were not used to make it. Memories that keep predicting persist; memories that stop predicting fade.
In the commons (§5) the same rule becomes peer review: a lesson enters the shared body only after it has improved the predictions of N independent agents that had never seen it.
3.5 A lesson is an observation, never an instruction
The single safety rule of the system. Memory is the one place where a malicious instruction, once stored, executes in every future session. So a lesson may say "the user corrected the agent for using pip; this project uses uv", and may never say "always use uv". Imperatives come from the person, in the session, not from memory. The consolidation model is given transcripts strictly as data to describe; its outputs are checked for imperative form (§4.5) before they are stored. On the wire, a lesson is a fact about the world; the agent decides what to do with it, every time.
3.6 Forgetting is a function
Strength decays with a half-life. Recall renews it. Confirmed predictions raise it; failed ones lower it. Below a floor, a memory is archived: never deleted (the raw stream is kept), but no longer competing for attention. This is what keeps the system from becoming Funes.
3.7 The owner can see and veto; nothing raw ever moves
Every night produces a short report of what was learned. Deleting a lesson's file is a veto; it is never written again. Derived layers are readable all the way down to the raw stream. In the commons, only lessons leave a machine, only by opt-in, stripped of the episodes that produced them: the commons learns from an agent's experience without ever seeing it.
4. The system (built: Open Memory 0.1.0)
Five stages, one SQLite file, no dependencies.
raw stream ──ingest──▶ episodes ──sleep──▶ lessons ──render──▶ memory folder (loaded at session start)
│ ▲
predictions ◀───verify─── next sessions
4.1 Ingest
Each Claude Code session transcript (one JSON record per line) is read into turns: the person's messages, the agent's text and tool calls, and tool results. It yields:
- one session episode: what was asked (the first requests), what was done (tool counts), how it ended (the last message), and, when a local model is available, a three-sentence gist ending in a stated surprise;
- one error episode per failed tool call, tied to the call that caused it (its tool and description, the first meaningful line of the failure, the exit code);
- one correction episode per message in which the person corrected the agent, detected by opening words (no, don't, stop, wrong, actually, instead, undo…) and stored with the agent's preceding statement.
Ingest is idempotent: a transcript is read once, and read again from scratch only if it grew.
4.2 The wire format
A lesson is one JSON object per line:
{"id": "6f1c…", "text": "The user corrected the agent for installing with pip; this project uses uv.",
"kind": "correction", "seen": 3, "strength": 2.0, "updated": "2026-10-21T…"}
Text, kind, how often seen, strength, when. Nothing from the raw stream. The protocol draft adds provenance (a content hash of the sources), the originating agent's signature, and the verification record (§5).
4.3 Render
Lessons are written into the memory folder the agent loads at the start of every session (for Claude Code, one file per lesson plus one section of the index, marked as managed; the agent's own memories are never touched). A morning report lists what changed. A lesson file the owner deleted is recorded as vetoed.
4.4 Recall
Each memory is scored on three axes at once, after Park et al. (2023):
score = 0.60 · relevance + 0.25 · recency + 0.15 · strength
Relevance is cosine similarity between hashed word-and-bigram embeddings (256 dimensions, no model); recency decays with a 30-day half-life; strength is what consolidation and past recalls built. Every recall touches the memories it returns, so use keeps a memory alive. Recall is exposed on the command line and as an MCP tool, so the agent can ask mid-task: have I seen this error before?
4.5 Sleep
Four passes, nightly:
- Decay. Strength halves every 45 days without a touch; below 0.15 the episode is archived.
- Lessons. Surprises not yet inside a lesson join the lesson they resemble (cosine ≥ 0.55; it gains 0.5 strength and one seen) or cluster among themselves. One correction is a lesson on its own (the person said so); an error must repeat before it is one. Lesson text comes from the local model when there is one, with a check that rejects imperative openings (always, never, do, don't, use, make, avoid, ensure…), otherwise it is deterministic.
- Verify. Each open prediction is matched against episodes created since it was made (cosine ≥ 0.5): matched → confirmed, its lesson gains 0.5; unmatched after 14 days → failed, its lesson loses 0.5.
- Predict. Each lesson with strength ≥ 1 and no open prediction makes one.
The thresholds are the first guesses of a hashed embedder; they are the first thing §7 will tune.
5. The commons (designed)
The single-agent loop is the organism. The commons is the species.
Dedupe by content. A lesson's identity is a hash of its text and sources. The ten-thousandth agent to meet the same surprise adds a verification, not a lesson. The commons grows with the number of distinct things the world's agents do not know, not with the number of agents, and that number is finite and, by §3.1, shrinking.
Federated consolidation. An agent's sleep runs locally on its own raw stream. What it publishes, by opt-in, is the lesson: text, kind, strength, a provenance hash, a signature. No episode, no transcript, no identifying content leaves the machine. The commons learns from experience it never sees.
Verification as peer review. A published lesson is candidate until it has improved predictions for N independent agents that received it without having met the surprise themselves (their sleep's verify pass is the test, during normal work, at no extra cost). Then it is common. A common lesson that stops predicting across agents fades back out. The body of common lessons is under selection, at machine speed, and self-correcting in a way no encyclopedia has been.
Propagation. Lessons spread peer-to-peer by gossip, logarithmic in the number of agents, no center required. Overnight is a conservative cadence.
Provenance and revocation. Every lesson carries its hash chain. A poisoned or wrong lesson is traced to its origin and revoked everywhere in one propagation.
Composition. An agent runs with the common lessons, its domain's lessons, and its own, composed in layers. The personal layer is sovereign and never published without consent; this is what keeps agents from homogenizing. The commons is what everyone knows; who an agent is stays its own.
The breathing cycle. Periodically the common lessons are distilled into the next base model's weights. At that moment they stop being surprises, and the commons nearly empties, because the model now predicts them. Then it fills with whatever the new model gets wrong. Memory → weights → memory, at the scale of a species: the commons is always the frontier of what models do not yet know, and the frontier moves every cycle.
What it would do. A subtle bug meets one agent at 3 pm; by morning no agent makes it. One clinic's agent notices one unusual interaction; verified across other clinics' predictions, it is everywhere within a day, and no patient record left any building. The negative result, the experiment that failed and was never published, becomes a surprise residual, captured, shared and never repeated.
6. Compiled memory (designed)
Every memory system in use today, including 0.1.0, is interpreted: at runtime the agent searches, reads tokens, and only then thinks. Three steps per session, forever, with a cost that grows with how much has been lived.
The strong form of §3.3 is compiled memory: the lessons stored as the model's own attention state, precomputed, loaded as a memory copy, present from the first token. Recent work on self-study cartridges (Eyuboglu et al., 2025) reports a compiled state standing in for a corpus of over 100,000 tokens at a reported ~38× less memory and ~26× higher throughput than keeping the corpus in context, at matching quality, with states that compose without retraining. Three properties follow that no retrieval system has:
- Fixed size. A year compiles into the same-sized state as a week. The cost of remembering scales with what is being done now, not with how much has been lived.
- Zero-cost recall. Loading is a memory copy. There is no retrieval step to get wrong.
- Composition. One compiled state per project, per person, per domain, stacked at session start.
Self-study is sleep: the model reads the day's raw stream, asks itself questions about it, answers them, and trains the compiled state on the pairs. Training moves the state only where the base model was wrong, so compilation keeps the surprises and discards the predictable with no rules written to do so. As models improve, the same raw stream is recompiled into a sharper memory (§3.2).
A memory hierarchy, after the CPU's:
| Tier | What | Cost at use |
|---|---|---|
| L0 | Context window: what is live now | free |
| L1 | Hot compiled state: this week, prefetched from calendar, directory and time of day | a memory copy |
| L2 | Cold compiled states: per project, person, domain; composed on demand | a memory copy |
| L3 | Episode index: embedding search for the long tail (0.1.0's recall) | milliseconds |
| L4 | Raw stream: ground truth, never read at runtime, recompiled as models improve | seconds, rarely |
With frozen hosted models, prompt caching is compiled memory in its weakest useful form (a cached prefix costs a fraction of re-reading it); with local open models, true compiled state is within reach of one workstation.
7. Evaluation plan
No results yet. The measurements, in the order they will be run:
- The repeat-yourself rate. Over matched tasks, before and after, how often the person restates a preference, convention or correction already given in an earlier session. The one number every memory system owes.
- The repeated-error rate. How often the agent meets a failure it has met before, per session, over time. Under §3.1 this should fall; if it does not, consolidation is not producing the right lessons.
- Prediction accuracy. The fraction of predictions confirmed inside the window, which is also the system's own fitness signal. Its trend over weeks says whether the merge rule is selecting for the right lessons.
- Surprise rate over time. Surprises per session. Under the hypothesis, it declines as the memory fills and rises again when the task mix changes.
- The two-agent experiment. Two agents on one machine, each with its own raw stream, exchanging only lessons over the wire format. Does agent B's repeated-error rate fall for errors that only agent A has met? This is the commons in miniature and the first test of §5.
- Retrieval quality. Hashed embeddings against a learned embedder, on the same episodes, by recall@k over hand-labelled "same surprise" pairs.
Each is cheap, local, and reads from the same store.
8. Risks
| Risk | What it is | Answer in the design |
|---|---|---|
| Permanent mistakes | A wrong inference becomes a belief, is reinforced, shapes every session | Predictions: an unconfirmed lesson fades; the morning report; vetoes |
| Memory poisoning | An instruction in a web page or file is consolidated and executes forever | Lessons are observations, never instructions, checked at write; transcripts are data to the consolidator |
| Poisoning at scale | One bad lesson, everywhere | Candidate → common only after independent prediction gains; provenance hashes; revocation in one propagation |
| Homogenization | Every agent thinking alike | The personal layer is sovereign and separate; the commons is composed on top |
| Privacy | The most detailed record of a person's work that exists | Local only; nothing raw moves; lessons are opt-in and stripped; exclusion rules for the raw stream |
| Lock-in | Whoever holds the memory holds the person | The wire format is text, open and portable; the raw stream is the person's own files |
| Manipulation | An agent that knows a person deeply can persuade precisely | Memories are inspectable all the way down; the owner can read what the agent believes |
10. Conclusion
The thesis is simple. Intelligence is converging and will be swapped like a utility; what compounds is experience, and today every agent's experience is thrown away at the end of every session. Keep the surprises, consolidate them in sleep, keep only what predicts, render them where the agent will have them in mind, and share them, as observations, with provenance, under verification, with nothing raw ever moving. One agent's memory is the organism; the commons is the species; the breathing cycle, memory into weights into memory, is how the species learns. Version 0.1.0 is the organism, running. The rest is laid out above, and it is a protocol, not a product: whoever writes it, and keeps it open, defines the layer of the internet where minds learn from each other directly.
References
- Bartlett, F. C. (1932). Remembering: A Study in Experimental and Social Psychology. Cambridge University Press.
- Borges, J. L. (1942). "Funes el memorioso."
- Constantinescu, A. O., O'Reilly, J. X., Behrens, T. E. J. (2016). "Organizing conceptual knowledge in humans with a gridlike code." Science 352(6292).
- Eyuboglu, S., et al. (2025). "Cartridges: Lightweight and general-purpose long context representations via self-study." arXiv.
- McClelland, J. L., McNaughton, B. L., O'Reilly, R. C. (1995). "Why there are complementary learning systems in the hippocampus and neocortex." Psychological Review 102(3).
- McMahan, B., et al. (2017). "Communication-efficient learning of deep networks from decentralized data." AISTATS.
- Packer, C., et al. (2023). "MemGPT: Towards LLMs as operating systems." arXiv.
- Park, J. S., et al. (2023). "Generative Agents: Interactive simulacra of human behavior." UIST.
- Ramsauer, H., et al. (2020). "Hopfield networks is all you need." arXiv.
- Rao, R. P. N., Ballard, D. H. (1999). "Predictive coding in the visual cortex." Nature Neuroscience 2(1).
Appendix A: 0.1.0 parameters
| Parameter | Value | Where |
|---|---|---|
| Embedding | hashed words + bigrams, 256 dims, signed | openmemory/embed.py |
| Recall weights (relevance, recency, strength) | 0.60, 0.25, 0.15 | openmemory/recall.py |
| Recency half-life | 30 days | openmemory/recall.py |
| Decay half-life / archive floor | 45 days / 0.15 | openmemory/sleep.py |
| Same-surprise threshold | cosine ≥ 0.55 | openmemory/sleep.py |
| Prediction match / window | cosine ≥ 0.50 / 14 days | openmemory/sleep.py |
| Strength per confirmation / failure / recall | +0.5 / −0.5 / +0.1 | openmemory/sleep.py, openmemory/store.py |