The fix for your agent's memory has had a name since 1841.
On April 24, 1841, the French Ministry of the Interior issued Circular No. 14, a set of instructions for putting the departmental archives in order. Its author was Natalis de Wailly, head of the Administrative Section of the Archives nationales, and the problem in front of him was a half-century of good intentions gone wrong. Since the Revolution, France had nationalized mountains of records, and archivists had organized them the way any tidy mind would: by subject. Letters about bridges under Bridges. Charters about forests under Forests. It felt like order. It was destruction. A letter about a bridge, filed under Bridges, has been torn out of the negotiation that produced it, the dispute it settled, the office that wrote it, and the sequence of correspondence that gives it sense. The document survived; what it meant did not.
De Wailly's circular said: stop. Records were to be grouped by fonds, the whole body of records arising from one office, family, or institution, and never re-sorted by subject. The principle became known as respect des fonds, and it is the founding rule of modern archival science. There is even a humbling detail in its origin that professionals of every era should appreciate: it was partly a practical measure, a rule simple enough that novice archivists could follow it without wrecking anything. But it encoded something deep, a claim about the nature of records that took the rest of the century to fully articulate: a record's meaning is inseparable from its context of creation. Who made it, in what process, in what order. Provenance is not metadata about the record. Provenance is part of the record.
Hold that thought while I describe how your agent's memory works, because nearly every memory system shipped in the last few years is a beautifully engineered violation of an 1841 circular, and the failures it produces are exactly the ones de Wailly predicted.
Strip away the linear algebra and here is what a vanilla vector memory does: it takes each memory, each fact, preference, decision, or snippet of conversation, embeds it into a space where nearness means topical similarity, and retrieves whatever sits closest to the query. That is organization by subject, executed at scale and with no archivist on duty. The memory about your database goes in the database neighborhood. The memory about your deploy process goes in the deploy neighborhood. When you ask a database question, the database-shaped memories come back.
It feels like order. It is the pre-1841 filing system, rebuilt in floating point.
What gets destroyed is precisely what de Wailly said gets destroyed. A cosine distance function is blind to provenance and blind to sequence by construction: it sees the text of a memory and nothing else. Practitioners in the agent-memory space have converged on a phrasing for the resulting failure that could have been lifted from an archival textbook: semantic similarity is not contextual relevance. A memory retrieves because its words match the query, not because it is the memory you need, and the difference between those two is everything the embedding threw away. As the memory-infrastructure vendors themselves put it, a fact from five minutes ago and a semantically identical fact from five weeks ago look the same to a cosine function. Time is invisible. Order is invisible. Source is invisible.
Every developer who has run a long-lived agent knows the lived version. In January you tell the agent the project runs on Postgres. In March you migrate and tell it so. In July it confidently writes Postgres connection code again, because "the project uses Postgres" and "the project uses SQLite" are near-identical vectors in database-space, and nothing in the retrieval layer knows that one of them was superseded by the other. Supersession is not a semantic property. It is a provenance property: it lives in when the statements were made, in what order, and by what process. Sort by subject and you have two equally similar facts and a coin flip. Industry write-ups on agentic RAG report systematic failures on exactly this class, temporal reasoning, contradiction management, outdated facts, and I will attribute rather than launder those reports: the people documenting the failure are mostly the people selling the fix. But the mechanism does not need a benchmark to see. A memory re-sorted by topic is a document torn from its file. It retrieves. It does not remember, because remembering requires the context the re-sort discarded.
It is worth being precise about the principle, because the details map. Respect des fonds matured into two components, and they arrived separately. De Wailly's 1841 contribution was provenance: group records by their creating body, never merge or re-sort across origins. The second component, original order, keeping records in the arrangement their creator gave them, was strengthened later, particularly in the Prussian registry tradition, and codified when the Dutch archivists Muller, Feith, and Fruin wrote the field's first great manual in 1898. Two distinct insights: who made this and in what sequence. An archive that preserves both can answer the question that subject files never can: what did this office know, and when did it know it?
And in 1922 the English archivist Hilary Jenkinson added the third leg, the one that should make anyone building agent infrastructure sit up: provenance is what makes a record trustworthy. An unbroken chain of custody, records kept as their creators kept them, is the evidence that lets you rely on the record at all. Tear the record out of its fonds and you have not just lost interpretive context; you have lost the grounds for believing it.
Who created this memory. In what sequence. Can I trust it. Those are the three questions archival science spent a century learning to answer structurally, and they are the exact three questions a vector lookup cannot answer, not because of tuning, but because the representation discarded the answers at write time.
Here is the part I find genuinely delightful. The frontier of agent memory in the last two years has been, without citing it, rebuilding respect des fonds piece by piece.
Look at the temporal knowledge graph work: Zep's architecture, published in January 2025 (arXiv:2501.13956), and its open-source engine Graphiti, now one of the most-starred agent-memory projects. The core design is bi-temporal: every fact carries when it became true and when it stopped being true, and when a fact changes, the old one is invalidated, not deleted, so the agent can reason explicitly about what was true then versus now. Read that as an archivist: facts have provenance, sequence is preserved, superseded records are retained in their historical position rather than overwritten. That is original order, restored. The Postgres memory does not fight the SQLite memory anymore; it sits behind it, marked as the thing that used to be true, which is itself information.
The same convergence shows up in retrieval design: the emerging consensus is multi-signal retrieval, fusing semantic similarity with recency, sequence, and source signals rather than letting cosine distance judge alone. Notice what that is structurally: a subject index operating alongside preserved provenance, instead of instead of it.
So run the timeline. In 1841, de Wailly says: do not sort records by subject; keep them by origin and order, because meaning lives there. Through the 2010s and early 2020s, we built agent memory almost entirely on subject similarity, stripping origin and order at write time. By 2025 and 2026, the leading fix is to put time, source, and supersession back as first-class structure. The archivists were right, the field spent years of engineering rediscovering it, and the payoff of knowing the history is that you inherit not just the conclusion but the vocabulary: provenance, original order, fonds. A hundred and eighty-five years of tuition, already paid, sitting in the literature under a French name.
If the story ended with "never sort by subject," it would be too clean, and it would be wrong. The satisfying twist is that archival science itself ran the counterargument, and its resolution is the same one the memory engineers are converging on.
In 2013, the archivist Jefferson Bailey published an essay in Archive Journal with a title I could not improve on: "Disrespect des Fonds." His argument: born-digital records break the physical assumptions the 1841 principle quietly relied on. A digital record is not locked into one physical arrangement on one shelf; it can belong to multiple groupings at once, be described from several angles, be re-ordered and re-projected at will. Insisting on a single sacred arrangement misreads what digital records are. But, and this is the part that matters, Bailey framed the move as bringing other contextual relations up to the same level of privilege as provenance, "not as an act of elimination or insubordination" but, in his words, "a humbling" of the principle. Nobody in the debate proposed discarding provenance. The mature position is: provenance and original order must survive and stay retrievable; additional indexes on top are not just acceptable, they are the point of digital records.
Translate that to memory systems and you get the correctly calibrated thesis, sharper than either extreme. The vector index is not the sin. Embedding your memories by topic is a genuinely powerful access method, the digital archivist's dream of infinite simultaneous arrangements. The sin is discarding provenance to get it: writing memories into a store where topic-space is the only structure, where who-said-it, when, in-what-sequence, and superseded-by exist nowhere. Vanilla RAG never sinned by adding a subject catalog. It sinned by burning the fonds to print the catalog.
The practical payload fits in one habit and four design rules.
The habit is a test you can apply to any memory system, yours or a vendor's, in one minute. Pick a retrieved memory and ask the system the archivist's questions: Who or what process created this? When? What came just before and after it? Is it still current, and if not, what superseded it? If those questions have structural answers, you have memory. If the only answer available is "it was cosine-similar to your query," you have retrieval, and every failure mode you will hit, stale preferences, contradictions served with confidence, decisions replayed without the constraints that shaped them, is already predicted by an 1841 circular.
The design rules follow directly. First, write provenance into the record, not around it: every memory carries its creating process, session, and position in sequence, as load-bearing fields, because provenance is part of the record, not decoration on it. Second, make time bi-temporal and supersession explicit: "valid from, invalidated when, superseded by" beats a bare created-at timestamp, and invalidated facts are kept in place, not deleted, because what used to be true is context for what is true. Third, retrieve on fused signals: semantic similarity proposes, but recency, source, and validity dispose; cosine never judges alone. Fourth, keep the fonds navigable: an agent should be able to walk from any retrieved memory back into the session or process that produced it and read the surrounding record in original order, the way a historian pulls the whole file rather than the photocopied page. (I have written separately about how much memory to keep when compacting; that is the rate question. This one is the structure question, and it comes first, because compression can only preserve structure that exists.)
None of this requires inventing anything. That is the quiet gift of the cross-domain view: the debate you are about to have about your agent's memory, tidy topic clusters versus messy origin-preserving files, plus the eventual synthesis, both indexes with provenance never discarded, was held, resolved, and written down by people in reading rooms who never saw a GPU. When the retrieval layer serves you last winter's database choice as if it were this morning's, you do not have a novel AI problem. You have a document torn from its file, and the fix has had a name since 1841.
Provenance is part of the record. Build your agent's memory so it can never be torn from its file.
The archivist's three questions, who created this, in what sequence, can I trust it, are the ones a cosine lookup discards at write time. Chain-of-consciousness is the provenance layer that keeps them: every memory and decision carries its creating process, session, and position in sequence as load-bearing structure, so a retrieved memory can always be walked back into the record that produced it. The subject index is welcome on top; the fonds underneath it stays intact.
See the Hosted Chain-of-Consciousness page
pip install chain-of-consciousness · npm install chain-of-consciousness