Agent memory = retained cross-session knowledge, reframed as prediction about future needs. A four-layer hierarchy (transcripts → notes → representations → injected context), consolidated by a background "dreaming" pass, lets stronger models convert raw experience into validated rules — raising CL-Bench reward and wiki-task criteria while cutting ~20k tokens/question.
An agent that treats every session as a cold start repeats mistakes, re-derives known facts, and cannot accumulate expertise. Naive logging fails in the opposite direction: an agent that records everything drowns in stale, redundant notes whose maintenance cost grows as the environment changes. The objective is not storage but salience — deciding, at write time, which observations a future and unknowable session will actually need. This is a prediction problem under uncertainty: the write happens now, the payoff is realized (or not) in a session that does not yet exist.
The article scopes "memory" narrowly to knowledge retained between sessions from user interactions and assigned tasks, explicitly excluding weight updates, in-context learning, and context compaction. That scoping matters: it isolates memory as a data/representation strategy layered on a frozen policy, not a training-time intervention.
A layered knowledge store plus a background consolidation process:
核心技术壁垒 (the single hardest-to-replicate insight): memory value is gated by model capability, and inversely gated by rule rigidity. The same memory substrate yields +0.034 reward for a weak model and +0.264 for a strong one; imposing a prescriptive rule ("record only failures") costs a strong model −0.234 while barely touching a weak one. The hard-to-copy asset is therefore not the wiki format or the dreaming loop — those are mechanically simple — but the calibration that lets a frontier model self-direct salience from loose guidance. A replicator with a weaker base model cannot recover the headline numbers by copying the pipeline.
No original figures were published with an extractable asset, so the hierarchy and the dreaming loop are redrawn below.
The vertical axis is an abstraction gradient: each upward step trades fidelity for retrievability, and each step is also a risk step — an error promoted to injected context is paid on every future session. Dreaming is the only edge that reads downward against transcripts, which is why it is the mechanism that can un-poison the upper layers.
无形式化作者证明 — 仅实证.
This is an engineering research article; it states no theorem, convergence proposition, or sample-complexity bound. All claims are supported by benchmark deltas rather than analysis. What would have strengthened it:
Given the absence of formalism, the load-bearing evidence is the §5 data, which must be read as association, not guarantee.
| Model | Baseline | +Memory | Δ |
|---|---|---|---|
| Opus 5.5 | 0.655 | 0.838 | +0.183 |
| Sonnet 5.5 | 0.644 | 0.833 | +0.189 |
| Opus 5 | 0.564 | 0.828 | +0.264 |
| Opus 4.7 | 0.383 | 0.700 | +0.317 |
| Sonnet 5 | 0.306 | 0.610 | +0.304 |
| Sonnet 4.6 | 0.330 | 0.364 | +0.034 |
The weakest model (Sonnet 4.6) barely moves (+0.034) — it read memory files <50% of the time and generated untested theories. Mid-tier models show the largest absolute lift because they have headroom and the behavioral discipline to use notes (Sonnet 5 independently read memory 9/10 times, marked confirmed answers, wrote corrections). Top models start high and still gain. The takeaway is not "memory helps proportionally to capability" but "memory requires a minimum capability threshold to pay off at all."
| Condition | Mean Reward |
|---|---|
| Sonnet 4.6 baseline | 0.330 |
| Sonnet 4.6 + memory + refined instructions | 0.641 |
| Opus 4.7 + memory | 0.700 |
| Opus 5 + memory | 0.828 |
Refined, task-specific instructions nearly doubled the weak model's reward (0.330 → 0.641) — more than generic memory alone delivered. Yet the rule "record only failures" subtracted value, and subtracted it most from the strongest model:
| Model | Loss from "record only failures" |
|---|---|
| Opus 5 | −0.234 |
| Opus 4.7 | −0.150 |
| Sonnet 4.6 | −0.020 |
This is the sharpest single result: rigidity is a tax that scales with the model's own judgment. Guidance > rules, increasingly so at the frontier.
| Metric | Sonnet 3.7 | Fable 5 |
|---|---|---|
| Memory files | 413 | 10 |
| Folders | 225 | 2 |
| Total characters | 977,930 | 43,406 |
| Badges earned | 1 | 4 |
A ~22× smaller memory footprint produced 4× the game progress. Fable 5 stored only off-screen strategic knowledge (global.md dashboard, locations/ nav plans, gameplay/ learned rules like varying catch timing after failures) and ignored redundant state the game already displayed. Volume is anti-correlated with usefulness here.
| Condition | Ledge falls | Reached Cerulean |
|---|---|---|
| Raw memory (uncorrected) | 3 | No |
| Memory + dreaming | 0 | Yes |
| No memory | — | No |
A single false note (wrong PokéCenter location) caused repeated failures; raw memory was worse than useful until dreaming cross-referenced the transcript and repaired it. This is the clearest demonstration that an unverified upper layer is a liability, and that the downward-reading dreaming edge is what makes the hierarchy safe.
| Condition | % Criteria Met |
|---|---|
| Wiki alone — 2 dreaming sessions | 13% |
| Wiki alone — 128 dreaming sessions | 48% |
| Wiki + search (early) | 54% |
| Wiki + search (mature wiki) | 61% |
| Search tool only | 53% (flat) |
Search-only is a flat baseline (53%) that does not improve with time; the wiki grows (103 pages/766 links → 222 pages/12,893 links over 2→128 dreaming passes) and, combined with search, overtakes it while saving ~20k tokens/question. But the advantage is task-dependent: on Harvey LAB Merger Questions (multi-doc synthesis) wiki hit 87% vs. 73% search; on LAB Brief Generation (single-doc retrieval) wiki showed no advantage, and one LAB task produced a 203 KB wiki over a 115 KB corpus — abstraction failure.
| # | Claim | Support within the article |
|---|---|---|
| 1 | Memory is a prediction problem, not a storage problem. | Notes are written now for an unknowable future session; the human hippocampus→neocortex consolidation metaphor frames it. |
| 2 | Therefore salience (what to keep) dominates capacity (how much to keep). | Pokémon Red: 22× less memory, 4× more badges; over-logging created maintenance overhead as state changed. |
| 3 | Salience quality rises with model capability. | CL-Bench: weak model gains +0.034 and reads memory <50% of the time; stronger models gain 0.18–0.32 and exhibit confirm/correct behaviors. |
| 4 | Capable models want guidance, not rules. | "Record only failures" costs Opus 5 −0.234 but Sonnet 4.6 only −0.020; refined instructions nearly double the weak model. |
| 5 | Unverified upper layers are a liability without a correction mechanism. | Mt. Moon: one false note → 3 ledge falls and task failure under raw memory. |
| 6 | Dreaming supplies that mechanism by reading downward against transcripts. | Mt. Moon with dreaming: 0 ledge falls, task completed; wikis repair dead links and fill gaps across passes. |
| 7 | Structured representations beat flat search only when tasks need cross-document synthesis. | Merger (synthesis) 87% vs 73%; Brief (single-doc) no advantage; one wiki exceeded its corpus and became net-negative. |
[实现未公开] — the article is a research narrative; CL-Bench 1.0, the Harvey LAB tasks, the Stainless corpus harness, and the dreaming scheduler are described but not released as code. The one concrete, inspectable implementation referenced is Claude Code auto-memory, which operationalizes the injected context layer:
MEMORY.md at session start.核心技术壁垒 (reprise): the replicable parts — a four-tier store, a wiki, a MEMORY.md index, a nightly consolidation job — are all straightforward. What does not transfer is the capability-calibrated self-direction: the finding that a frontier model, given loose guidance, writes better memory than the same pipeline driven by explicit rules, and that this gap widens with model strength. Anyone reproducing this on a weaker base model will see the Sonnet-4.6 regime (+0.034, ignored files), not the Opus regime.
关键实现细节 (easy-to-miss tricks):
MEMORY.md as a pointer index, not the knowledge body — this bounds the per-session token tax (25 KB cap) while keeping deep knowledge reachable. Naively injecting the full representation would both blow the budget and make every stale entry a recurring cost.