Abstract
Most agents remember by keeping text in front of the model: a growing transcript, a rolling summary, or chunks fetched by embedding similarity. All three treat memory as part of the prompt. None of them can answer a precise question about the past with a precise answer.
We argue that agent memory is a database problem. The right shape is an append-only log of typed events (human inputs, tool signals, code changes, validated actions) stored in a columnar engine, where recall is a filtered, joined, time-bounded query. Similarity search remains useful as one index among several. It is not the memory itself.
Three generations of agent memory
The idea that a language model needs memory outside its context window is not new. What has changed is how structured that memory has become.
Memory as a paging problem
MemGPT treats the context window like RAM and moves text between it and external storage under the model’s control, borrowing the vocabulary of operating systems. [1]
Memory as a stream of observations
Generative Agents store every experience as a natural-language record in a memory stream, then retrieve by combining recency, importance and relevance, and periodically write higher-level reflections back into the stream. [2]
Memory as lessons
Reflexion agents write verbal feedback about their own failures into an episodic buffer and condition later attempts on it, reaching 91% pass@1 on HumanEval in the authors’ setup. [3]
Memory as structured notes and graphs
A-MEM organizes memories as linked notes with keywords and tags that are updated as new memories arrive [6]. Mem0 extracts, consolidates and retrieves salient facts, with an optional graph variant [7]. Zep builds a temporal knowledge graph so that facts carry the time they became true and stopped being true [8].
Read in sequence, the trend is clear. Each generation adds structure that the previous one lacked: first an external store, then scoring, then explicit consolidation, then entities, links and time. The systems are converging on something that looks more and more like a database, but most still store natural language and retrieve it by similarity.
Why the transcript fails
A transcript records what was said, in the order it was said. That is the wrong index for almost every question an engineering agent asks.
- No identity. The same change is described five times across a session, under different words. Nothing says these are one fact.
- No status. A failed attempt and a merged fix look alike in text. Whether an action was validated is not a property of the sentence describing it.
- No time model. “Current” is wherever the reader happens to stop. Corrections do not overwrite what they correct, they just come later.
- No scope. A transcript belongs to one session. The work of other agents, other people and other weeks is not in it.
The evaluation literature agrees. LongMemEval tests extraction, multi-session reasoning, temporal reasoning, knowledge updates and abstention over long chat histories, and finds that commercial assistants and long-context models lose about 30% accuracy when the information must be remembered across sustained interactions [9]. Temporal reasoning and knowledge updates, two of its five categories, are exactly the operations a transcript has no structure for.
The memory systems above report large gains once memory is stored separately and retrieved selectively. These are each paper’s own numbers, on their own benchmarks and baselines.
Reported savings from structured memory vs. full context
Each paper's own reported reduction. Different benchmarks and baselines, so read them as direction, not comparison. Hover for details.
Sources: Mem0 [7], reductions vs. a full-context approach on LOCOMO. Zep [8], response latency vs. baseline implementations on LongMemEval.
Every system that beats the full-context baseline does it the same way: it stops putting the past in the prompt and starts querying it.
Similarity is not relatedness
Retrieval-augmented generation made the external store standard: embed the query, fetch the nearest chunks, prepend them to the prompt [10]. For open-domain questions over prose, that works well. For agent memory, it answers a different question from the one being asked.
Consider what an engineering agent actually needs to know before it touches a file:
- every change made for this intent, across all files and agents;
- whether any of those changes was reverted, and by whom;
- which past actions on this module were validated, and what their inputs and outputs were;
- what a reviewer rejected in the last seven days, and why.
These are predicates, not neighborhoods. They involve equality on identifiers, ranges on time, joins between changes and intents, and filters on status. A vector index can find text that sounds like the question. It cannot guarantee that it returns all matching rows, and only those. Weller et al. make the limit formal: for a single-vector embedding, the number of distinct top-k subsets it can return is bounded by its dimension, and on their deliberately simple LIMIT benchmark, strong embedding models still perform poorly [11].
The practical failure modes are familiar. A stale fix from a previous year scores higher than this week’s. A rejected draft is semantically closer to the question than the merged change. A revert, which is short and says little, ranks nowhere.
Ask a question to memory
Same question, three memories. Pick a question; results stream in. Illustrative data, not a benchmark.
Transcript and vector results are text the model must still read and judge. The SQL result is the answer: typed rows filtered by intent, time and validation status. Illustrative.
Similarity search still has a role. It is a good way to find a candidate intent from a fuzzy Slack message, or to suggest that two incidents may be related. In a database, it is one more index. The answer comes from the rows.
An event log, not a state
If memory is a database, what is its schema? We follow a pattern older than LLMs: event sourcing. Instead of storing the current state and overwriting it, the system stores every change as an immutable event, and derives any state by replaying or aggregating the log [12].
For agents, this has three consequences.
- Nothing is lost, nothing is rewritten. A correction is a new event that supersedes an old one. The history of how a decision was reached stays queryable.
- State is a query. “What is the current acceptance criterion for this intent?” is the latest validated
intent_updateevent. “What has the fleet done on billing this month?” is an aggregation. - Validation is a column. An action enters memory as an event with its input, its output and who validated it. Unvalidated attempts can be logged for audit, then simply excluded from every context-building query.
This is also how Generative Agents and Zep already behave in spirit: an append-only stream in one case [2], facts with validity intervals in the other [8]. The difference is that the log is typed, and the store is built to scan it.
Why columnar
An event log for an engineering organization is wide, append-heavy and enormous. Every GitHub event, every CI run, every alert and every agent action is a row. Queries, on the other hand, are narrow: a handful of columns, a time window, an intent or a file. That is the workload column stores were designed for.
- Read only the columns you need. C-Store stores each column separately and sorted, so a query reads the attributes it references and nothing else [13].
- Process vectors, not tuples. MonetDB/X100 showed that executing operators over batches of column values, instead of one tuple at a time, keeps the CPU busy and cache-resident [14].
- Skip what cannot match. ClickHouse combines an LSM-style storage format, a vectorized execution engine and aggressive pruning to avoid touching irrelevant data [15].
In ClickHouse’s MergeTree engine, data is sorted by a primary key and split into granules of 8,192 rows by default. The sparse primary index stores one mark per granule, so a filter on the key prefix becomes a binary search over marks, and each column lives in its own file [16]. Parts can be partitioned by time and pruned by their min/max values before any data is read.
A memory query touches almost nothing
Illustrative plan on a MergeTree table ordered by (intent_id, ts) and partitioned by month. Each cell is one granule of one column. Counts and timing are example values, not a benchmark.
SELECT ts, kind, file FROM memory.events WHERE intent_id = 'INT-4821' AND ts >= '2026-09-01' ORDER BY ts
A real granule holds 8,192 rows by default, so each cell stands for thousands of values stored contiguously in that column's own file. Illustrative.
The ClickHouse documentation walks through this on an 8.87-million-row example table. These are the documentation’s own numbers, on its own example data.
Rows processed by the same engine, depending on the key
ClickHouse documentation example, 8.87M rows in 1,083 granules. Thousands of rows read. Lower is better.
Source: ClickHouse sparse primary index guide [16]. Filter on the first key column selects 1 of 1,083 granules. Filter on the second key column selects 1,076 of 1,083; after reordering the key, 39 of 1,083.
The lesson is not that the database is fast. It is that the shape of the key decides what memory costs. If memory is ordered by intent and time, the questions agents ask most often become near-point lookups, regardless of how large the log grows.
How Chad applies it
Chad logs everything into ClickHouse, a database our team has contributed to for years: every GitHub event, every human input (instructions, corrections, approvals), every tool signal from Sentry, Prometheus, CI, Linear, Jira, Slack and Granola, and every agent action.
- Typed events. Each row carries its source, kind, timestamp, repository, actor and, once known, the
intent_idit belongs to. Ordering keys are chosen for the questions the context compiler asks. - Git as rows. Code history is decomposed into rows of line additions and deletions linked to the intent behind each change, so “everything done for this intent” is a columnar query, not an LLM re-reading history (see Paper 05).
- Validated actions. An action is written as an input → output pair once a human or an AI verifier validates it. Only validated actions are eligible for future contexts.
- Recall is compilation. Each agent loop starts empty. The context compiler queries the log for the domain best practices, the validated intent and its acceptance criteria, the related changes, the relevant validated actions, and the atomic task with its target files, and assembles about 6k tokens (see Paper 01).
Nothing is remembered by keeping it in a prompt or in a KV cache (see Paper 02). Everything is remembered by writing it down in a form that can be queried.
Limits & next steps
A database does not decide what is true. The quality of this memory depends on two things the schema cannot guarantee: that events are linked to the right intent, and that validation is meaningful. Both are active work for us, and both are easier to audit in rows than in a transcript.
Structured retrieval also needs a question precise enough to compile into a query. When an input is vague (a half-sentence in Slack, a new kind of alert), similarity search and an LLM are still the right first step to map it onto an intent. Our position is not that embeddings are useless, only that they are an index, not the store.
The numbers quoted above are each source’s own, on their own benchmarks. We have not yet published measurements of Chad’s memory on real repositories. We will publish query latencies, context sizes and task outcomes here as they land.
References
- Packer, C. et al. MemGPT: Towards LLMs as Operating Systems. arXiv, 2023.
- Park, J. S. et al. Generative Agents: Interactive Simulacra of Human Behavior. UIST, 2023.
- Shinn, N. et al. Reflexion: Language Agents with Verbal Reinforcement Learning. NeurIPS, 2023.
- Zhang, Z. et al. A Survey on the Memory Mechanism of Large Language Model based Agents. arXiv:2404.13501, 2024.
- Hu, Y. et al. Memory in the Age of AI Agents: A Survey, Forms, Functions and Dynamics. arXiv:2512.13564, 2025.
- Xu, W. et al. A-MEM: Agentic Memory for LLM Agents. NeurIPS, 2025.
- Chhikara, P. et al. Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory. arXiv:2504.19413, 2025.
- Rasmussen, P. et al. Zep: A Temporal Knowledge Graph Architecture for Agent Memory. arXiv:2501.13956, 2025.
- Wu, D. et al. LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory. ICLR, 2025.
- Lewis, P. et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS, 2020.
- Weller, O., Boratko, M., Naim, I., Lee, J. On the Theoretical Limitations of Embedding-Based Retrieval. arXiv:2508.21038, 2025.
- Fowler, M. Event Sourcing. martinfowler.com, 2005.
- Stonebraker, M. et al. C-Store: A Column-oriented DBMS. VLDB, 2005.
- Boncz, P., Zukowski, M., Nes, N. MonetDB/X100: Hyper-Pipelining Query Execution. CIDR, 2005.
- Schulze, R., Schreiber, T., Yatsishin, I., Dahimene, R., Milovidov, A. ClickHouse - Lightning Fast Analytics for Everyone. PVLDB 17(12), 2024.
- ClickHouse. A Practical Introduction to Primary Indexes in ClickHouse. ClickHouse documentation.