# Total Recall: The Context Window as a Cache Over the Session Record: v7.4 → v7.5

From v7.4 (2 Jun) to v7.5 (2 Jun): 6,677 words to 6,702 words, 59 words in new or rewritten paragraphs and 34 taken out, 4 paragraphs changed.

## Change note of v7.5

**Wording only; one section renamed to task-conditioned retrieval**

Wording fixes. Section 4 is renamed "Task-Conditioned Retrieval Priority", and a few sentences in the abstract, the formal derivation and the cost analysis are made plainer.

## Changed paragraphs

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

### Abstract

Persistent LLM agents must preserve precise strings, causal chains, and decision rationales across sessions that routinely exceed context limits. The industry-standard approach — narrative compaction — replaces this high-resolution state with lossy prose summaries, creating an irrecoverable "only copy" failure. We present **Total Recall**, a lossless, event-sourced memory architecture that treats the context window as a managed cache over a durable store. Instead of summarizing, Total Recall evicts history via **pointer-based compaction** — inserting compact time-range markers with topic hints and retrieval directives — while making all evicted content recoverable through a `recall(query)` tool. Retrieval is **task-conditioned**: injection depends on the active task and expected future needs, not just embedding similarity. To keep total memory bounded along both axes — the in-context cache *and* the long-term store — Total Recall adds a **write-reconciliation** step that classifies each candidate memory as ADD, UPDATE, DELETE, or NONE, so the working set stays bounded while the audit log stays append-only and complete. The **TRACE** production implementation validates these [-claims: a-] {+claims. Its+} full automated test suite passes with zero [-failures;-] {+failures, and controlled benchmarks show+} **100% needle-in-haystack recall** under forced compaction versus 0% for [-truncation;-] {+truncation, and+} **94% exact-match recall at 2-hop** versus 4% for narrative compaction and 36% for MemGPT-style [-paging; sub-linear compaction-] {+paging. Compaction+} latency {+is sub-linear,+} on the order of [-milliseconds;-] {+milliseconds,+} and months of production operation indexing thousands of real emails [-with-] {+recorded+} zero lossless-invariant violations.

### 4. Task-Conditioned Retrieval Priority

## 4. [-Task-Aware-] {+Task-Conditioned+} Retrieval Priority

### 4.1 Formal Derivation

This objective is combinatorially [-hard (subset-] {+hard: subset+} selection under a budget constraint is NP-hard in the general [-case).-] {+case.+} We approximate it by assuming marginal contributions are roughly independent — a submodularity [-assumption. This-] assumption [-is violated-] {+that lets a greedy selector run in near-linear time. The assumption breaks+} when events are strongly [-complementary (for example,-] {+complementary:+} a cryptographic key split across two events, or a bug symptom paired with [-a-] {+the+} configuration [-change). We acknowledge this limitation: in practice, the-] {+change that caused it. The+} greedy approximation works well for the common case where most events contribute [-independently, but complementary-event retrieval-] {+independently; co-retrieving strongly complementary events+} remains an open problem [-for future work.-] {+(§11).+}

### 7.2 Cost-Latency Analysis

Narrative compaction fills the context window continuously, incurring per-token inference costs proportional to the full window on every turn. Total Recall's push pack occupies a [-small-] {+small, fixed+} fraction of the budget [-(~2K-] {+— roughly 2K+} tokens in typical [-sessions), with-] {+sessions — and an occasional+} pull [-requests adding ~10K-] {+adds on the order of 10K+} tokens [-occasionally.-] {+only on the turns that need evicted detail.+} The exact savings depend on model pricing, window size, and session length, but the structural advantage is [-clear:-] {+invariant to all three:+} Total Recall's [-context-] {+per-turn+} footprint is bounded by the push [-pack size rather than growing-] {+pack, while narrative compaction's grows+} monotonically with session length.
