Source: https://hatchery.build/blog/the-bitter-lesson-for-agent-memory

2 Dec 2026· [Arjun Kumar](https://x.com/arjunkmrm)

# The bitter lesson for agent memory

Letting an agent query its own event logs achieves SOTA in all major memory benchmarks and scales with intelligence.

> Time is a river which sweeps me along, but I am the river.

Jorge Luis Borges, A New Refutation of Time

In Christopher Nolan's _Memento_, Leonard Shelby is set upon a seemingly impossible task. To find the man who killed his wife, despite the anterograde amnesia caused by a blow to his head. To maintain context with a memory that resets every so often, he uses polaroids, notes and tattoos.

This reminds me of how we do agent memory. Models have anterograde amnesia. They can't form long term memories, and their state of the world is frozen to a training cutoff. To maintain context across sessions, we engineer memory systems that encode and retrieve information from the past.

But how much engineering does a memory system need? Richard Sutton famously stated in [The Bitter Lesson](http://www.incompleteideas.net/IncIdeas/BitterLesson.html) that general methods such as search and learning outperform systems built with human domain knowledge.

We found this to be the case with agent memory.

Allowing an agent to run SQL queries and search over its own event log beats or matches specialised memory systems in all major memory benchmarks and scales with model intelligence.

We argue that memory systems lose valuable task-relevant information during compression. In contrast, agentic search over an event log defers compression until query time. We propose a design for memory systems that aims to maximise the epistemic value of searching past events, using a hierarchy of derived views over an immutable event log.

## A survey of memory systems

Anthropic recently [described memory](https://www.anthropic.com/research/components-of-agent-memory) as knowledge an agent gains from experience and retains between sessions. Information theory offers us a sharper lens: memory is information from the past that reduces uncertainty in the future. A _memory system_ is what _encodes_, _consolidates_, and _retrieves_ that information.

A wavy line runs from left to right, drawn in dark blue up to now. From now, the ground truth continues the same waves. The futures plausible with memory form a narrow blue band that follows the ground truth's curves: low uncertainty. The futures plausible without memory form a wide grey cone opening from now that fades out toward the future: high uncertainty.

With memory, plausible futures narrow around ground truth; without it, they spread into a wide cone.

Decades of research from cognitive neuroscience give us a [systematic framework](https://doi.org/10.1152/physrev.00032.2012) to understand memory systems: encoding, consolidating, and retrieving experience.

A cycle of three stages. Encoding turns experience into a store. Consolidating turns the store into a better store. Retrieving moves the store into context. The agent then acts, and what it does becomes new experience for encoding.

Memory systems encode, consolidate, and retrieve experience in a continuous cycle.

Within each process, we can further classify systems in terms of whether it's done in an open-loop or closed-loop. In [control theory](https://fbsbook.org/), closed-loop systems act, measure their outputs and adjust their inputs to reduce errors. Open-loop systems are more rigid: they act on commands and models without adjusting to feedback.

Open-loop versus closed-loop control. Top row, open-loop: a goal enters a Controller, the harness or agent, which acts on a Process, the memory system, to produce a result, with no feedback path. Bottom row, closed-loop: the result is measured and fed back to a summing junction with the goal, producing an error signal that the Controller acts on.

Open-loop systems act without observing outputs; closed-loop systems feed error back to adjust.

### Encoding experience

The goal of encoding is to extract information from experience into a representation that reduces uncertainty during an _unknown_ future task. The following diagram shows this in the context of a typical agent loop.

Encoding in an agent loop. The user message and recent turns from History enter Context, the Agent answers, and each turn is appended to History. Memory is updated by extraction from History outside the loop or by the agent's write tool within the loop.

Encoding writes experience to memory via background extraction or an in-loop write tool.

The major forms of memory stores are vector embeddings, graphs and ontologies, or summaries and notes. Open-loop systems use conditions and handcrafted domain models to decide when to write to the memory store. Mem0, Supermemory, and [Mastra](https://mastra.ai/docs/memory/observational-memory) are examples.

[Supermemory](https://supermemory.ai/docs/concepts/graph-memory) batches multiple turns asynchronously by default, allowing for an optional per turn extraction. Extracted facts are encoded into temporal graphs. In [Mem0](https://arxiv.org/abs/2504.19413), the harness sends every new turn to an extraction model that distills them into atomic facts, which are embedded into a vector store.

Mem0 architecture: at test time, the user message triggers a vector search over extracted facts and injects top-k matches into context. At ingest time, an LLM extracts, updates, or deletes isolated facts from conversation turns into the vector store, discarding surrounding context.

Mem0 extracts standalone facts at ingest time and injects top-k vector matches at query time.

Compaction could be viewed as a form of memory encoding too. It triggers at context window boundaries and extracts goal-relevant information from one context window into the next.

Two context windows side by side. The left window is full: six older chunks above two recent tail chunks. After compaction, the right window holds one summary chunk at the top, the same two tail chunks below it, and empty space for new turns.

Compaction summarises older turns, keeps the recent tail, and frees window space.

In contrast, closed-loop systems use the agent to update information in the memory store through tool calls. It comes with variable costs and latency since it adds inference compute within a turn.

In practice, systems like Claude, Codex and Letta use a hybrid approach. During latency-sensitive tasks, agents use general shell and file tools to make small closed-loop updates to their memory stores. In idle time between interactions, deeper consolidation and cleanup cycles run as open-loop background processes.

### Consolidating experience

The goal of consolidation is to improve an existing encoded memory representation to optimise retrieval during an _unknown_ future task. Notice the contrast with encoding which was focused on extracting information.

Consolidation between sessions. Below the session boundary during idle sleep time, a Consolidator reads existing Memory and past History logs, resolves contradictions, and writes back an updated Memory store.

Idle-time consolidation reads existing memory and past logs to write back a refined store.

As a nod to its parallels in the brain, researchers from Letta introduced the term [sleep time compute](https://arxiv.org/abs/2504.13171) to describe this process.

Claude, Codex, and Letta use different variations of memory consolidation. For example, Claude managed agents use idle periods between interactions to reflect on the past and update their memory store, a process they described as dreaming. Their [blog](https://www.anthropic.com/research/components-of-agent-memory) gives a great write-up about their approach and findings.

[Codex](https://github.com/openai/codex/tree/main/codex-rs/memories) asynchronously summarises idle past sessions into markdown files in a `/memories` directory, linked to their raw transcripts. The directory also contains a summary markdown file with information about the user and a ranked index to the session summaries.

Codex memory architecture. On the left, a hierarchical index: memory_summary.md points to rollout summaries and skills, which point to raw session transcripts. At test time, memory_summary.md is injected into context alongside the user message and the session state; the agent greps and reads rollout summaries, cites them, and opens a raw transcript only when a summary misses detail, then appends the turn to the sessions database. At sleep time on startup, Phase 1 extracts from idle sessions and Phase 2 consolidates by usage count and git diff back into the rollout summaries.

Codex injects memory\_summary.md and links to rollout summaries and raw transcripts, rebuilt on startup.

In the context of consolidation, a closed-loop system would actively use feedback from historical events to improve the memory store. For example, one approach is to create variations of a memory store and iteratively test them on different checkpoints to score outcomes. The variation that produces the least error is then promoted.

Closed-loop consolidation. The current memory store forks into three variants that merge duplicates, rewrite summaries, or drop stale facts. Each variant replays the same past checkpoints t1, t2 and t3 and is scored by its error. Variant B has the lowest error and is promoted back to become the memory store.

Closed-loop consolidation forks the store, replays past checkpoints, and promotes the lowest-error variant.

### Retrieving experience

The goal of retrieval is to find task-relevant information from the past to reduce uncertainty for a _known_ query.

Retrieval in an agent loop. The user message and recent turns from History enter Context, the Agent answers, and each turn is appended to History. The harness looks up Memory with the user message and injects matches into Context. The Agent can also query Memory or History directly through tools.

Retrieval either injects memory via the harness or queries memory and raw history through tools.

Open-loop systems retrieve information without responding to feedback. For example, Mem0 searches the store using the current query and injects `top_k` matches into context. Mastra's observational memory and compaction are other examples where the harness summarises history and pushes it into context without feedback.

In contrast, [Tardigrade's log library](https://tardigrade.sh/docs/libraries/log) uses a closed-loop retrieval approach. It lets an agent query its own event log and run FTS5 search on events until enough task-relevant information is gained. This design will be discussed in greater detail in the setup section.

Letta is another great example of a closed-loop system. In addition to getting context from a git backed memory store using shell tools, Letta agents can directly modify their system prompt by editing markdown files within the designated `/system` directory.

Letta's memory directory holds pinned /system files and on-disk /notes files. Every turn, the /system files are copied into the top of the context as the system prompt, above the conversation turns. The agent reads a note into its turns on demand with grep and read, and pins a note by moving it into /system.

Letta pins /system files into the prompt every turn and reads /notes from disk on demand.

### Summary

| System | Store | Encoding | Consolidation | Retrieval |
| --- | --- | --- | --- | --- |
| **Compaction** | Summary checkpoint | Open-loop (context-limit summary) | None | Open-loop (prepended summary) |
| **Mastra** | Dated summary | Open-loop (`observer`) | Open-loop (`reflector`) | Open-loop (prepended summary) |
| **Mem0** | Atomic fact vectors | Open-loop (per-turn extraction) | None | Open-loop (`top_k` search) |
| **Supermemory** | Facts + temporal graph | Open-loop (batched extraction) | Open-loop (background dreaming) | Open-loop (profile + hybrid search) |
| **Codex** | Summaries + raw transcripts | Open-loop (idle rollout summaries) | Open-loop (root-session index) | Hybrid (open-loop summary + closed-loop reads) |
| **Letta / Claude** | Git files or linked wiki | Closed-loop (shell / file tools) | Open-loop (sleep / dreaming) | Closed-loop (pinned files + agentic search) |
| **Raw logs** | Immutable event log | None (append-only) | None | Closed-loop (agentic FTS5 + SQL) |

## Experimental setup

### Memory system

For our research, we were interested in finding how much engineering a memory system needs. If the bitter lesson were to hold true, simpler systems that use more of model capabilities should outperform hand-crafted ones.

In this direction, we tested a memory system without any encoding or consolidation step. For retrieval, we let the agent run SQL queries and FTS5 search on its own event logs. The complete code for our setup can be found [here](https://github.com/clavia-labs/agent-memory-benchmarks).

A cycle of three nodes with no encoding or consolidation. The event log keeps every turn verbatim. The agent retrieves from it with SQL and FTS5 queries into context, acts, and each turn is appended back to the event log.

Raw-log setup: no encoding or consolidation, only closed-loop SQL and FTS5 retrieval over the log.

We used two main variations of the system, depending on the benchmark we tested against. Some of the benches used context across sessions, while others were within a single session.

For benchmarks that used context from across sessions, the agent had a [Tardigrade library](https://tardigrade.sh/docs/concepts/libraries) that gave it access to all past sessions. It exposed four tools:

| Tool | Description |
| --- | --- |
| `sessions_list` | List past sessions with IDs, dates, and turn counts, with optional date filtering. |
| `sessions_search` | Run SQLite FTS5 full-text search across all past sessions, returning ranked snippets with session IDs and turn indices. |
| `sessions_read` | Read a verbatim window of turns (`fromSeq` to `toSeq`) directly from a single session's SQLite database. |
| `sessions_query` | Run read-only SQL queries against the global sessions index (`sessions` and `turns` tables). |

Tardigrade multi-session architecture: the user message enters the current session context, which feeds the agent. Past sessions are stored separately, each an immutable sqlite log with FTS5. The agent calls the sessions library (sessions_list, sessions_search, sessions_read, sessions_query) to read across all past sessions read-only. At session end the current session is appended as a new past session.

Multi-session setup: each session is an immutable log queried with four session tools.

For benchmarks that used context from within a single session, the agent used the [`log` library](https://tardigrade.sh/docs/libraries/log), which exposes three tools. In both variations, the search tool lets the agent run FTS5 search on the event log and the query tool lets the agent run SQL queries.

| Tool | Description |
| --- | --- |
| `describe` | Inspect event types, field schemas, and sample records in the event log. |
| `search` | Run SQLite FTS5 full-text search across events in the log, returning ranked snippets. |
| `query` | Run read-only SQL queries directly against the event log. |

Tardigrade log architecture: the user message and recent turns from the durable SQLite event log enter the context window, which feeds the agent. The agent calls the log library to describe, search and query the event log read-only, and appends each turn back to the log. There is no sleep-time pass.

Single-session setup: one durable event log queried with describe, search, and SQL.

We modelled our dreaming setup after Anthropic's approach: after every task, and before the next task, we ran a reflection loop to let a dreaming agent create notes and wiki using the event log and task feedback.

| Tool | Role | Description |
| --- | --- | --- |
| `wiki_list` | Both | List wiki page titles and summaries. |
| `wiki_read` | Both | Read a markdown wiki page along with its links and journal source citations. |
| `wiki_search` | Both | Search wiki pages using SQLite FTS5 full-text search. |
| `wiki_links` | Both | Browse outgoing links and backlinks for a wiki page. |
| `wiki_note` | Task agent | Attach a short note to a journal event for the dreaming agent to revisit. |
| `wiki_notes` | Dreamer | Read notes attached to journal events across a sequence range. |
| `wiki_write` | Dreamer | Create or replace a wiki page with links and journal source citations. |
| `wiki_set_index` | Dreamer | Publish the ordered list of top-level topic pages injected into context. |

Log plus wiki setup: each task enters the agent, which appends to and searches the event log and produces feedback. After each task, a reflection step reads the event log and the task feedback and writes notes into a wiki, which the agent reads on the next task. The log only setup is the same loop without the reflection step and the wiki.

Log + wiki adds an after-task reflection pass that updates a wiki for the next task.

### Benchmarks

Drawing from cognitive science, we classify memory tests into recall and transfer. Recall tests whether an agent can retrieve information from past events verbatim, while transfer tests whether it can apply general rules or concepts learned from those events to a new situation.

Memory benchmarks typically provide history from user-assistant conversations or agent task trajectories and evaluate recall or transfer over that past. For this research, we chose five benchmarks spanning different history types, sizes, and tests:

| Benchmark | History | Size / Scope | Tests | Setup |
| --- | --- | --- | --- | --- |
| **[DolphinBench](https://github.com/mem0ai/dolphinbench)** | Conversations | 600 tasks (~500K tokens) | Recall & preference transfer | `log` |
| **[LongMemEval V1](https://arxiv.org/abs/2410.10813)** | Multi-session conversations | S (~115K) & M (~1.5M), 500 Qs each | Episodic recall | `sessions` |
| **[LongMemEval V2](https://arxiv.org/abs/2605.12493)** | Web & enterprise trajectories | Small (451 Qs, with screenshots) | Semantic & procedural recall | `sessions` |
| **[BEAM](https://arxiv.org/abs/2510.27246)** | Long conversation threads | 100K, 500K, 1M, 10M tokens | Long-horizon recall | `log` |
| **[Continual Learning Bench](https://github.com/pgasawa/continual-learning-bench)** | Stateful SQL trajectories | 40 episodes (`database_exploration`) | Cross-session transfer | `sessions` (+ `wiki` arm) |

We tuned our prompts for BEAM-100K, 500K, 1M using 20 questions from the BEAM-100K dataset since the grading rubrics are non-obvious from the questions. We found this to be consistent with how other systems run their benchmarks.

To compare how scores vary with model intelligence, we ran this across three models within OpenAI's frontier model family: GPT-6.1 Sol, GPT-6.1 Terra, and GPT-6 Luna. For [Continual Learning Bench](https://github.com/pgasawa/continual-learning-bench), we also included Anthropic's frontier model family: Opus 5.5, Sonnet 5.5, and Haiku 5.5 to compare our results against [Anthropic's](https://www.anthropic.com/research/components-of-agent-memory).

An example of a task from DolphinBench, which tests recall and transfer of preference, looks like this:

A DolphinBench task. Morgan's history holds 3,400 sessions and about 500K tokens. On January 9, 2023 Morgan mentions still doing Blue Bottle if out early enough. On September 14, 2026 the test asks: I'm out early, please order one small latte for pickup. The agent recalls the old message and calls place_order with restaurant Blue Bottle, which the grader checks.

DolphinBench test 001: a passing remark from 2023 determines the place\_order restaurant in 2026.

An example of a task from Continual Learning Bench, which tests transfer of knowledge across sessions, looks like this:

A Continual Learning Bench task. Question 2 of 40 asks for the median price of electronics in dollars. The agent spends four exploratory queries on an unknown SQLite schema, computes the median of prc_usd, and is graded incorrect: 20.92 against 21.99. Question 18 asks for the average listed price of electronics in dollars. The agent recalls the earlier session and answers with one query, AVG(prc)/100.0 from items_g2, which is graded correct at 96.23.

CL-Bench (GPT-6.1 Terra): schema exploration in Q2 transfers to a one-shot answer in Q18.

## Results

### Agentic search beats specialised systems

Letting an agent run SQL queries and FTS5 search over raw event logs sets the Pareto frontier on cost and accuracy, beating or matching both bare in-context learning (ICL) and specialised memory systems.

On DolphinBench, using the leaderboard's GPT-5.6 Luna model, the raw-log approach scores 85.7% at $4.73, beating Graphon (84.0% at $11.84) at less than half the cost and outperforming memory stores like Mem0 (70.7% at $96.21) at a twentieth of the cost. It also leads LongMemEval V1 (94.6% on S, 92.2% on M) and all four BEAM context sizes up to 10M tokens.

On LongMemEval V2, our system scores 79.8%, close behind AgentRunbook-C at 81.2%, which also uses agentic search over raw transcripts (`grep` over files rather than SQL over events).

DolphinBench: Tasks passed (of 600) against Total run cost, log scale

DolphinBench (600 tasks, GPT-5.6 Luna high effort, GPT-5.6 Sol judge, $0 ingest). Graphon V1 is self-reported.

Sources: [Graphon V1](https://github.com/mem0ai/dolphinbench/pull/12) · [Built-in](https://github.com/mem0ai/dolphinbench/tree/main/results/hermes/gpt-5.6-luna/builtin) · [Hindsight](https://github.com/mem0ai/dolphinbench/tree/main/results/hermes/gpt-5.6-luna/hindsight) · [Mem0](https://github.com/mem0ai/dolphinbench/tree/main/results/hermes/gpt-5.6-luna/mem0) · [Honcho](https://github.com/mem0ai/dolphinbench/tree/main/results/hermes/gpt-5.6-luna/honcho) · [Supermemory](https://github.com/mem0ai/dolphinbench/tree/main/results/hermes/gpt-5.6-luna/supermemory)

### Agentic search scales with intelligence

Holding all else constant, scores improve with model capability across every benchmark. On DolphinBench, moving from GPT-6 Luna to GPT-6.1 Terra and GPT-6.1 Sol lifts accuracy from 87.2% ($2.47) to 90.5% ($20.32) and 93.8% ($36.38), beating bare 500K in-context learning at every model tier for roughly a tenth of the cost.

Raw logs (Tardigrade)Bare ICL (500K in-context)

DolphinBench model scaling curve for raw logs vs bare ICL

DolphinBench scaling (600 tasks, high effort, GPT-5.6 Sol judge). Raw logs beat bare ICL at ~8-10x lower cost.

The advantage of stronger models increases as context size grows. Moving from GPT-6 Luna to GPT-6.1 Sol adds +6.4 points on BEAM-100K, +9.9 points on BEAM-1M, and +13.8 points on BEAM-10M (53.2% to 67.0%), and grows from +8.8 points on LongMemEval V1-S to +10.8 points on V1-M. Stronger models are better at writing SQL queries and this translates directly into recall scores.

BEAM (100K to 10M)LongMemEval V1 (S to M)DolphinBench (500K)

Accuracy gain from GPT-6 Luna to GPT-6.1 Sol on raw logs versus history size in tokens. On BEAM, the gain widens from +6.4 points at 128K tokens to +9.9 at 1M and +13.8 at 10M. On LongMemEval V1, it widens from +8.8 at 115K to +10.8 at 1.5M. On DolphinBench at 500K, the gain is +6.6 points.

Raw-log accuracy gain from GPT-6 Luna to GPT-6.1 Sol by history size (+6.4 to +13.8 on BEAM, +8.8 to +10.8 on LongMemEval V1).

### Dreaming adds no gain over logs on strong models

On Continual Learning Bench's `database_exploration` suite (40 stateful SQL episodes with a mid-run schema migration), raw logs alone roughly double the stateless baseline on frontier models, lifting mean reward from 0.422 to 0.768 on Opus 5.5 and from 0.282 to 0.727 on GPT-6.1 Terra.

Adding sleep-time wiki consolidation helps smaller and mid-tier models (+0.227 on Sonnet 5.5, +0.134 on Haiku 5.5, and +0.118 on GPT-6 Luna), reduces to +0.039 within run-to-run spread on GPT-6.1 Sol, and disappears on the strongest models (-0.004 on GPT-6.1 Terra and -0.011 on Opus 5.5). Wikis act as a scaffold for weaker models, while stronger models reconstruct what they need better from the raw event log.

CL-Bench database_exploration mean reward. Opus 5.5: stateless 0.422, raw logs 0.768, raw logs plus wiki 0.757. GPT-6.1 Terra: stateless 0.282, raw logs 0.727, raw logs plus wiki 0.723. GPT-6.1 Sol: stateless 0.368, raw logs 0.676, raw logs plus wiki 0.715. GPT-6 Luna: stateless 0.197, raw logs 0.442, raw logs plus wiki 0.560. Sonnet 5.5: stateless 0.350, raw logs 0.407, raw logs plus wiki 0.634. Haiku 5.5: stateless 0.216, raw logs 0.293, raw logs plus wiki 0.427.

CL-Bench database\_exploration (40 SQL episodes, mid-run schema migration, medium effort). Means over 5 runs (3 for Sonnet 5.5 raw logs); whiskers show min-max.

## Discussion

### Deferring compression until query time

Encoding and consolidation in memory systems compress raw events into a store, aiming to reduce uncertainty in future queries during retrieval. However, this approach loses valuable information by trying to guess future queries.

In contrast, agentic search over an event log defers compression of information until query time. As model capabilities increase, they get better at finding task-relevant information directly from the raw logs.

For example, one of the tasks in Continual Learning Bench involves searching a database of a store inventory to find the mean deviation of electronics price. The trap is that the relevant table has three price columns after migration: `prc`, `prc_usd`, and `prc_v2`.

Sonnet 5.5, even with logs and dreaming wiki, uses four DB queries and gets the wrong answer. Its notes hadn't saved the correct column to look at post-migration for this particular query and it resorts to guessing a wrong answer.

Meanwhile Opus 5.5 with raw logs gets the answer in a single query. It searches for "electronics price" in the event log, spots `items_g2` and `prc_v2` around event positions 67-68. Then it runs a query (`"SELECT ... FROM events WHERE position >= 76 OR record LIKE '%prc_v2%'"`) to read the exact post-migration tail. After that it gets the right answer in a single DB query:

sql

```sql
SELECT
   COUNT(*),
   AVG(prc_v2) / 100.0 AS avg_d,
   AVG(ABS(prc_v2 - (SELECT AVG(prc_v2) FROM items_g2 WHERE prc_v2 > 0))) / 100.0 AS mad
 FROM items_g2
 WHERE prc_v2 > 0;
```

Letta's [sleep time compute paper](https://arxiv.org/abs/2504.13171) noticed similar results. They found that offline pre-computation of a memory store helped most when queries were predictable from context. When queries are hard to predict, they conclude that test-time compute is preferable. They also found that on Stateful GSM-Symbolic and on their agentic SWE-Features benchmark, standard test-time compute over raw context outperformed pre-computed stores when given higher test-time budgets.

### Maximising the epistemic value of search

Does this mean we do not need memory systems at all? While letting a model search the event log for every query might in principle lead to better performance, it might not be practical for all tasks. For user-facing applications where latency matters, we often want less inference compute within turns.

[Active inference](https://doi.org/10.1080/17588928.2015.1020053) gives us a useful framework for thinking about memory systems and optimising them. Epistemic foraging refers to the active search for information in closed-loop systems (like agentic search) to reduce uncertainty about the world. Epistemic value is the expected reduction in task-related uncertainty afforded by a given action.

The goal of a memory store is to maximise the epistemic value of search over an event log. There are two ways to do this: eliminate search hops for frequently accessed information by caching it, and reduce the hops needed for everything else by increasing information scent.

#### Memory as a cache over past events

One way to reduce the cost of searching events is by caching frequently accessed information. This could be viewed as a materialised view of a frequent search that affords zero hops to find relevant information.

For example, take the case of a personal assistant that handles a user's day to day tasks. Knowing where the user stays might be useful information possibly revealed through conversation events.

It is expensive to always search the event log for any future task that requires the user's location (e.g., setting the timezone when booking a meeting). In this case, the user's location could be cached with reference to the events where this information was derived from and stored within the context window.

Memory as a cache. In the event log, the user mentions moving into a Lisbon flat on March 3 and the tram up to Alfama on March 9, among thousands of other events. The location Lisbon, timezone Europe/Lisbon, is cached in context with references to seq 1042 and 1187. When the user later asks to book a meeting with Morty at 10am, the agent reads the cached location and calls book_meeting with the Europe/Lisbon timezone without searching the log.

Cached location with log references avoids re-searching the event log on later bookings.

When a new event contradicts something stored in cache (e.g., user moves to new location), it could be invalidated and linked to the new event. This design also allows for more sophisticated patterns like invalidating certain information when an event happens (e.g., invalidate after a certain time period).

A similar bind is observed in the transformer architecture. Linear attention layers compress past tokens into a fixed-size state matrix before future queries are known. Full self-attention keeps the full KV history and waits until a query arrives to attend over it. Hybrid models like [Kimi K3](https://arxiv.org/abs/2607.24653) use linear attention for speed, backed by full attention layers for exact recall.

#### Memory as an index over past events

Information scent refers to proximal cues that a searcher can use to find information they want. High information scent reduces the cost of information by reducing the number of hops it takes to reach it. Information scent also prevents the class of problem where an agent gives up search too early.

A square foraging field with sparse grass and a rich patch in the top right, with scent contours spreading out from the patch. Without scent, the forager wanders for eight hops and gives up before reaching the patch. Following the scent, it reaches the patch in three hops.

Without scent, the forager wanders eight hops and gives up (grey); with scent, it arrives in three (blue).

FTS5 search snippets, query results, and table names are examples of information scents. In addition to these, summaries of logical episodes in the event logs could also act as an index. Codex's hierarchical organisation of a memory summary and session summaries linked to raw sessions is an example of this approach.

#### A bitter-lesson friendly memory system

We propose a design for a memory system that's built as a hierarchy of derived views over an immutable event log. Notice how it mirrors a computer's memory hierarchy from fast, small CPU caches down to RAM and disk.

**L0 (Hot Cache)**: Materialised views, zero hop. Sized by access frequency.

**L1 (Index)**: High scent pointers into the event log, one hop.

**L2 (Event Log)**: Lossless source of truth, unlimited capacity.

A three-tier memory system. The agent reads from L0, a hot cache of materialized values with zero hops, sized by access frequency; from L1, an index of high-scent pointers into the log, one hop away; and from L2, the event log, a lossless source of truth with unlimited capacity. L1 pointers resolve into L2.

Three-tier hierarchy over an immutable event log: each tier down holds more and costs one more hop.

This essay doesn't go deeper into an implementation of this approach and how it performs. That will be for a future one.

## Conclusion

If Nolan's Shelby had access to every single frame of his life recorded and stored as a video, he might have been better off searching the recordings to accomplish his goals.

In designing memory systems for agents, we've carried over some of the implicit constraints of biological systems, which are resource constrained and organised to make the most of available space. Raw sensory events are ephemeral and can't be accessed again. Hence, every event has to be encoded in a compressed form, decoded and consolidated later.

The same constraints don't apply to computers, where we have practically unlimited storage space for events within an agent's lifetime. Memory systems should focus on reducing the cost of search over an immutable event log.

**ps:** If you're building or evaluating agent memory systems and want to run custom benchmarks over your own tasks and traces, try [Hatchery](https://hatchery.build/).
