# INSTANT RECALL: Finding What the Agent Already Owns: v7.4 → v7.5

From v7.4 (2 Jun) to v7.5 (2 Jun): 6,684 words to 6,753 words, 265 words in new or rewritten paragraphs and 196 taken out, 25 paragraphs changed.

## Change note of v7.5

**Neighbouring layers described in general terms, not by paper**

The layers around the index are now described by what they do, a storage layer and a reflection layer, and no longer by the names of the author's other papers, so the paper stands on its own. The improvement notes asked for fewer cross-references to the series. The contract between the layers is spelled out: text, time and source in, tuned settings back.

## Changed paragraphs

Marks: [-removed-] {+added+}.

### 1. Introduction

The solution takes its name and its shape from the brain. The human hippocampus is not where memories are stored — long-term memories live distributed across the neocortex. The hippocampus is the brain's *indexing organ*: it knows where every memory lives and how to retrieve it. The clinical evidence is stark. Patient H.M., who had both hippocampi removed to treat epilepsy, retained his old memories intact but could no longer form or retrieve new ones — the store was fine; the index was gone [Scoville & Milner, 1957]. **Instant Recall is our attempt to build the AI equivalent of this biological indexing organ — the layer that makes the difference between *having* memories and being *able to use them*.** It draws the same structural separation: a pre-computed concept index, built offline during a [-Sleep Consolidation-] {+nightly consolidation+} phase, maps anchor vocabulary terms to their nearest memory clusters in embedding space [Teyler & DiScenna, 1986]. The mechanism is pre-computed KNN over sentence embeddings — the hippocampal analogy is architectural (index vs. store), not mechanistic. The index lookup completes in ~50ms before the LLM receives its context window, so the model begins reasoning with relevant memories already in place.

### 1.1 The Three-Layer Memory System

[-### 1.1 The Three-Layer Memory System-]

### 1.1 The Three-Layer Memory System

[-Instant Recall is one layer of a three-paper memory system. Each layer is independently useful; together they compound.-]

### 1.1 The Three-Layer Memory System

[-- **Storage layer (Total Recall; Serra, 2026a).** Persists every interaction as a typed, timestamped event and compacts older events into lightweight pointers — summaries that preserve the essential content while reducing storage by 80–95%. It stores without loss of meaning. - **Retrieval layer (Instant Recall; this paper).** Indexes those pointers and full events alike, making the compaction transparent to retrieval, and surfaces the right chunk in O(1) at inference time. - **Reflection layer (Sleep Consolidation; Serra, 2026e).** A nightly cycle reviews which retrievals succeeded and which failed, then adjusts the index parameters — anchor term selection, importance weights, chunk boundaries — based on observed patterns. The retrieval layer gets better without any code change.-]

### 1.1 The Three-Layer Memory System

[-In one line: the storage layer stores without losing, the retrieval layer recalls in constant time, and the reflection layer refines both. The rest of this paper concerns the middle layer.-]

### 1.1 Where the Index Sits in a Memory Stack

{+### 1.1 Where the Index Sits in a Memory Stack+}

### 1.1 Where the Index Sits in a Memory Stack

{+Instant Recall is the retrieval layer of a complete agent memory stack, and it is designed to interoperate cleanly with two neighbouring layers without depending on either one's internals.+}

### 1.1 Where the Index Sits in a Memory Stack

{+Below it sits a **storage layer**: any mechanism that persists every interaction as a typed, timestamped event and compacts older events into lightweight pointers — summaries that preserve the essential content while reducing storage by 80–95%. The storage layer stores without loss of meaning; Instant Recall indexes its output, whether full events or compacted pointers, so the compaction is transparent to retrieval.+}

### 1.1 Where the Index Sits in a Memory Stack

{+Above it sits a **reflection layer**: a nightly cycle that reviews which retrievals succeeded and which failed, then adjusts the index parameters — anchor term selection, importance weights, chunk boundaries — based on observed patterns. The retrieval layer thus improves without any code change.+}

### 1.1 Where the Index Sits in a Memory Stack

{+The contract between them is narrow: the storage layer must expose, per chunk, a content string, a timestamp, and a source label; the reflection layer reads retrieval outcomes and writes back tuned parameters. Everything in this paper concerns the middle layer — building and serving the index in constant time at inference. The two neighbouring layers are sketched here only enough to define that contract; Instant Recall functions over any store and any reflection schedule that honours it.+}

### 1.1 Where the Index Sits in a Memory Stack

![The [-three-layer-] memory [-system. Storage (Total Recall)-] {+stack. A storage layer+} persists and compacts events into the chunk store; Instant Recall builds and serves the concept index over that store; [-Sleep Consolidation-] {+a reflection layer+} reflects nightly and tunes the index parameters. Each arrow shows what flows between layers.](images/three-layer-system.png)

### 2.2 The Storage and Reflection Layers

[-### 2.2 The Storage and Reflection Layers-]

### 2.2 The Neighbouring Layers Instant Recall Assumes

{+### 2.2 The Neighbouring Layers Instant Recall Assumes+}

### 2.2 The Neighbouring Layers Instant Recall Assumes

{+Two layers bracket the retrieval mechanism, and Instant Recall is engineered against their interfaces rather than their implementations.+}

### 2.2 The Neighbouring Layers Instant Recall Assumes

[-The-] {+A **compaction-based+} storage [-layer [Serra, 2026a]-] {+layer**+} defines persistent agent memory as a [-compaction-based cache eviction system. Raw-] {+cache-eviction system: raw+} events are [-stored in-] {+written to+} an event [-log;-] {+log, then+} a compaction algorithm promotes high-salience content to long-term storage while evicting low-salience [-content. It provides-] {+content into lossy-but-meaning-preserving pointers. Such a layer supplies+} the substrate Instant Recall operates [-on:-] {+on —+} the nightly rebuild consumes [-the storage layer's-] {+its+} event files as {+primary input — but Instant Recall requires only the `(content, timestamp, source)` triple from it, not+} its [-primary input.-] {+eviction policy.+}

### 2.2 The Neighbouring Layers Instant Recall Assumes

[-The identity layer [Serra, 2026b]-] {+An **identity layer**+} addresses agent identity drift across session boundaries [-via-] {+by injecting+} a persona-state structure [-injected-] into every session's system prompt. [-It-] {+That layer+} assumes relevant memories can be retrieved; Instant Recall makes [-that-] {+the+} assumption true [-—-] {+by+} supplying context chunks at every prompt, before the model begins processing.

### 2.2 The Neighbouring Layers Instant Recall Assumes

[-The reflection layer [Serra, 2026e]-] {+A **reflection layer**+} runs a nightly cycle that audits retrieval outcomes and tunes Instant Recall's parameters (§4.10). This is the orchestration boundary: Instant Recall builds and serves the index; the reflection layer decides *how* it should be built next [-time.-] {+time. Each of these layers is treated here exactly as an external dependency would be — by its contract, not its code.+}

### 2.3 Neuroscience Basis

During sleep, hippocampal replay consolidates these indices: recently encoded patterns are reactivated, strengthening links between hippocampal indices and cortical storage sites [Wilson & McNaughton, 1994]. This offline consolidation is what our [-Sleep Consolidation-] {+nightly rebuild+} phase implements.

### 4.1 Overview

- **Offline (nightly [-Sleep Consolidation):**-] {+consolidation):**+} Full rebuild of the concept index mapping anchor terms to pre-ranked memory chunk paths. - **Real-time (incremental updates):** O(|V|) per-write update inserting new chunks into relevant anchor clusters immediately. - **Online (inference):** Detect anchor words in incoming queries; load pre-ranked chunk lists in O(1); re-rank against current query; inject into context.

### 4.2 What Instant Recall Indexes

Instant Recall does not require [-the-] {+any particular+} storage [-layer described in §2.2;-] {+layer;+} it requires only that a memory store expose, per chunk, three things: a content string, a timestamp, and a source label. Any store satisfying that contract — an event log, a flat directory of Markdown files, an email archive — can be indexed. The architecture is store-agnostic by design.

### 4.6 Nightly Consolidation (Full Rebuild)

### 4.6 Nightly [-Sleep-] Consolidation (Full Rebuild)

### 4.8 Importance Scoring

This mirrors how [-the underlying-] {+a well-designed+} event store [-[Serra, 2026a]-] tags content at ingest: decisions and constraints are recorded as high-salience event types, which is exactly what feeds the elevated base salience above.

### 4.12 Low-Confidence Reformulation (Proposed)

The pipeline above assumes one query attempt. Production showed a distinct failure: when retrieval scores are uniformly low (max cosine < 0.5 across all results), the agent accepts the best-of-bad matches as authoritative rather than recognizing that retrieval *failed*. We propose a reformulation gate to close this gap. When max(scores) falls below a confidence threshold **and** the query carries ownership signals ("our", "we", "my", "the [noun] we [verb]"), the gate would (1) extract domain-anchor nouns and re-search on those alone, (2) search explicitly for known project and paper titles, and (3) if still low, broaden to a file-path search — the knowledge may live in a file whose *name* matches even when its *text* does not. This addresses the dominant residual: a 2026-04-01 incident in which the agent searched memory-retrieval content, scored 0.47–0.49 across all results, and accepted the wrong files with no retry. The keyword channel matters here too: a hybrid store weighting vector and keyword search 70/30 can let the BM25 channel rescue a bad embedding match — but only if the indexed text contains the query terms. Papers about "compaction" do not match queries about "retrieval." A complementary proposal is a concept→keyword routing table, built during [-Sleep Consolidation,-] {+nightly consolidation,+} storing 10–20 human-search keywords per project (e.g., [-Total Recall-] {+a storage paper+} → ["memory", "retrieval", "forgetting", "context", "compaction", "eviction", "recall"]) even when those words never appear in the body text. Unlike the signals of §4.9, the reformulation gate and routing table are design proposals, not yet in the live pipeline.

### 7.4 Implementation Status

The reference implementation is TypeScript (ESM, Node 22+), organized around an enhancement module (importance scoring, episodic buffer, deduplication, ~480 lines), a rebuild module (nightly orchestration, anchor extraction, incremental mtime-diff state, ~470 lines), and a co-located unit test suite. The beyond-cosine signals of §4.9 are present in the live schema and ranking path: bi-temporal validity columns {+(`validity_start`, `validity_end`, `ingestion_time`, `superseded_by`)+} and a covering index, {+with a non-lossy supersede routine that closes a prior fact's interval rather than deleting the row;+} a verification-status column with a coverage-mapping batch and a verification-aware [-re-rank,-] {+re-rank applying the ×1.5/×1.2/×1.0/×0.5 multipliers;+} and a `backlinks` table with backlink hydration and a depth-capped k-hop walk on the manager. The low-confidence reformulation gate and concept→keyword routing of §4.12 are designed but not yet wired into the live pipeline. Exact line counts and test totals vary as the code evolves; the architectural claims above are the stable contract.

### References

1. Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. _NeurIPS 2020_. 2. Packer, C., et al. (2023). MemGPT: Towards LLMs as Operating Systems. _arXiv:2310.08560_. 3. Sarthi, P., et al. (2024). RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval. _ICLR 2024_. 4. Collins, A. M., & Loftus, E. F. (1975). A spreading-activation theory of semantic processing. _Psychological Review_, 82(6), 407–428. 5. Teyler, T. J., & DiScenna, P. (1986). The hippocampal memory indexing theory. _Behavioral Neuroscience_, 100(2), 147–154. 6. Squire, L. R. (1992). Memory and the hippocampus: A synthesis from findings with rats, monkeys, and humans. _Psychological Review_, 99(2), 195–231. 7. Wilson, M. A., & McNaughton, B. L. (1994). Reactivation of hippocampal ensemble memories during sleep. _Science_, 265(5172), 676–679. 8. Tulving, E. (1976). Ecphoric processes in recall and recognition. _Recall and Recognition_, 37–73. 9. Mandler, G. (1980). Recognizing: The judgment of previous occurrence. _Psychological Review_, 87(3), 252–271. 10. Yonelinas, A. P. (2002). The nature of recollection and familiarity: A review of 30 years of research. _Journal of Memory and Language_, 46(3), 441–517. 11. MemoryOS. (2024). Mem0: The Memory Layer for Personalized AI. _arXiv:2504.19413_. 12. [-Serra, O. (2026a). Total Recall: Compaction as Cache Eviction in Persistent AI Agent Memory. _Independent Research_. 13. Serra, O. (2026b). Identity Persistence: Persistent Agent Identity Through Structured Persona Maintenance. _Independent Research_. 14. Serra, O. (2026d). Humor Embeddings: Bisociation in Embedding Space for Humor Generation. _Independent Research_. 15. Serra, O. (2026e). Sleep Consolidation: Cross-Session Reflection and Signal Routing for Persistent AI Agents. _Independent Research_. 16.-] Park, J. S., et al. (2023). Generative Agents: Interactive Simulacra of Human Behavior. _UIST 2023_. [-17.-] {+13.+} Zhong, W., et al. (2023). MemoryBank: Enhancing Large Language Models with Long-Term Memory. _arXiv:2305.10250_. [-18.-] {+14.+} Manning, C. D., Raghavan, P., & Schütze, H. (2008). _Introduction to Information Retrieval_. Cambridge University Press. [-19.-] {+15.+} Guu, K., et al. (2020). REALM: Retrieval-Augmented Language Model Pre-Training. _ICML 2020_. [-20.-] {+16.+} Borgeaud, S., et al. (2022). Improving language models by retrieving from trillions of tokens. _ICML 2022_. [-21.-] {+17.+} Xu, X., et al. (2025). A-MEM: Agentic Memory for LLM Agents. _arXiv:2502.12345_. [-22.-] {+18.+} Wu, D., et al. (2024). LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory. _arXiv:2410.10813_. [-23.-] {+19.+} Yan, Z., et al. (2025). Memory-R1: RL-Trained Memory Management for LLM Agents. _arXiv:2505.14075_. [-24.-] {+20.+} Gama, J., et al. (2014). A survey on concept drift adaptation. _ACM Computing Surveys_, 46(4), 1–37. [-25.-] {+21.+} Scoville, W. B., & Milner, B. (1957). Loss of recent memory after bilateral hippocampal lesions. _Journal of Neurology, Neurosurgery & Psychiatry_, 20(1), 11–21.
