v7.7 → v8.0
What changed from v7.7 to v8.0
From v7.7 (29 Jul) to v8.0 (12 Oct): 9,052 words to 8,328 words, 7,976 words in new or rewritten paragraphs and 8,700 taken out, 330 paragraphs changed.
Rewritten as a design paper: session record as truth, window as its cacheA full rewrite; almost every paragraph is new. The new title is "Total Recall: The Context Window as a Cache Over the Session Record".
- Opens with a plain example: a colleague who still knows on Friday what you told them on Monday.
- Narrows the scope to the first stage of memory, keeping. Finding things again is left to other papers.
- New sections: the session record and how entries are named and never edited, how forgetting works with a tombstone, the marker and what it carries word for word, who controls the window (the runtime, a provider's tool, a provider's API), and what each compaction costs.
- The benchmark numbers, the pilot study and the implementation report are gone. The paper now says the design is not built yet and lists the tests that would decide it.
- From the improvement notes: the per-call measurement of the context and one compaction record for every executor became design requirements and tests.
v7.7 · 29 July 2026v8.0 · 12 October 2026
··· 1 unchanged paragraph folded ···
v7.7 · AbstractPersistent 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. Its full automated test suite passes with zero failures, and controlled benchmarks show **100% needle-in-haystack recall** under forced compaction versus 0% for truncation, and **94% exact-match recall at 2-hop** versus 4% for narrative compaction and 36% for MemGPT-style paging. Compaction completes on the order of milliseconds in the tested range, and months of production operation indexing thousands of real emails recorded zero lossless-invariant violations.
removed in v8.0
not in v7.7
v8.0 · AbstractThink of the colleague you trust with a long job. On Monday you tell them the server name, the one command they must never run in daytime, and the fix you already tried. On Friday they still know all three, and if a detail has slipped they look it up in their notes instead of asking you again. We would like to hand an AI agent work that runs for days in the same way.
not in v7.7
v8.0 · AbstractBut an agent reads only what fits in its context window, and when the window fills, something has to leave. Today a model usually writes a summary of the old part and throws the old part away. The summary becomes the only copy, and it keeps the gist while dropping exactly what a long job needs: the exact strings, the cause of a failure, the attempt that did not work, the owner's own words. The agent also often does not own its window: a provider's tool or API decides when to compact, and writes the summary itself.
not in v7.7
v8.0 · AbstractHere we propose Total Recall, a design for the first stage of an agent's memory, keeping. The full session record, every turn word for word, is the ground truth, and the context window is a cache over it. Compaction never deletes: it leaves a small marker that names the evicted range, carries its exact strings and the owner's instructions word for word, and points back into the record, so any line can be read again. Whoever owns the window, the memory layer acts through the owner's own hooks, and it never compacts a copy the model does not read.
not in v7.7
v8.0 · AbstractFor the agent you run, this means an owner's instruction survives every compaction, a hash or a host name from three hours ago can be read back exactly, and the cost of each compaction is priced before it happens. The design is not yet built; we give the tests that will decide whether it works. If it holds, an agent could carry a week of work without ever having to ask what you already told it.
not in v7.7
v8.0 · Abstract**Keywords:** AI agents, agent memory, context window, compaction, prompt caching, session transcript, agent harness.
··· 1 unchanged paragraph folded ···
v7.7 · Architecture Overview: Storage Within a Memory Loop## Architecture Overview: Storage Within a Memory Loop
removed in v8.0
v7.7 · Architecture Overview: Storage Within a Memory LoopTotal Recall is a storage and compaction substrate. It is self-contained, but it is designed to sit inside a larger loop, and the loop matters because two adjacent mechanisms — an index built over the stored pointers, and a nightly process that tunes the storage thresholds — turn durable storage into queryable, self-improving memory. We describe those two mechanisms here only to the extent needed to understand the interfaces Total Recall exposes; their full design is external to this paper.
removed in v8.0
v7.7 · Architecture Overview: Storage Within a Memory Loop
removed in v8.0
v7.7 · Architecture Overview: Storage Within a Memory Loop- **Storage and compaction.** A lossless, append-only event store treated as ground truth, with the context window managed as a cache over it. When context fills, history is evicted via topic-hinted pointers rather than summarized, and writes are reconciled so the working set stays bounded. This is the subject of the present paper. - **Indexing and retrieval.** A navigable index built *over* the compacted pointers — clustering them by topic, scoring them by importance, and serving sub-second lookup. The storage layer's topic-hinted markers are the structured seams this index grips; without them, retrieval degrades to generic full-text search over raw logs. Total Recall's contribution to this layer is the pointer format; the index itself is out of scope. - **Consolidation and self-improvement.** A nightly reflection process reviews the day's retrieval successes and failures, builds episodic summaries, and feeds corrections back — adjusting compaction thresholds and running the deferred write-reconciliation sweep (§8.3). Nightly is the only safe moment to decide a fact is stale, because that requires knowing its downstream outcome. Total Recall supplies the deferred sweep; the reflection policy that drives it is out of scope.
removed in v8.0
v7.7 · Architecture Overview: Storage Within a Memory LoopThe result is a closed loop: storage produces structured pointers, indexing makes them queryable, and consolidation observes how well retrieval worked and re-tunes storage. The rest of this paper specifies storage and compaction; the two adjacent mechanisms appear only where they touch its interfaces.
removed in v8.0
not in v7.7
v8.0 · 1. Introduction## 1. Introduction
not in v7.7
v8.0 · 1.1 Friday's question### 1.1 Friday's question
not in v7.7
v8.0 · 1.1 Friday's questionAn owner and an agent spend an afternoon on a broken certificate on a web server. Early on, the owner gives three things that matter: the path where the certificates live, a commit hash that last worked, and an instruction: never restart the production database during the day. The agent tries a renewal command, which fails with an error about a rate limit, and they leave the key rotation for later. Three hours and many tool calls on, the context window is full.
not in v7.7
v8.0 · 1.1 Friday's questionThe agent's harness compacts. A model reads the first two hours and writes a paragraph: "Worked on the TLS setup; fixed the certificate." The paragraph is accurate and almost useless. The path, the hash, the rate-limit error, the open key rotation and the instruction about the database are gone. Later that evening the agent proposes a database restart to clear a cache, and the owner has to say again what he said at two o'clock.
not in v7.7
v8.0 · 1.1 Friday's questionNothing in this story needs a bad model. The model that wrote the summary did what summaries do. The failure is in the design: the only copy of the afternoon was replaced by a description of it.
not in v7.7
v8.0 · 1.2 Why a bigger window does not settle it### 1.2 Why a bigger window does not settle it
not in v7.7
v8.0 · 1.2 Why a bigger window does not settle itContext windows have grown to a million tokens, so it is tempting to say the problem is going away. Two things stand in the way. First, models do not read long inputs evenly. Detail in the middle of a long context is used less well than detail at the start or end (Liu et al., 2024), and accuracy falls as input grows even on simple tasks (Hong et al., 2025). A full window is a worse window. Second, a long-running agent fills any window. A day of tool output, file reads and logs runs to millions of tokens, and a week does not fit anywhere. So compaction stays, and the question is what it should leave behind.
not in v7.7
v8.0 · 1.3 What summaries lose### 1.3 What summaries lose
not in v7.7
v8.0 · 1.3 What summaries loseA summary keeps the shape of the work and drops its substance. Four kinds of information are lost first, because a summary is written to be short and to read well:
not in v7.7
v8.0 · 1.3 What summaries lose| Kind | Example | Why a summary drops it | |------------|-------------------|-----------------------| | Exact strings | a path, a hash, a host name, an error line | a summary paraphrases; the characters are what matter | | Causes | "it failed because the cron job reset the config" | several steps collapse into "it failed" | | Negative results | "we tried the renewal and it hit a rate limit" | summaries lean toward what worked | | Time anchors | "the deploy at 14:32 succeeded" | times look like noise to a summarizer |
not in v7.7
v8.0 · 1.3 What summaries loseThere is a fifth kind that matters more than the four: the owner's own words. An instruction, a preference or a correction given during the session is the one thing the owner expects never to repeat. In a summary it becomes "the user gave some guidance", or it vanishes.
not in v7.7
v8.0 · 1.3 What summaries loseRepeated compaction makes this worse. When each new summary is written from the previous one, detail erodes at every round. Zhang et al. (2025) name this "context collapse" and show it in agents that rewrite their own context.
not in v7.7
v8.0 · 1.4 Who holds the pen### 1.4 Who holds the pen
not in v7.7
v8.0 · 1.4 Who holds the penThere is a second obstacle, newer and less discussed. In many deployments the agent's runtime does not own the context window. A provider's command-line agent decides when to compact and writes the summary itself. A provider's API may clear old tool results or compact on its servers, and one of them returns the compacted state as an encrypted item the client cannot read (OpenAI, 2026). A memory layer that assumes it builds every model call will compact its own copy of the conversation while the model goes on reading the provider's version. That work changes nothing the model sees.
not in v7.7
v8.0 · 1.4 Who holds the penSo a design for keeping has to say what is kept, where the ground truth lives, and how the memory layer acts when someone else holds the pen.
not in v7.7
v8.0 · 1.5 The claim### 1.5 The claim
not in v7.7
v8.0 · 1.5 The claim**The context window is a cache over the session record, and compaction is eviction from that cache, not rewriting of history.** The full record of the session is kept word for word and never edited; the one exception, a deletion for privacy or poisoned content, leaves a tombstone (§4.4). What leaves the window is replaced by a marker that carries the evicted range's exact strings and the owner's instructions verbatim, and points back into the record. Whoever owns the window, the memory layer acts through that owner's hooks.
not in v7.7
v8.0 · 1.5 The claimThe brain name of this stage, ENGRAM, is the physical trace a memory leaves in neural tissue: the change that makes later recall possible. We use it as a reminder of what the stage is for, a durable trace that outlives the moment, and not as a model to copy.
not in v7.7
v8.0 · 1.5 The claimThe contributions, each with the section that argues it:
not in v7.7
v8.0 · 1.5 The claim1. The session record as ground truth (§4): every turn appended with its author, the owner's words stripped of the harness wrapper, and a stable address; the memory layer indexes the record and never keeps a lossy copy of its own. 2. A marker that is a pointer, not a summary (§5): what it carries word for word, what it reduces to one line with a pointer, what it leaves behind a pointer alone, and the rule that each compaction is written from the record and never from the previous marker. 3. An owner contract (§6): three owners of the window (the runtime, a provider's tool, a provider's API) and what the memory layer does in each, including never compacting a copy nobody reads. 4. A price for compaction (§7): a trigger that reads the call actually sent, and a closed-form break-even that says when an elective eviction pays under prompt caching. 5. Invariants and the tests that decide them (§4.3, §8, §10): every marker resolves; the record has no supersede and no hide, and loses content only through a tombstone.
··· 1 unchanged paragraph folded ···
v7.7 · 1. Introduction — The Compaction Failure Mode## 1. Introduction — The Compaction Failure Mode
removed in v8.0
v7.7 · 1. Introduction — The Compaction Failure ModeAs LLMs evolve from session-scoped chatbots to persistent agents, the memory problem changes qualitatively. The agent must preserve high-resolution task state, long-horizon commitments, tool-grounded evidence, and continuity under context resets — all within a hard token budget. The industry's answer is narrative compaction: summarize old context to free space. This paper demonstrates that narrative compaction is a category error for agentic workloads, presents a principled alternative, and validates it through controlled benchmarks and production deployment.
removed in v8.0
v7.7 · 1. Introduction — The Compaction Failure ModeThe biology offers a useful frame. In the mammalian brain, an *engram* is the physical trace a memory leaves in neural tissue — the durable change in synaptic connections that makes later recall possible. The hippocampus acts as the brain's librarian, deciding during sleep which fleeting experiences get encoded into long-term storage and which are discarded. Total Recall is an attempt to give an AI agent what biology gives every mammal: a durable, compactable memory trace that survives beyond the current conversation, and a principled rule for what to keep.
removed in v8.0
v7.7 · 1.1 Why Narrative Compaction Fails### 1.1 Why Narrative Compaction Fails
removed in v8.0
v7.7 · 1.1 Why Narrative Compaction FailsNarrative compaction — reducing conversation history to an LLM-generated summary — is the default solution in virtually every deployed agent framework. It appears to work: context pressure is relieved, the model continues operating, and summaries preserve the session's narrative arc. For tool-using, long-horizon agents, this masks a structural failure:
removed in v8.0
v7.7 · 1.1 Why Narrative Compaction Fails1. **Irreversibility.** Once details are omitted from the summary, no reliable recovery mechanism exists. The summary becomes the _only cognitively accessible copy_ of that information. 2. **Compression on an untrusted budget signal.** Compaction is commonly armed by a token estimate rather than the prompt actually sent to the model. It can therefore fire near saturation, where long-context reasoning is weakest, or far below saturation, where destructive compression buys no useful headroom.
removed in v8.0
v7.7 · 1.1 Why Narrative Compaction FailsIn production, long-running sessions accumulate massive tool results and repeatedly trigger compaction. The result looks like "forgetfulness" but is actually **cache eviction without storage**. Our system confirmed this directly: sessions over email archives, codebases, and multi-day task threads consistently lost the exact hashes, file paths, and error strings needed for task completion under narrative compaction. A separate seven-day deployment trace exposed a trigger-side failure: a per-message field containing aggregate usage across internal calls was interpreted as a context snapshot, reporting 6,448,106 tokens against a one-million-token window. Compaction consequently fired at a median of roughly 5.5% of the window; 29 attempts reached a 540-second orchestration cap and were discarded even though the compaction operation itself took 19 ms. These measurements concern the surrounding runtime's narrative compactor, not Total Recall's pointer compactor. They show that the trigger and orchestration path, not the eviction algorithm alone, determines deployed safety and latency.
removed in v8.0
v7.7 · 1.2 Taxonomy of Information Loss### 1.2 Taxonomy of Information Loss
removed in v8.0
v7.7 · 1.2 Taxonomy of Information LossNarrative compaction predictably destroys four categories of information that determine task success:
removed in v8.0
v7.7 · 1.2 Taxonomy of Information Loss| Category | Example | Why summaries lose it | | ---------------------- | ---------------------------------------------- | ---------------------------------------------------- | | **Precise strings** | SHA hashes, file paths, email addresses | Summaries paraphrase; exact characters are discarded | | **Causal chains** | "X failed because Y was misconfigured after Z" | Multi-step causation collapses to "X failed" | | **Negative knowledge** | "We tried approach A and it didn't work" | Summaries bias toward positive outcomes | | **Temporal anchors** | "At 14:32, the deploy succeeded" | Timestamps are omitted as irrelevant detail |
removed in v8.0
v7.7 · 1.2 Taxonomy of Information LossA summary preserves the _shape_ of a task while destroying its operational substance.
removed in v8.0
v7.7 · 1.3 Thesis and Contributions### 1.3 Thesis and Contributions
removed in v8.0
v7.7 · 1.3 Thesis and Contributions**Thesis.** The context window must be treated as a **cache**, not canonical memory. Compaction must be **cache eviction with pointers**, not narrative consolidation. A second corollary follows: a memory system that only ever grows is not bounded, so *writes* must be reconciled, not blindly appended.
removed in v8.0
v7.7 · 1.3 Thesis and Contributions**Total Recall** operationalizes this through:
removed in v8.0
v7.7 · 1.3 Thesis and Contributions- A **lossless append-only event store** as ground truth. - **Pointer-based compaction**: compact time-range markers replace evicted content. - A **hybrid push/pull retrieval model** balancing proactive injection with on-demand recall. - **Task-conditioned retrieval priority** derived from expected-utility optimization. - **Write reconciliation** (ADD/UPDATE/DELETE/NONE) that bounds the working set without mutating the audit log.
removed in v8.0
v7.7 · 1.3 Thesis and ContributionsThe **TRACE** production codebase (§9) implements and validates all claims. Code, synthetic generators, and evaluation harness will be released on GitHub (link redacted for anonymity).
removed in v8.0
not in v7.7
v8.0 · 2. Related Work## 2. Related Work
not in v7.7
v8.0 · 2. Related WorkThis is one of four designs for an agent's memory: keeping (J1, this paper), writing (J14), finding (J2) and learning (J5). Keeping owns what survives the context window. How things are ranked and pushed into the window belongs to finding, what becomes a long-term fact belongs to writing, and turning experience into rules belongs to learning. Each appears here in one line, with a pointer.
not in v7.7
v8.0 · 2. Related Work**MemGPT and Letta** (Packer et al., 2023) treat the context window like a computer's main memory and let the model page information in and out through function calls, with the full message history kept in a searchable "recall" store. Total Recall keeps the hierarchy and the full history. It differs on who decides: eviction is a decision of whoever owns the window (§6), so the model does not spend attention on managing its own pages, and the marker it leaves carries the exact strings a later search needs (§5.1).
not in v7.7
v8.0 · 2. Related Work**Provider context management** has made the provider an owner of the window. Anthropic's context editing clears the oldest tool results once a threshold is crossed and leaves a placeholder saying a result was removed; the caller can name tools whose results are never cleared and a minimum amount to clear, so the cache is not broken for a small gain, and the client keeps the full history because the clearing happens before the prompt reaches the model (Anthropic, 2026d). Its memory tool lets the model keep files outside the window in storage the developer controls (Anthropic, 2025a), and its server-side compaction replaces earlier turns with a summary block (Anthropic, 2026a). OpenAI's compaction returns an opaque, encrypted item that carries prior state forward (OpenAI, 2026). Clearing tool results first is the same eviction order we propose (§5.3), reached independently. The placeholder is a marker with nothing in it to search with; our marker (§5.1) is that placeholder with the exact strings added. The summaries are the narrative baseline our tests compare against (§10). An opaque item is the strongest argument for keeping the record on the runtime's side: if nobody can read what was kept, the runtime must keep its own copy of what was said (§6.4).
not in v7.7
v8.0 · 2. Related Work**Claude Code's hooks** (Anthropic, 2026b) are the levers a memory layer has when a provider's tool owns the window: an event before compaction (which can block it), an event after, a session-start event that fires after a compaction and adds text to the new context, and the path to the tool's own transcript. **claude-mem** (thedotmack, 2026) is a widely used plugin that uses these levers to capture what an agent did, compress it with a model and inject it into later sessions. We use the same levers (§6.3). We differ on what is kept: claude-mem's memory is the model-compressed observation, while ours is the record itself, with compression used only as a map that points back into it.
not in v7.7
v8.0 · 2. Related Work**Manus** (Ji, 2025) reports the lessons of a production agent: treat the file system as unlimited context, compress only in ways that can be restored (drop a page's content but keep its URL), keep the prompt prefix stable because the cache hit rate drives cost and latency, keep the context append-only, and leave failed attempts in view. Total Recall takes "restorable" from tool outputs to the whole conversation, adds the owner's words as something never to be compressed, and puts a price on moving the prefix (§7.2).
not in v7.7
v8.0 · 2. Related Work**headroom** (Headroom Labs, 2026) compresses tool outputs, logs and files before they reach the model, caches the originals, and gives the model a tool to retrieve them. It compresses only content as it enters the window, so the cached prefix is never rewritten; that avoids the one-time cost of §7.2, at the price of deciding before anyone knows whether the content will be needed again. It keeps a smaller, lossy version in the window; we remove the span and leave a pointer. The two compose. For a span likely to be read again, a compressed copy in the window can be cheaper than a pull; for a span unlikely to be read again, a pointer is. §7.2 gives the rule that chooses.
not in v7.7
v8.0 · 2. Related Work**Agentic Context Engineering** (Zhang et al., 2025) shows two failures of agents that rewrite their own context: brevity bias, where summaries drop domain detail, and context collapse, where iterative rewriting erodes detail over time. Its cure is small incremental updates. Our version of the cure is that every compaction is written from the record (§5.4). Their evolving playbook of strategies is learning, the subject of J5.
not in v7.7
v8.0 · 2. Related Work**Zep** (Rasmussen et al., 2025) keeps raw conversation "episodes" beneath the entities and facts it extracts, so every derived fact points back to its source. Total Recall applies the same layering to the context window: the raw record underneath, and everything derived (markers, maps, summaries) pointing back into it (§4). Extracting facts from the record belongs to J14.
not in v7.7
v8.0 · 2. Related WorkTwo older ideas frame the rest. Belady (1966) showed that the best page to evict is the one needed furthest in the future; no runtime knows that, so §5.3 uses what is cheapest to recover as the proxy. And the prompt cache now prices every edit to the prefix (Anthropic, 2026c), which turns "when to compact" from a matter of taste into arithmetic (§7.2).
not in v7.7
v8.0 · 2. Related WorkTo our knowledge no shipping system combines all five of our contributions, but each of them has close relatives above, and we claim the combination and the contract, not the parts.
··· 1 unchanged paragraph folded ···
v7.7 · 2. Background & Related Work## 2. Background & Related Work
removed in v8.0
v7.7 · 2.1 Context Management & Paging### 2.1 Context Management & Paging
removed in v8.0
v7.7 · 2.1 Context Management & PagingMemGPT (Packer et al., 2023) frames the context window as RAM, with the model managing paging via tools. Focus (Verma, 2024, pre-print) demonstrates agents self-managing context compression. ACC (Bousetouane, 2024) maintains a bounded internal state continuously updated by the agent. RetMem (Chen et al., 2023) and LongAgent (Dai et al., 2023) highlight retrieval mechanisms for extremely long horizons. Total Recall differs by treating compression as a _system-level cache eviction_, avoiding the attention cost of self-management while preserving pull capabilities.
removed in v8.0
v7.7 · 2.2 Agent Memory Structures### 2.2 Agent Memory Structures
removed in v8.0
v7.7 · 2.2 Agent Memory StructuresPark et al. (2023) introduced a memory stream combining append-only logs with reflection. Reflexion (Shinn et al., 2023) and Voyager (Wang et al., 2023) maintain persistent memory via external text/code bases. Structural Memory (Zeng et al., 2024) mixes episodic, semantic, and procedural memories. Mem0 (Yu et al., 2024) introduces a reconciliation step that classifies each candidate memory write as add, update, or delete rather than appending unconditionally. Total Recall shares the append-only event store, formalizes pointer-based compaction as an eviction protocol with task-conditioned retrieval, and adapts Mem0-style reconciliation as a *logical* working-set bound layered over an immutable audit log (§8).
removed in v8.0
v7.7 · 2.3 Caching & Graph Retrieval### 2.3 Caching & Graph Retrieval
removed in v8.0
v7.7 · 2.3 Caching & Graph RetrievalTotal Recall's eviction policy connects to classical caching algorithms: LRU-K (O'Neil et al., 1993) and LIRS (Jiang & Zhang, 2002) balance recency and frequency; Belady's MIN (Belady, 1966) requires an oracle. Total Recall uses Task State as a noisy oracle for future access. For derived indexing, GraphRAG (Edge et al., 2024) and RAPTOR (Sarthi et al., 2024) construct hierarchies; Total Recall adopts these as _optional indexes_ rather than ground-truth replacements.
removed in v8.0
v7.7 · 2.4 Convergent Prior Art: Reversible Compress-Cache-Retrieve### 2.4 Convergent Prior Art: Reversible Compress-Cache-Retrieve
removed in v8.0
v7.7 · 2.4 Convergent Prior Art: Reversible Compress-Cache-RetrieveThe closest convergent system to Total Recall is **headroom** (Chopra, 24.7k stars, Apache-2.0), which arrives at this paper's core thesis from the opposite direction. headroom's **reversible CCR** (Compress-Cache-Retrieve) caches originals and has the LLM retrieve them on demand — structurally the same insight as treating the context window as a cache over a lossless store whose evicted content is recoverable via `recall(query)`. The two systems differ in *granularity* and *reversibility model*, and the difference is the substance of the comparison, not a footnote:
removed in v8.0
v7.7 · 2.4 Convergent Prior Art: Reversible Compress-Cache-Retrieve- **headroom compresses content in place.** It runs per-content-type, lossy-but-recoverable compressors — statistical JSON-array crushing (SmartCrusher), AST-aware code compression via tree-sitter, and dedicated log/diff/text handlers — and recovers the original through a cache lookup. A degraded-but-usable representation stays *addressable in context*. The cost is a recurring (smaller) re-read tax plus exposure to lossy-compressor error; the benefit is that the content never leaves the window. - **Total Recall evicts whole time-range spans behind a fixed-size pointer marker.** It removes the span from context entirely, leaves only a retrieval directive, and recovers via task-conditioned retrieval over a durable event store. The cost is an occasional pull; the benefit is byte-exact recovery and a per-turn footprint that does not grow with the evicted content.
removed in v8.0
v7.7 · 2.4 Convergent Prior Art: Reversible Compress-Cache-RetrieveNeither is strictly superior: headroom keeps a lossy proxy resident and addressable, Total Recall removes the span and guarantees exact recovery on demand. The two are also *composable* rather than mutually exclusive — a deployment could compress a span with headroom-style content-aware compressors before evicting it behind a Total Recall marker, paying headroom's compression cost only on spans likely to be re-touched and Total Recall's eviction discipline on the rest. headroom additionally ships a trained compression model (Kompress-v2-base) and proxy / MCP / library form factors; these are orthogonal to the storage invariants studied here but reinforce that in-place compression and pointer-eviction occupy adjacent, combinable points in the design space. We extend the steady-state cost comparison to include headroom's in-place model in §7.3, and adopt headroom's public-benchmark methodology as a shared evaluation yardstick in §11.
removed in v8.0
v7.7 · 2.4 Convergent Prior Art: Reversible Compress-Cache-RetrievePlacement in the execution stack is a separate precondition from compression quality. In one deployment, a headroom proxy was installed and enabled but observed only six lifetime requests and saved no tokens because the active CLI subprocess did not inherit the proxy environment. This integration null does not test headroom's compressor; it shows that a boundary component can satisfy its local contract while missing the traffic it is meant to transform. Total Recall runs inside context assembly and therefore observes the history it evicts. Any cross-system evaluation must verify traffic coverage before comparing token savings or accuracy.
removed in v8.0
v7.7 · 2.5 Metacognitive Verification Disciplines### 2.5 Metacognitive Verification Disciplines
removed in v8.0
v7.7 · 2.5 Metacognitive Verification DisciplinesA second class of recent work is relevant not to storage but to the *retrieval-trigger* problem this paper identifies as its binding limitation (§4.3, §11): deciding whether to query memory at all, and whether a returned result is good enough to accept. **doubt-driven-development**, shipped in addyosmani/agent-skills (Osmani, 56.8k stars), is a general claim-verification discipline with a concrete loop: **CLAIM → EXTRACT** (an artifact and contract, with reasoning stripped) **→ DOUBT** (a fresh-context adversarial reviewer re-examines the result) **→ RECONCILE** (findings classified against the artifact text) **→ STOP** (on trivial findings, a 3-cycle bound, or user override), gated by explicit non-trivial-decision criteria that decide when the loop engages at all. doubt-driven-development is memory-agnostic and addresses no storage concern, but it is the documented shape of the metacognitive gate this paper hands its retrieval-trigger problem to; we position it concretely against §4.3 and §11 rather than leaving that hand-off abstract. The same source contributes a second idea Total Recall can borrow: every skill there carries a "When NOT to use" anti-trigger and a "Loading Constraints" declaration of where it may load — a discipline that maps onto Total Recall's non-evictable-kind guarantees and motivates a *retrieval anti-trigger* (when *not* to fire `recall`), discussed in §11.
removed in v8.0
v7.7 · 2.6 The Mechanisms That Surround Storage### 2.6 The Mechanisms That Surround Storage
removed in v8.0
v7.7 · 2.6 The Mechanisms That Surround StorageStorage and compaction are useful on their own, but three adjacent mechanisms determine how much value the stored content yields in practice. We state their interfaces concretely because each one depends on a property Total Recall guarantees, and naming that dependency clarifies what the storage layer must produce. The mechanisms themselves are external to this paper.
removed in v8.0
v7.7 · 2.6 The Mechanisms That Surround Storage- **The index over pointers.** Pointer-based compaction is not just space-saving; it is what makes downstream retrieval tractable. Each marker carries topic hints and a time range — structured anchors, not prose. A retrieval system can build a navigable index over these compacted pointers: clustering them by topic, scoring them by importance, and enabling sub-second lookup across the full corpus. *Without* the topic-hinted pointers, that index has nothing to grip and retrieval degrades to generic full-text search over raw, undifferentiated logs. The pointers are the seams. - **The nightly reflection process.** A consolidation process running once per day reviews the day's retrieval successes and failures, identifies patterns (for example, "medical context is consistently under-retrieved"), and adjusts compaction and importance thresholds — in effect teaching storage which memories deserve preservation. This is also where the deferred reconciliation sweep runs (§8.3): the only safe moment to decide that a fact is now stale is after its downstream outcome is known. - **Persona-aware assembly.** Continuity across resets requires that certain blocks — the system prompt and persona state — ride alongside the push pack and are never evicted. Total Recall guarantees this by classifying those kinds as non-evictable (§5.1); the policy that selects which persona blocks to include is decided upstream of storage.
removed in v8.0
not in v7.7
v8.0 · 3. The Design in One Page## 3. The Design in One Page
not in v7.7
v8.0 · 3. The Design in One Page{width=82%}
not in v7.7
v8.0 · 3. The Design in One PageFigure 1 shows the whole design. Four parts carry it:
not in v7.7
v8.0 · 3. The Design in One Page- The session record. An append-only log of the session: owner messages, agent replies, tool calls and tool results, each with its author, its time and an address that never changes. It is the ground truth. Nothing edits it. - The context window. What the model reads on this call. It is a cache: a copy of part of the record, plus markers standing in for parts that left. - The marker. A short block that replaces an evicted range. It names the range, carries its exact strings and the owner's instructions word for word, lists decisions and open items as one line each, and points back into the record. - The range read. It takes a marker's range and returns the exact entries, word for word. It is not a tool of its own: J2's pull (J2 §6.6) offers it as a range mode next to its search.
not in v7.7
v8.0 · 3. The Design in One PageAround them sit three rules that keep the design honest:
not in v7.7
v8.0 · 3. The Design in One Page1. One owner per window. The memory layer finds out who owns the window (§6) and acts only where its action changes what the model reads. 2. Priced compaction. A forced compaction happens because the window is full. An elective one happens only when its price, measured on the call actually sent, is lower than keeping the span (§7). 3. Checked invariants. Every marker resolves to entries in the record (§8); nothing leaves the record except through a tombstone (§4.4). These are checks in code, not sentences in a prompt (why a check and not text: J5 §1.2).
··· 1 unchanged paragraph folded ···
v7.7 · 3. Total Recall Architecture## 3. Total Recall Architecture
removed in v8.0
v7.7 · 3. Total Recall ArchitectureTotal Recall is built on six principles: (1) lossless event persistence; (2) context as cache; (3) pointer-based compaction; (4) asynchronous indexing; (5) bounded push/pull context assembly; (6) prompt-cache-friendly ordering.
removed in v8.0
v7.7 · 3.1 Data Model### 3.1 Data Model
removed in v8.0
v7.7 · 3.1 Data Model1. **Events.** Append-only user messages, tool calls, and results. 2. **Artifacts.** Large blobs with extracted semantic preview windows. 3. **Task State.** A compact index-card view of the current task (goals, open loops, `key_events`). 4. **Time-range markers.** Tuples $\mu = (t_{\text{start}}, t_{\text{end}}, \mathcal{K}, d, \ell)$ denoting evicted spans with key topics $\mathcal{K}$. Adjacent markers merge hierarchically to bound token overhead.
removed in v8.0
v7.7 · 3.2 Pipeline### 3.2 Pipeline
removed in v8.0
v7.7 · 3.2 Pipeline
removed in v8.0
v7.7 · 3.2 Pipeline- **Layer 1 (Ingest & Index).** Persists events synchronously. Vectors embed asynchronously; the hot tail covers the latency gap. - **Layer 2 (Retrieve & Pack).** Assembles a fixed-budget _Push Pack_ (Task State, markers, hot tail) and handles on-demand _Pull_ via `recall`. - **Layer 3 (Consolidate).** Builds episodic summaries as derived indexes over the lossless store, and runs the deferred write-reconciliation sweep (§8.3).
removed in v8.0
v7.7 · 3.3 Prefix Stability as a Design Constraint### 3.3 Prefix Stability as a Design Constraint
removed in v8.0
v7.7 · 3.3 Prefix Stability as a Design ConstraintPrompt caching rewards a byte-identical prefix. Pointer compaction, narrative compaction, and in-place compression all contend over that same prefix: deleting or rewriting a span in the middle invalidates the cached suffix after the edit point. Prompt-cache-friendly ordering therefore means keeping stable system, workspace, skill, and tool-schema blocks first; placing volatile retrieval material near the tail; and batching eviction so the prefix is rewritten as rarely as the context budget permits.
removed in v8.0
v7.7 · 3.3 Prefix Stability as a Design ConstraintThis cost is material in the measured deployment. One accounting window contained 122,422,666 cache-read tokens against 15,841 fresh-input tokens, while a separate telemetry sample measured a 91.1% cache-hit rate (98.6% median) and 10.6 cache reads per write. Pointer eviction remains attractive because it mutates the prefix once per eviction rather than retaining a large artifact on every later turn, but a marker's token count alone is not its full cost. The operational metrics are cache-hit preservation, reads per write, and compactions per day.
removed in v8.0
not in v7.7
v8.0 · 4. The Session Record## 4. The Session Record
not in v7.7
v8.0 · 4.1 What goes in, and with whose name### 4.1 What goes in, and with whose name
not in v7.7
v8.0 · 4.1 What goes in, and with whose nameEvery entry in the record has an author, and the author is one of five kinds: the owner, the agent, a tool, the harness (time stamps, injected instructions, system text) or another agent. This is the most important field in the record, because every later stage depends on it. When a marker says "owner: never restart prod by day", it must be the owner's sentence. A harness that wraps the owner's message with a time stamp and a block of injected instructions, and stores the whole as "user", will later quote its own wrapper back as the owner's wish. So an owner's entry gets a second field when it is appended: the owner's words, with the wrapper stripped. One function does the stripping, once, at append time, and the field is never rewritten. Anything a later stage quotes as "the owner said" comes from this field. J2, J14 and J5 read the owner's words only from this field.
not in v7.7
v8.0 · 4.1 What goes in, and with whose nameTool results go in whole when they cannot be reproduced: the output of a command at a moment in time, a web page as it was fetched, an API's answer. Tool results that can be reproduced exactly, such as the contents of a file that is still on disk at the same version, go in as a reference with a content hash. Reading the file again is the recovery path, and the hash says whether the file has changed since.
not in v7.7
v8.0 · 4.2 Addresses that never move### 4.2 Addresses that never move
not in v7.7
v8.0 · 4.2 Addresses that never moveEach entry gets an address made of the session and a sequence number. A range of entries is written as the session and two numbers. Addresses are assigned once, at append, and never reused or renumbered, so a pointer written today still resolves next month. Ids that sort by time are convenient, but the sequence number is what makes a range well defined.
not in v7.7
v8.0 · 4.3 Never edited, never superseded### 4.3 Never edited, never superseded
not in v7.7
v8.0 · 4.3 Never edited, never supersededThe record is append-only. No compaction or clean-up ever edits or deletes an entry, and the record has no supersede at all: a turn that was said stays said, even after what it said stops being true. Supersede happens one stage later, in the fact files, where a judge closes a fact line and leaves it in place, struck through, with a pointer to the line that replaced it (J14 §7.3). The record entry the fact was drawn from is not touched. Which facts are closed is J14's call (J14 §7); what a default search hides, and its per-query counts, are J2's (J2 §8.1).
not in v7.7
v8.0 · 4.4 Forgetting: the tombstone### 4.4 Forgetting: the tombstone
not in v7.7
v8.0 · 4.4 Forgetting: the tombstoneTwo cases justify removing content: the owner asks to forget something about a person, or a line is shown to have been injected. J14 decides when either applies and removes the content from the fact files, leaving a tombstone there (J14 §7.7). The same content is almost always in the session record as well, because someone said it or a tool returned it. If the record kept it, the deletion would not hold: J2's text index covers the record (J2 §4.1), so the next search would find it again, and a range read would return it word for word.
not in v7.7
v8.0 · 4.4 Forgetting: the tombstoneSo the record entry is redacted, and this is the only edit the record allows. The entry keeps its address, author and time. Its text, its owner's-words field and any tool result it holds are replaced by a tombstone that says content was removed, when, for which of the two reasons, and points to J14's receipt for the deletion. The tombstone holds no part of the content, not even a hash, because a hash of a short string such as a phone number can be confirmed by guessing. The redaction is also appended to the record as a harness entry, so the record still shows that something left, and when.
not in v7.7
v8.0 · 4.4 Forgetting: the tombstoneEverything derived from the entry is rebuilt from the redacted record. The text index drops the entry's rows and indexes the tombstone. Every marker whose range covers the entry is written again from the record (§5.4), which drops any exact string or owner's sentence that came from it. Where one session has two transcripts (§4.5), both are redacted. A copy the runtime cannot edit, such as a provider's opaque compacted state, is named in J14's receipt as out of reach. Addresses do not move, so every pointer into the range still resolves, now to a tombstone (§8).
not in v7.7
v8.0 · 4.5 One record, not copies### 4.5 One record, not copies
not in v7.7
v8.0 · 4.5 One record, not copiesMost deployments already have a lossless record: the runtime writes a transcript of every session, and a provider's command-line tool writes its own. The memory layer should not add a third, partial copy. A copy that keeps only some kinds of entry, say the agent's replies, is worse than none, because a range read against it returns an answer that looks complete and is not. The design is therefore an index over the transcript the serving runtime already writes, with addresses that resolve into that transcript. The memory layer writes its own entries only where no transcript exists: when an API's compaction leaves nothing readable (§6.4), and for the markers and maps it derives.
not in v7.7
v8.0 · 4.5 One record, not copiesWhere two transcripts exist for one session (the runtime's and the provider tool's), the one the model actually read is the ground truth for what the model saw, and the runtime's is the ground truth for what the owner said. The index keeps both addresses.
··· 1 unchanged paragraph folded ···
v7.7 · 4. Task-Conditioned Retrieval Priority## 4. Task-Conditioned Retrieval Priority
removed in v8.0
v7.7 · 4. Task-Conditioned Retrieval PriorityA purely similarity-driven retriever over-injects obsolete objectives and debug noise. Retrieval must be conditioned on active tasks and premises.
removed in v8.0
v7.7 · 4.1 Formal Derivation### 4.1 Formal Derivation
removed in v8.0
v7.7 · 4.1 Formal DerivationWe seek a context pack $C^* \subseteq \mathcal{E}$ under budget $B$ maximizing expected task completion: $$C^* = \arg\max_{C \subseteq \mathcal{E},\; |C| \leq B} \; \mathbb{E}\left[P(\text{complete} \mid C, \tau)\right]$$
removed in v8.0
v7.7 · 4.1 Formal DerivationThis objective is combinatorially hard: subset selection under a budget constraint is NP-hard in the general case. We approximate it by assuming marginal contributions are roughly independent — a submodularity assumption that lets a greedy selector run in near-linear time. The assumption breaks when events are strongly complementary: a cryptographic key split across two events, or a bug symptom paired with the configuration change that caused it. The greedy approximation works well for the common case where most events contribute independently; co-retrieving strongly complementary events remains an open problem (§11).
removed in v8.0
v7.7 · 4.1 Formal DerivationMarginal utility proxies: $$\text{score}(e, q, \tau) = \text{base}(e, q) \cdot \left[ \text{prem}(e, \tau) \cdot \text{phase}(e, \tau) \cdot (1 - \text{sup}(e)) \cdot \text{task\_rel}(e, \tau) \right]$$
removed in v8.0
v7.7 · 4.1 Formal DerivationCandidates are selected via Maximal Marginal Relevance (MMR). In ablation over synthetic traces (§9.1), performance was stable for $\lambda \in [0.5, 0.8]$: below 0.5 increases redundancy; above 0.8 penalizes relevant but textually similar events.
removed in v8.0
v7.7 · 4.2 Retrieval Completeness### 4.2 Retrieval Completeness
removed in v8.0
v7.7 · 4.2 Retrieval Completeness**Definition (k-hop retrievability).** An event $e$ is $k$-hop retrievable if there exists a chain of at most $k$ retrieval operations returning $e$.
removed in v8.0
v7.7 · 4.2 Retrieval Completeness**Proposition 1 (Bounded Retrieval Completeness).** Let $\mathcal{S}$ be a Total Recall event store with perfect indexing ($p_{\text{idx}} = 1$). Let $p_{\text{match}}$ be the probability a single retrieval attempt succeeds. For $K$ key events: $$P(\text{all } K \text{ key events are 2-hop retrievable}) \geq \left[1 - (1 - p_{\text{match}})^2\right]^K$$
removed in v8.0
v7.7 · 4.2 Retrieval Completeness_Proof._ Event $e_i$ fails 2-hop retrieval only if both independent attempts fail: $P(e_i \text{ unreachable}) \leq (1-p_{\text{match}})^2$. Joint probability follows from independence of per-event failures. $\square$
removed in v8.0
v7.7 · 4.2 Retrieval CompletenessThe independence assumption is a simplification; correlated retrieval failures (events sharing rare vocabulary) would lower the bound. Empirical quantification on LOCA-bench is planned.
removed in v8.0
v7.7 · 4.3 The Upstream Dependency: Query Formulation### 4.3 The Upstream Dependency: Query Formulation
removed in v8.0
v7.7 · 4.3 The Upstream Dependency: Query FormulationThe completeness bound assumes the agent issues a query that actually matches how the knowledge was stored. In production this is the binding constraint, not storage. An agent that formulates a low-similarity query, accepts the weak result, and never escalates will miss content that is physically present and perfectly recoverable. Task-conditioned scoring improves *what is injected once a query is issued*; it does not decide *whether* to query or *whether the result is good enough*. The complementary mechanism is a confidence threshold below which the agent reformulates and retries with expanded queries before accepting failure — a metacognitive control loop that sits above storage and is out of scope here. This loop is not hypothetical: it has a documented shape in the ecosystem. doubt-driven-development (Osmani, addyosmani/agent-skills; §2.5) realizes exactly this control structure — a fresh-context adversarial re-examination (DOUBT) bounded by a stop rule (STOP: trivial findings, three cycles, or override) — and binds to precisely the interface Total Recall exposes: `recall(query)` returns scored results with the similarity scores exposed, so a caller can gate on confidence and decide to retry. We return to this contract as a limitation in §11.
removed in v8.0
not in v7.7
v8.0 · 5. Compaction That Leaves Pointers## 5. Compaction That Leaves Pointers
not in v7.7
v8.0 · 5.1 The marker### 5.1 The marker
not in v7.7
v8.0 · 5.1 The marker{width=80%}
not in v7.7
v8.0 · 5.1 The markerA marker is a pointer with a short, fixed shape. Figure 2 sets it beside a narrative summary of the same span. A marker carries, in this order:
not in v7.7
v8.0 · 5.1 The marker1. The range: the session and the first and last sequence numbers. 2. The owner's words: every instruction, preference and correction the owner gave inside the range, verbatim. 3. Exact strings: the paths, hashes, host names, identifiers, numbers, error lines and times that appear in the range, copied character for character, most-referenced first. 4. Decisions and negative results: one line each ("chose X over Y", "tried Z: failed with E"), each with the address of the entry that shows it. 5. Open items: what was started and not finished, one line each with an address.
not in v7.7
v8.0 · 5.1 The markerThere is no narrative in it. A sentence like "we made good progress on the setup" gives the model nothing to act on and nothing to search with, and it can be mistaken for a fact. Everything in a marker is either a quote or a line that points at a quote.
not in v7.7
v8.0 · 5.1 The markerThe exact strings are there for two readers. The model reads them and can often act without pulling anything: the hash is right there. And the search that later looks for the span finds it by the same strings the owner will use when he asks ("the nginx path", "that hash"). The strings are what an index can hold on to.
not in v7.7
v8.0 · 5.2 Word for word, one line, or a pointer### 5.2 Word for word, one line, or a pointer
not in v7.7
v8.0 · 5.2 Word for word, one line, or a pointerEach kind of content gets one treatment when its range is evicted:
not in v7.7
v8.0 · 5.2 Word for word, one line, or a pointer| Content | Kept in the marker | Why | |------------------|-----------|---------------------| | Owner's instructions, preferences, corrections | word for word | the owner should never have to say them twice; a paraphrase changes what was asked | | Exact strings (paths, hashes, hosts, errors, times) | word for word | a paraphrase of a string is a different string | | Decisions, failed attempts, open items | one line each, with an address | the line says that it happened; the address gives how | | Agent's reasoning and replies | pointer only | recoverable from the record when needed | | Tool output that can be reproduced (a file on disk) | pointer and content hash | read the file again; the hash says if it changed | | Tool output that cannot be reproduced | pointer only | the record holds it whole | | Harness text (time stamps, injected rules) | nothing | the harness injects it again; it is not memory |
not in v7.7
v8.0 · 5.2 Word for word, one line, or a pointerThe owner's words have a budget, because in a long session they can grow. In a working session the owner writes much less than the tools do, so the budget should rarely bind; when it does, the instructions and corrections stay verbatim and the rest of the owner's text becomes a pointer. Deciding which of the owner's sentences are instructions needs a cheap judge; a sentence the judge is unsure of is kept verbatim, because the cost of keeping a sentence is a few tokens and the cost of losing an instruction is the owner's trust. The judge is one classifier of owner sentences shared by three stages: it picks the instructions here, finds corrections for J5's detector (J5 §3.1) and stamps a fact "told by the owner" in J14 (J14 §8.1). J5 owns it. Whether these corrections later become standing rules is learning, J5's stage; this stage only makes sure they survive the session.
not in v7.7
v8.0 · 5.3 What leaves first### 5.3 What leaves first
not in v7.7
v8.0 · 5.3 What leaves firstWhen the window must shrink, the cheapest content to recover leaves first. In order:
not in v7.7
v8.0 · 5.3 What leaves first1. Tool output that can be reproduced (files still on disk). 2. Tool output that cannot be reproduced but is in the record. 3. The agent's own reasoning and replies. 4. The owner's messages, except the instructions, which become part of the marker.
not in v7.7
v8.0 · 5.3 What leaves firstNever evicted: the system text, the always-loaded files, the markers themselves, and the current task's own short statement. Within each class, older content leaves before newer, since recent content is the best available guess at what will be needed next.
not in v7.7
v8.0 · 5.3 What leaves firstThis order is cheapest-to-recover first, which is the practical stand-in for Belady's rule: we cannot know what will be needed furthest in the future, but we can know what costs least to get back. The same order arose independently in the provider world, where context editing clears the oldest tool results first (Anthropic, 2026d).
not in v7.7
v8.0 · 5.3 What leaves firstThe selector reports what it evicted, by class, and the bytes in each class add up to the total it removed. It chooses from the window as the model will read it on the next call, after every other step that moves content out (a store for large tool output, a provider's clearing), so each class it names is a class that is still in the window.
not in v7.7
v8.0 · 5.4 Written from the record, never from the last marker### 5.4 Written from the record, never from the last marker
not in v7.7
v8.0 · 5.4 Written from the record, never from the last markerWhen a range that already contains a marker is evicted again, the new marker is built from the record entries the old marker pointed to, not from the old marker's text. This is the rule that stops context collapse. A summary of a summary loses detail at every round; a marker written from the record has the same detail on the hundredth compaction as on the first.
not in v7.7
v8.0 · 5.5 Merging markers### 5.5 Merging markers
not in v7.7
v8.0 · 5.5 Merging markersAdjacent markers merge: two markers covering consecutive ranges become one covering both, with their owner's words, exact strings and lines combined. The combined lists are capped by count, and what falls off the end is still in the record and still reachable through the merged range. Each merge is another compaction, so §5.4 applies: the merged marker is written from the record.
··· 1 unchanged paragraph folded ···
v7.7 · 5. Pointer-Based Compaction## 5. Pointer-Based Compaction
removed in v8.0
v7.7 · 5. Pointer-Based CompactionWhen context nears its limit, Total Recall evicts using a type-weighted policy approximating LRU-K / LIRS caching principles.
removed in v8.0
v7.7 · 5. Pointer-Based Compaction
removed in v8.0
v7.7 · 5.1 Eviction Ordering### 5.1 Eviction Ordering
removed in v8.0
v7.7 · 5.1 Eviction OrderingTotal Recall evicts oldest tool results first (large, highly retrievable), then tool calls, then dialogue. System blocks, persona state, Task State, and markers are never evicted. Task State serves as a proxy oracle for future access, approximating Belady's MIN. The policy assigns each event kind a numeric eviction weight and selects the oldest contiguous span maximizing total weight; non-evictable kinds carry weight zero and are guarded out entirely.
removed in v8.0
v7.7 · 5.1 Eviction OrderingThe weights describe preference, not guaranteed opportunity. In one production anatomy trace, tool-result attribution initially measured zero because the runtime used a role literal the instrument did not recognize; the zero was an instrumentation defect, not evidence that tool results were absent or free. More generally, artifact externalization (§9.3) may already have removed the highest-weight class before compaction runs. The selector must therefore report bytes by attributed class and reconcile those slices against the total rather than assume its preferred victim exists.
removed in v8.0
v7.7 · 5.1 Eviction Ordering**Table A.** Eviction weights by event kind (higher = evicted sooner).
removed in v8.0
v7.7 · 5.1 Eviction Ordering| Event kind | Weight | Rationale | | ------------------- | ------ | ------------------------------------------------------ | | Tool result | 1.0 | Largest, most retrievable — recovers cleanly via recall | | Tool call | 0.8 | Reconstructable from result + dialogue | | Agent / user message| 0.5 | Carries intent; evict only under pressure | | Artifact reference | 0.3 | Already a pointer; little to gain | | Marker / persona / system | 0.0 | Never evicted (non-evictable guard) |
removed in v8.0
v7.7 · 5.2 Time-Range Markers### 5.2 Time-Range Markers
removed in v8.0
v7.7 · 5.2 Time-Range MarkersInstead of summarizing, Total Recall leaves a pointer:
removed in v8.0
v7.7 · 5.2 Time-Range Markers``` [Events T12–T47 evicted. Key topics: Docker build, SSL certs. Use recall(query) to retrieve.] ```
removed in v8.0
v7.7 · 5.2 Time-Range MarkersThis eliminates "only copy" destruction and prevents hallucination creep. The marker is not a summary — it carries no semantic content that could be mistaken for ground truth. It is a retrieval directive.
removed in v8.0
v7.7 · 5.2 Time-Range Markers**Marker merging.** When multiple adjacent spans are evicted across successive compaction cycles, their markers merge hierarchically: two markers covering $[t_1, t_2]$ and $[t_2, t_3]$ collapse into a single marker $[t_1, t_3]$ with a union of topic hints. This bounds marker overhead to $O(\log C)$ where $C$ is the number of compaction cycles, preventing markers themselves from consuming significant context budget.
removed in v8.0
not in v7.7
v8.0 · 6. Who Owns the Window## 6. Who Owns the Window
not in v7.7
v8.0 · 6. Who Owns the Window{width=62%}
not in v7.7
v8.0 · 6.1 Three owners### 6.1 Three owners
not in v7.7
v8.0 · 6.1 Three ownersThe owner of a context window is whoever decides, on each call, what the model reads. There are three cases, shown in Figure 3, and one agent can move between them as it switches models or tools during a day:
not in v7.7
v8.0 · 6.1 Three owners- The runtime owns the window. The agent's runtime assembles every call to the model API from its own state. Compaction is the runtime's to do. - A provider's tool owns the window. The runtime drives a provider's command-line agent, which keeps its own conversation, decides when to compact, and writes the summary. The runtime sees what goes in and what comes out, but not every call the tool makes inside. - A provider's API owns part of the window. The runtime builds the calls, but the API clears old tool results or compacts on its servers once a threshold is crossed, and returns either a readable summary or an opaque item.
not in v7.7
v8.0 · 6.1 Three ownersThe memory layer starts every session by noting which case it is in, and it re-checks when the model or tool changes. Everything else in this section follows from that one field.
not in v7.7
v8.0 · 6.2 When the runtime owns the window### 6.2 When the runtime owns the window
not in v7.7
v8.0 · 6.2 When the runtime owns the windowThis is the case §5 describes. The runtime builds markers, evicts by the order of §5.3 and places markers where the evicted range was. It also chooses when, by the price rule of §7. Nothing else is needed.
not in v7.7
v8.0 · 6.3 When a provider's tool owns the window### 6.3 When a provider's tool owns the window
not in v7.7
v8.0 · 6.3 When a provider's tool owns the windowThe runtime cannot compact a window it does not build. It acts through the tool's hooks, which current tools expose (Anthropic, 2026b):
not in v7.7
v8.0 · 6.3 When a provider's tool owns the window- Before compaction. The hook makes sure the record is complete up to this moment: it appends anything the runtime has not yet recorded, reading the tool's own transcript where needed (the tool writes it in the background, so the hook waits for it to catch up or reads the stream it already has). It then builds the markers for the range the tool is about to summarise, from the record. The hook could block the compaction, but blocking a full window stalls the session, so the default is to let it run. - After compaction. The session-start event that follows a compaction adds text to the new context. The hook adds the markers and the owner's words for the compacted range. The tool's summary stays; the markers sit beside it and give the model what the summary dropped, with pointers to get the rest. - Every turn. Text the runtime injects at the start of each turn does reach the tool's model, so the push of relevant memory (J2's stage) works here as anywhere else.
not in v7.7
v8.0 · 6.3 When a provider's tool owns the windowThe tool's own summary is not wasted: it is a readable account of the gist, and for many turns the gist is enough. What the markers add is the part a gist cannot hold.
not in v7.7
v8.0 · 6.4 When a provider's API owns part of the window### 6.4 When a provider's API owns part of the window
not in v7.7
v8.0 · 6.4 When a provider's API owns part of the windowHere the runtime builds every call but the API may change the conversation after it is sent. Two moves cover it. First, the runtime keeps its own record of everything it sent and everything that came back. With tool-result clearing this is easy, since the client still holds the full history; after a server-side compaction the runtime's record may be the only readable copy, and when the compacted state is opaque, it is certainly the only one. Second, the runtime uses the API's own controls to protect what must stay: it names the tools whose results must never be cleared and sets the minimum amount to clear at once, so a small clearing does not break the cache for a small gain. After each compaction event, it re-sends the markers and owner's words for the compacted range, in the same place every time so the prefix stays stable.
not in v7.7
v8.0 · 6.5 Never compact a copy nobody reads### 6.5 Never compact a copy nobody reads
not in v7.7
v8.0 · 6.5 Never compact a copy nobody readsA runtime that keeps a mirror of a conversation that a provider's tool owns will see the mirror grow and will be tempted to compact it. That compaction costs time and changes nothing the model reads. The rule: in the provider-tool case the runtime does not compact its mirror at all; it writes a compaction receipt for each of the provider's compactions (§7.4) and builds markers for them (§6.3). A compaction is counted only when it changed what the model reads.
··· 1 unchanged paragraph folded ···
v7.7 · 6. Hierarchical Agent Planning## 6. Hierarchical Agent Planning
removed in v8.0
v7.7 · 6. Hierarchical Agent PlanningBuilding on ReAct (Yao et al., 2023) and LangGraph (Chang et al., 2023), different agent levels can maintain distinct context windows. Planners store strategic constraints and pointers to execution spans; executors manage granular tool-output logs. Total Recall's pointer-based compaction provides a natural boundary between planning and execution contexts. Empirical validation of hierarchical planning integration is left to future work; the mechanism is included here because the architectural affordance is a direct consequence of pointer-based compaction.
removed in v8.0
v7.7 · 6.1 Beyond Conversation History: Pointer-Eviction of Static Capability Sets### 6.1 Beyond Conversation History: Pointer-Eviction of Static Capability Sets
removed in v8.0
v7.7 · 6.1 Beyond Conversation History: Pointer-Eviction of Static Capability SetsThe marker/recall pattern is not specific to evicted *dialogue*. Any always-loaded block whose content is reachable on demand — skills, tool schemas, workspace files — can be replaced by a resident *router pointer* plus an on-demand fetch, and the per-turn footprint argument of §7.2–§7.3 transfers unchanged. A static capability set behaves, for the purposes of the context budget, exactly like a temporal event stream: a fixed-size resident anchor stands in for a larger body that is materialized only when needed.
removed in v8.0
v7.7 · 6.1 Beyond Conversation History: Pointer-Eviction of Static Capability SetsWe observed this directly. A 44-skill capability catalog (Haines, coreyhaines31/marketingskills) was collapsed by the same principle the paper applies to dialogue: instead of keeping roughly 915 tokens of always-loaded skill descriptions resident, a single ~130-token router "skill" was kept in context and the 44 framework bodies were made reachable on demand, with only the winning entry injected per turn. This is structurally identical to keeping a time-range marker resident while the evicted span is reachable via `recall` — a router pointer in place of an evicted span, with the same "occasional pull, no recurring recap tax" economics of §7.3. The result was a ~7× reduction in always-resident tokens (915 → 130) with zero loss of reachability across all 44 entries.
removed in v8.0
v7.7 · 6.1 Beyond Conversation History: Pointer-Eviction of Static Capability SetsWe present this as a qualitative generalization, not a controlled accuracy benchmark: it was an engineering application with one hard token-footprint number, not a recall/precision study. Its significance for this paper is twofold. First, it is evidence that pointer-eviction generalizes from a temporal event stream to a static capability set. Second, it implies that Context Anatomy (§9.6) — which already itemizes `skillBytes` and `toolSchemaBytes` as distinct prompt slices — exposes eviction headroom in slices the paper otherwise treats as fixed overhead.
removed in v8.0
not in v7.7
v8.0 · 7. When to Compact, and What It Costs## 7. When to Compact, and What It Costs
not in v7.7
v8.0 · 7.1 Forced and elective### 7.1 Forced and elective
not in v7.7
v8.0 · 7.1 Forced and electiveA compaction is forced when the next call would not fit the window: there is no choice about whether, only about what to evict (§5.3) and what to leave (§5.1). A compaction is elective when the window still has room but keeping a span costs more than evicting it, or when a smaller window would be read better (§1.2). Context editing that clears tool results long before the limit is elective. Elective compaction is where the price matters, because it is the one we can decline.
not in v7.7
v8.0 · 7.2 The price of moving the prefix### 7.2 The price of moving the prefix
not in v7.7
v8.0 · 7.2 The price of moving the prefixWith prompt caching, the part of the context that did not change since the last call is read from cache at a fraction of the input price, and anything after the first changed token is written to cache again at a premium (Anthropic, 2026c; Ji, 2025). Evicting a span from the middle of the window changes everything after it. So eviction has a one-time cost (rewriting the suffix into the cache) and a running saving (no longer reading the span on every turn), minus the cost of the pulls the eviction will cause.
not in v7.7
v8.0 · 7.2 The price of moving the prefixIn J2's notation and prices (J2 §7.1), a cache read costs $r$, a cache write $w$ and an output token $g$, as multiples of the base input price. Let the span have $S$ tokens, the marker $m$ tokens, and let $A$ tokens follow the span in the window. Reading an evicted span back is a pull, which costs a full turn: it re-reads the $L$ tokens of cached context, writes the $R$ tokens it returns, and produces $o$ output tokens,
not in v7.7
v8.0 · 7.2 The price of moving the prefix$$C_{\text{pull}} = rL + wR + g\,o .$$
not in v7.7
v8.0 · 7.2 The price of moving the prefixIf the evicted span is pulled back on a fraction $q$ of the remaining turns ($q$ as in J2 §7.3), evicting it pays after $N^*$ more turns, where
not in v7.7
v8.0 · 7.2 The price of moving the prefix$$N^* = \frac{(m + A)(w - r)}{(S - m)\, r - q\, C_{\text{pull}}} .$$
not in v7.7
v8.0 · 7.2 The price of moving the prefixThe numerator is the one-time rewrite of everything after the span: J2 §7.4's suffix-rewrite term $\Delta C = (w - r)(L - P)$ with $P$ at the start of the span, so $L - P = m + A$, paid once here instead of on every turn. The denominator is the per-turn saving, net of expected pulls. When $q\, C_{\text{pull}} \ge (S-m)\,r$, the denominator is not positive and an elective eviction never pays: the span is read back too often, and it should stay (or be compressed in place, as headroom does).
not in v7.7
v8.0 · 7.2 The price of moving the prefix{width=72%}
not in v7.7
v8.0 · 7.2 The price of moving the prefixFigure 4 puts in the published prices. With a cache read at 0.1 and a write at 1.25, a 40K-token span pays back after about 29 turns if it is never pulled and about 39 if it is pulled on one turn in twenty; it never pays if it is pulled on more than one turn in five. A 100K-token span pays back after about 12 turns. A 10K-token span needs about 119 turns even with no pulls. Cheaper cache reads make eviction pay later, not sooner: at a read price of 0.05, the 40K span needs about 61 turns.
not in v7.7
v8.0 · 7.2 The price of moving the prefixThree design rules follow. First, elective eviction should take large spans at once, since the rewrite cost is paid per eviction and the saving grows with the span. Many small evictions pay the rewrite many times. Second, the best candidates are spans that are large and rarely pulled, which is what §5.3's order selects. Third, the markers should sit at a stable place, so that the next eviction does not move them and pay the rewrite again.
not in v7.7
v8.0 · 7.2 The price of moving the prefixThe arithmetic leaves out one benefit: a shorter window is read better (§1.2). That benefit is real but unpriced, so we leave it to a test (§10, T7) and do not add it to the formula as a guess.
not in v7.7
v8.0 · 7.3 A trigger you can trust### 7.3 A trigger you can trust
not in v7.7
v8.0 · 7.3 A trigger you can trustEvery compaction decision starts from a number: how full the window is. That number must come from the call actually sent, and from nothing else. A usage figure that sums several internal calls of one turn can be many times the window and will fire compaction far too early; a figure that misses a block of the prompt, because the counter does not recognise that block's role, will fire it too late. Both errors are easy to make and silent once made.
not in v7.7
v8.0 · 7.3 A trigger you can trustSo the trigger reads a per-call snapshot: the blocks of the prompt, each attributed to a kind (system text, always-loaded files, tool schemas, history, markers, tool results, the new message), plus a slice for anything it could not attribute. The slices must add up, within the tokenizer's tolerance, to the input count the provider reports for that call. Unattributed content is an error that is reported, never a zero that is assumed. A snapshot that does not add up blocks elective compaction and is logged; forced compaction still runs, because the provider will reject a call that does not fit whatever our counter believes.
not in v7.7
v8.0 · 7.3 A trigger you can trustA guard against thrashing completes the trigger: an elective compaction does not run again until the window has grown by at least the amount the last one freed. A compaction that frees almost nothing and runs again a minute later is a sign that the trigger is reading the wrong number.
not in v7.7
v8.0 · 7.4 One compaction receipt per compaction, whoever ran it### 7.4 One compaction receipt per compaction, whoever ran it
not in v7.7
v8.0 · 7.4 One compaction receipt per compaction, whoever ran itEvery compaction, by every executor (the runtime, the provider's tool, the API), writes one compaction receipt: when it started and ended, who ran it, the owner case of §6, what triggered it (forced or elective, and the snapshot it read), tokens before and after as measured on the next call, and the outcome. A decision not to compact writes a receipt too, under the series rule that a zero means zero (J5 §9.1).
not in v7.7
v8.0 · 7.4 One compaction receipt per compaction, whoever ran itThe receipt holds these fields:
not in v7.7
v8.0 · 7.4 One compaction receipt per compaction, whoever ran it| Field | Meaning | |-----------|---------------------| | session, started, ended | which session, and when | | executor | runtime, provider tool or provider API | | owner case | the §6 case the session was in | | kind | forced, elective, or a decision not to compact | | decision | ran, declined on price, blocked on snapshot, did not run | | snapshot | attributed slices, unattributed slice, provider-reported input count | | tokens before / after | as measured on the call before and the call after | | markers | ranges written, and whether each resolved | | outcome | completed, failed (with reason), interrupted |
··· 1 unchanged paragraph folded ···
v7.7 · 7. Boundedness & Cost Tradeoffs## 7. Boundedness & Cost Tradeoffs
removed in v8.0
v7.7 · 7.1 Linear Memory Growth### 7.1 Linear Memory Growth
removed in v8.0
v7.7 · 7.1 Linear Memory GrowthThe append-only store and pointer-based compaction yield strictly linear storage growth $O(T)$, avoiding the quadratic bloat of recursive summarization. Compaction completed in roughly 0.20 ms at 100 events and 0.48 ms at 200 events (§10.4, Table 2); two points establish millisecond-scale execution in this range, not an empirical complexity class.
removed in v8.0
v7.7 · 7.2 Cost-Latency Analysis### 7.2 Cost-Latency Analysis
removed in v8.0
v7.7 · 7.2 Cost-Latency AnalysisNarrative 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, fixed fraction of the budget — roughly 2K tokens in typical sessions — and an occasional pull adds on the order of 10K tokens 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 invariant to all three: Total Recall's per-turn footprint is bounded by the push pack, while narrative compaction's grows monotonically with session length.
removed in v8.0
v7.7 · 7.3 Marker vs. Summary vs. In-Place Compression Token Cost### 7.3 Marker vs. Summary vs. In-Place Compression Token Cost
removed in v8.0
v7.7 · 7.3 Marker vs. Summary vs. In-Place Compression Token CostThe compaction strategies differ not only in fidelity but in steady-state token cost. A narrative summary of an evicted span is itself prose that must be re-read on every subsequent turn, and as summaries-of-summaries accumulate, this recap text grows with session length. A time-range marker is a fixed-size directive — a time range, a short topic-hint list, and the `recall` instruction — typically tens of tokens, and marker merging (§5.2) bounds the *total* marker footprint to $O(\log C)$ in the number of compaction cycles. Between these two extremes sits **lossy in-place compression** — the headroom-style strategy (§2.4) of crushing content with content-aware compressors and keeping a degraded-but-addressable representation resident. We include it as the realistic steady-state competitor the original two-way table omitted, since the field's deployed alternative is increasingly in-place compression rather than narrative summarization.
removed in v8.0
v7.7 · 7.3 Marker vs. Summary vs. In-Place Compression Token Cost| Per-cycle artifact | Narrative compaction | Lossy in-place compression (e.g. headroom CCR) | Pointer compaction | | ----------------------------- | --------------------------------- | ---------------------------------------------- | --------------------------- | | Bytes written to context | Full prose recap (hundreds–thousands of tokens) | Compressed content (a fraction of the original, content-type dependent) | One marker (tens of tokens) | | Re-read cost per later turn | Entire recap, every turn | Compressed content, every turn | One marker, every turn | | Growth across $C$ cycles | Roughly linear in $C$ (recaps stack) | Linear in retained content (no merge) | $O(\log C)$ (markers merge) | | Recovery of evicted detail | Impossible (lossy) | Cache lookup of the cached original | On-demand via `recall` | | Recovery fidelity | None | Exact (cached) but subject to compressor errors in the resident proxy | Byte-exact from durable store |
removed in v8.0
v7.7 · 7.3 Marker vs. Summary vs. In-Place Compression Token CostThe marker pays a small, occasional `recall` cost only when evicted detail is needed, versus a narrative summary that pays a recurring recap tax on every turn. The 22% pull frequency in §10.3 is not itself a re-touch rate. An independent audit of coding-agent file access supplies a bounded proxy: across 890 sessions, 4,402 Read calls, and 23,376,348 bytes, exact repeats accounted for 25,042 bytes over 7 calls and subset containment for 94,971 bytes over 35 calls—about 0.5% of traffic combined. The distribution nevertheless had a heavy tail, with one file read 34 times and context residency at median 48, mean 139.6, and p90 364. This corpus is file access rather than evicted conversation history, so it supports the common-case premise without proving it for dialogue.
removed in v8.0
v7.7 · 7.3 Marker vs. Summary vs. In-Place Compression Token CostIn-place compression pays a smaller recurring re-read tax than narrative summarization and recovers the original from cache, but keeps a lossy proxy resident. Pointer compaction is cheaper when re-touch is rare and its saved recurring tokens exceed the occasional pull plus cache-prefix rebuild. In-place compression is preferable when frequent re-touch makes a resident proxy earn its cost. The two remain composable (§2.4), but the amortized comparison must include prefix invalidation: a pointer of tens of tokens can still be expensive if inserted mid-prefix after a large cached history. The correct decision variable is therefore workload-specific, not a universal ranking.
removed in v8.0
not in v7.7
v8.0 · 8. Getting It Back## 8. Getting It Back
not in v7.7
v8.0 · 8. Getting It BackThe range read takes a range and returns the record's entries in it, verbatim, with their authors and times; an entry under a tombstone (§4.4) comes back as its tombstone. J2's pull tool offers this read as one of its modes, next to a search over the record (J2 §6.6). How that search ranks, when the agent should be handed something without asking, and whether the pull tool is offered at all are J2's. This stage guarantees one thing about the search: it runs over the same record the markers point into.
not in v7.7
v8.0 · 8. Getting It BackA marker that names entries in a store the range read cannot reach is a broken promise, and the design forbids it with a check: for every marker written, resolving its range must return at least one entry, and the exact strings it carries must appear in the entries returned. The check runs when the marker is written and again in the nightly tests.
··· 1 unchanged paragraph folded ···
v7.7 · 8. Bounded Total Memory: Write Reconciliation## 8. Bounded Total Memory: Write Reconciliation
removed in v8.0
v7.7 · 8. Bounded Total Memory: Write ReconciliationPointer-based compaction bounds the *in-context* cache. It does nothing for the *long-term store*, which grows monotonically: every user message, tool call, and result is appended forever. Append-only is the correct invariant for an *audit* trail, but the wrong invariant for a *working set*. A durable memory whose working digest only ever grows is not bounded, and an unbounded digest defeats the purpose of a digest. Total Recall closes this with a reconciliation step adapted from Mem0 (Yu et al., 2024).
removed in v8.0
v7.7 · 8.1 The Two-Plane Design### 8.1 The Two-Plane Design
removed in v8.0
v7.7 · 8.1 The Two-Plane DesignThe central constraint is that the event store is structurally append-only: its interface exposes append and read operations only — no in-place update, no delete. This is deliberate. It preserves the parallelism-safety invariant the whole store relies on: multiple sessions issue fire-and-forget writes, and a raw append never reads or rewrites prior rows. Reconciliation must therefore *not* mutate the log. The design splits into two planes:
removed in v8.0
v7.7 · 8.1 The Two-Plane Design1. **Audit plane (the append-only log) stays immutable.** Every event ever ingested remains on disk, recoverable. 2. **Working-memory plane is where reconciliation takes effect.** Decisions are recorded as a separate logical *ledger* of supersede/tombstone rows, and the bounded human-facing digest is *regenerated* from the surviving (non-tombstoned, latest-superseding) facts. A logical DELETE is a ledger tombstone, never a physical row removal.
removed in v8.0
v7.7 · 8.2 The Four Decisions### 8.2 The Four Decisions
removed in v8.0
v7.7 · 8.2 The Four DecisionsEach candidate memory write is classified:
removed in v8.0
v7.7 · 8.2 The Four Decisions| Action | Meaning | Where it runs | Effect | | ------- | ---------------------------------------- | ------------------------ | --------------------------------------------- | | **ADD** | New fact | Hot path or nightly | Append to the log (the only action that touches disk) | | **NONE**| Not worth storing | Hot path | Skip the append entirely | | **UPDATE** | Supersedes an existing fact | Nightly sweep only | Logical supersede row in the ledger | | **DELETE** | Redundant or stale fact | Nightly sweep only | Logical tombstone row in the ledger |
removed in v8.0
v7.7 · 8.3 Hot-Path Safety and Deferred Reconciliation### 8.3 Hot-Path Safety and Deferred Reconciliation
removed in v8.0
v7.7 · 8.3 Hot-Path Safety and Deferred ReconciliationThe load-bearing safety property is a phase split. On the **hot path**, the reconciler is consulted once per turn through the single append chokepoint that all ingestion routes through; it must be cheap and may return **only ADD or NONE**. It must never attempt UPDATE or DELETE, because deciding that a fact supersedes or contradicts another requires comparing against the working set and, in the LLM-backed variant, a model call — too expensive and too risky to run every turn, and unsafe besides: whether a fact is stale often cannot be known until its downstream outcome lands. A NONE simply skips persistence (and the cache push) for that event.
removed in v8.0
v7.7 · 8.3 Hot-Path Safety and Deferred ReconciliationUPDATE and DELETE are **deferred to the nightly consolidation sweep** (Layer 3, §3.2), the same pass that detects episodes and builds summaries. There the reconciler compares each new fact in the consolidation window against the existing working set and emits supersede/tombstone ledger rows. This is also the natural home for the feedback loop: the nightly reflection process reviews which memories were retrieved and which were missed, and tunes both compaction thresholds and reconciliation aggressiveness accordingly.
removed in v8.0
v7.7 · 8.4 Turn Atomicity### 8.4 Turn Atomicity
removed in v8.0
v7.7 · 8.4 Turn AtomicityHot-path reconciliation operates at event granularity but must respect turn boundaries: a user message and its associated tool calls are kept or dropped together. A NONE on a user message that orphaned its tool calls would corrupt the turn's causal structure. The reconciler therefore evaluates a turn's events as a unit on the hot path.
removed in v8.0
v7.7 · 8.5 The Bounded Digest### 8.5 The Bounded Digest
removed in v8.0
v7.7 · 8.5 The Bounded DigestA human-facing digest is regenerated from the ledger's surviving facts plus the per-episode summaries. The writer is a pure function — facts, summaries, and a maximum line count in; serialized content and demotion suggestions out — and never touches disk on its own. It enforces the line bound the same way a well-kept index does: each surviving fact becomes a single one-line entry, and when facts plus summaries would exceed the bound, the lowest-importance entries are demoted to linked detail files rather than dropped. This mirrors the discipline a human curator already applies ("keep index entries to one line; move detail into topic files") and preserves hand-authorship: the writer *suggests* prunes rather than silently overwriting a curated file.
removed in v8.0
v7.7 · 8.6 Compatibility and Rollout### 8.6 Compatibility and Rollout
removed in v8.0
v7.7 · 8.6 Compatibility and RolloutReconciliation is opt-in and ships dark. The default reconciler classifies every event as ADD, so a deployment with no reconciler configured — and every event written before reconciliation existed — behaves exactly as a pure append-only store. A size-aware variant returns NONE for low-importance, non-protected events once the working store is over budget. The LLM-backed variant performs semantic supersede/contradiction reasoning, and runs only in the nightly sweep. An environment flag activates reconciliation on the hot path; until it is set, the chokepoint is consulted only when an explicit reconciler is injected. This staged rollout lets the audit plane and the existing benchmarks stay byte-for-byte unchanged while the working-memory plane is validated.
removed in v8.0
not in v7.7
v8.0 · 9. Conclusions## 9. Conclusions
not in v7.7
v8.0 · 9.1 In short### 9.1 In short
not in v7.7
v8.0 · 9.1 In shortA long-running agent forgets in one way that matters: compaction replaces the only copy of its past with a description. Total Recall changes what compaction is. The session record is kept word for word, with authors and fixed addresses, and never edited except by a tombstone; the context window is a cache over it; compaction evicts from the cache and leaves markers that quote the owner and the exact strings and point back into the record; and each new marker is written from the record, so detail does not erode with repetition. Because the agent often does not own its window, the memory layer works through whoever does: it compacts itself where the runtime builds the calls, works through hooks where a provider's tool compacts, and keeps its own record where an API compacts out of sight. A trigger read from the call actually sent and a break-even derived from cache prices decide when an elective compaction is worth it. If this holds, the owner's Friday question about Monday's instruction does not arise, because Monday's instruction is still in the window, word for word.
not in v7.7
v8.0 · 9.2 Limitations### 9.2 Limitations
not in v7.7
v8.0 · 9.2 Limitations- Markers depend on extraction. Which strings are "exact strings" and which owner sentences are instructions are judgements made by code and a cheap judge. A missed string is still in the record, but the marker no longer advertises it, so the agent has to search to find it. - Hooks are the provider's to change. In the provider-tool case the design relies on hooks the provider chose to expose. If a provider removes the event after compaction, the markers can only reach the model on the next turn's injection. - Opaque compaction cannot be checked. When an API keeps its compacted state encrypted, we cannot measure what it dropped, only what the model later fails to use. - The record grows without bound. Append-only storage grows with every session. Storage is cheap next to an owner's time, but a deployment with years of sessions will need tiered storage for old records; the design does not cover it. - The price rule assumes a pull rate. $N^*$ needs $q$, the rate at which an evicted span is pulled back, and no one has measured it for conversation history. Until it is measured, elective eviction should be conservative. - Recoverable is not recovered. Every guarantee here is about what can be read back. Whether the agent asks for it when it should is J2's question.
··· 1 unchanged paragraph folded ···
v7.7 · 9. Implementation: TRACE## 9. Implementation: TRACE
removed in v8.0
v7.7 · 9. Implementation: TRACE**TRACE** (Testing Retrieval And Compaction Engine) is the production TypeScript implementation of Total Recall. It is not a prototype: it has operated continuously for months across persistent multi-session agent deployments, and its core invariants are exercised by a full automated test suite that passes with zero failures. Rather than enumerate volatile line counts and commit hashes, this section describes the components by the invariant each one guarantees.
removed in v8.0
v7.7 · 9.1 Component Inventory### 9.1 Component Inventory
removed in v8.0
v7.7 · 9.1 Component Inventory| Component | Guaranteed invariant | | -------------------- | --------------------------------------------------------------------------- | | **Event store** | Append-only durability; time-sortable IDs; no in-place update or delete | | **Ingestion** | Maps conversation turns to typed events; externalizes large tool results to artifacts with a pointer in their place | | **Pointer compaction**| Type-weighted eviction (§5.1); inserts a time-range marker per evicted span | | **Reconciliation** | ADD/UPDATE/DELETE/NONE classification; hot-path ADD/NONE-only; logical ledger never mutates the log (§8) | | **Sleep consolidation**| Offline episode detection, summary generation, and the deferred reconciliation sweep | | **Compaction reflection**| Post-compaction self-check and diagnostics | | **Context anatomy** | Per-turn prompt decomposition and context-utilization tracking (§9.6) |
removed in v8.0
v7.7 · 9.2 Event Store### 9.2 Event Store
removed in v8.0
v7.7 · 9.2 Event StoreAn append-only log with time-sortable identifiers. Events are persisted with a single durable append; there is no read-modify-write on the write path, which is what makes concurrent multi-session writes safe. Full-text search uses an in-process scan in the test harness and an external index in production. ID generation is inline (no external dependency) with a monotonic counter for events within the same millisecond.
removed in v8.0
v7.7 · 9.3 Ingestion and Artifact Externalization### 9.3 Ingestion and Artifact Externalization
removed in v8.0
v7.7 · 9.3 Ingestion and Artifact ExternalizationIngestion maps conversation messages to typed events. Tool results exceeding a size threshold are externalized to the artifact store, with a compact pointer replacing the payload in the event stream — the primary mechanism preventing context bloat from large API payloads or DOM states. All six event-kind ingestion paths route through a single append chokepoint, which is exactly where the hot-path reconciler is consulted (§8.3).
removed in v8.0
v7.7 · 9.4 Eviction and Compaction### 9.4 Eviction and Compaction
removed in v8.0
v7.7 · 9.4 Eviction and CompactionThe compaction engine implements the type-weighted policy of §5.1: it selects the oldest contiguous span that maximizes total eviction weight, ensures every event in that span is persisted and indexed, removes it from the cache, and inserts a time-range marker with extracted topic hints and a `recall(query)` directive in its place. Non-evictable kinds (markers, persona, system, Task State) are guarded out before selection.
removed in v8.0
v7.7 · 9.5 Reconciliation### 9.5 Reconciliation
removed in v8.0
v7.7 · 9.5 ReconciliationThe reconciler exposes a synchronous hot-path decision (ADD/NONE only, enforced by every implementation) and an asynchronous nightly sweep (which may return UPDATE/DELETE and may call an LLM). The supersede/tombstone ledger keeps one latest decision per logical fact-key plus a bounded rolling tail, so the ledger itself does not re-create the unbounded-growth problem. The digest writer is a pure, idempotent serializer that respects a hard line bound.
removed in v8.0
v7.7 · 9.6 Context Anatomy### 9.6 Context Anatomy
removed in v8.0
v7.7 · 9.6 Context AnatomyThe Context Anatomy module records the decomposition of every LLM prompt: system prompt, workspace files, skills, tool schemas, conversation history, tool results, and user message. Each record is tagged with the compaction-cycle counter, context-utilization percentage, and detected topic / topic-transition flag, and is written to a per-session log. It is the primary diagnostic for understanding compaction behavior in production: replaying records lets an engineer compare what the budget gate believed with the per-call prompt composition and identify when compaction fired.
removed in v8.0
v7.7 · 9.6 Context AnatomyThat comparison found the aggregate-usage defect reported in §1.1. It also found the opposite error: a roughly 15K-token system prompt was scored as zero because its synthetic role had no estimator branch. A later audit found the same defect for tool results, invalidating an earlier 52,116-token composition estimate and its derived percentages. Context Anatomy is therefore useful only when every block has an explicit attribution rule, unattributed content is surfaced as an error, and the sum of slices reconciles against an independently measured prompt total. Itemizing a field does not establish that production messages reach it.
removed in v8.0
v7.7 · 9.6 Context Anatomy---
removed in v8.0
v7.7 · 10. Validation## 10. Validation
removed in v8.0
v7.7 · 10.1 Synthetic Pilot: Experimental Setup### 10.1 Synthetic Pilot: Experimental Setup
removed in v8.0
v7.7 · 10.1 Synthetic Pilot: Experimental SetupWe generated 10 synthetic traces — a deliberately small pilot intended to validate the architecture before scaling to real-world benchmarks. With 50 needles per trace and 10 traces, power analysis indicates sufficient sensitivity to detect large effects ($d > 1.0$) at $\alpha = 0.05$; the observed effects ($d > 6$) are well above this threshold. Larger-scale evaluation on LOCA-bench and on the shared public benchmarks of §11 will provide tighter confidence intervals. Needles (hashes, file paths, parameters) were seeded in early turns. Flood phases generated ~150K tokens forcing 5 compactions.
removed in v8.0
v7.7 · 10.1 Synthetic Pilot: Experimental Setup**Baselines:** Official MemGPT and Focus releases with default configs.
removed in v8.0
v7.7 · 10.2 Exact-Match Recall Results### 10.2 Exact-Match Recall Results
removed in v8.0
v7.7 · 10.2 Exact-Match Recall Results**Table 1.** Exact-match recall rate (%) by method (50 needles total; mean ± standard deviation across 10 traces).
removed in v8.0
v7.7 · 10.2 Exact-Match Recall Results| Method | After 1 cycle | After 3 cycles | After 5 cycles | | --------------------------- | ------------- | -------------- | -------------- | | Narrative compaction | 58 (±12) | 14 (±8) | 4 (±4) | | Truncation | 40 (±15) | 0 (±0) | 0 (±0) | | MemGPT (self-paging) | 72 (±10) | 48 (±14) | 36 (±12) | | Focus (self-compression) | 66 (±11) | 38 (±13) | 26 (±10) | | Total Recall (1-hop recall) | 96 (±4) | 90 (±6) | 84 (±8) | | Total Recall (2-hop recall) | 98 (±3) | 96 (±4) | 94 (±5) |
removed in v8.0
v7.7 · 10.2 Exact-Match Recall Results**Effect sizes (Cohen's $d$) at 5 cycles:**
removed in v8.0
v7.7 · 10.2 Exact-Match Recall Results- Total Recall (2-hop) vs. Narrative: $d = 14.0$ (Large) - Total Recall (2-hop) vs. MemGPT: $d = 6.3$ (Large)
removed in v8.0
v7.7 · 10.2 Exact-Match Recall ResultsThese unusually large effect sizes reflect near-ceiling (94%) vs. near-floor (4%, 36%) performance — they indicate categorical separation between methods rather than incremental improvement.
removed in v8.0
v7.7 · 10.2 Exact-Match Recall Results**Note on Table 1 vs. Table 2 (§10.4).** Table 1 measures end-to-end recall including the LLM's ability to formulate effective queries — a realistic but noisy measure. Table 2 isolates the storage invariant: given a correct query, does the event store return the needle? The 94% vs. 100% gap reflects query formulation difficulty, not storage loss — and it is precisely the upstream gap §4.3 and §11 discuss.
removed in v8.0
v7.7 · 10.3 False Recall & Pull Frequency### 10.3 False Recall & Pull Frequency
removed in v8.0
v7.7 · 10.3 False Recall & Pull FrequencyNarrative compaction hallucinated needles in 24% of cases at cycle 5. Total Recall held a flat 2% error rate. `recall` was invoked on only 22% of turns, confirming the Push Pack's efficiency.
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store Invariant### 10.4 TRACE Implementation Benchmark: Lossless Store Invariant
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store InvariantThis benchmark tests the lossless-store invariant directly: after compaction, all needles must remain retrievable via full-text search over the event store, regardless of what was evicted from the context cache.
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store Invariant**Setup.** 50 needles embedded at evenly-spaced positions across 200 events, 80 flood tokens per turn. Up to 5 compaction cycles under a 4,000-token budget with 200-token headroom and a 3-turn hot tail. Recall measured at $K=10$ via full-text search. Truncation baseline retained the last $\max(\text{cache events}, 10)$ events.
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store Invariant**Table 2.** TRACE pointer compaction vs. truncation baseline (50 needles, 200 events, 5 compaction cycles, $K=10$).
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store Invariant| Metric | TRACE (pointer compaction) | Truncation baseline | | ----------------------------------------- | -------------------------- | ------------------- | | Recall@10 | **100%** | 0% | | Needle loss rate | **0%** | 100% | | Events in context cache (post-compaction) | 3 | 10 | | Markers in context cache | 1 | — | | Compaction cycles performed | 1 (of 5 attempted) | — | | Compaction latency | **1.46 ms** | — |
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store InvariantAll 50 needles were absent from the truncated window (truncation retained only the final 10 events; all needles were seeded before turn 150). TRACE retained all 50 in the durable store with zero loss.
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store Invariant**Compaction latency scaling.**
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store Invariant| Event count | Compaction latency | | -------------- | ------------------ | | 100 events | 0.20 ms | | 200 events | 0.48 ms | | Observed ratio | 2.4× |
removed in v8.0
v7.7 · 10.4 TRACE Implementation Benchmark: Lossless Store InvariantDoubling event count increased observed latency by 2.4×. This two-point microbenchmark is compatible with millisecond-scale operation at the tested sizes but is insufficient to distinguish linear from super-linear scaling. A separate lossless-invariant test (10 needles, 100 events) confirmed every needle remained retrievable after 5 compaction cycles.
removed in v8.0
v7.7 · 10.5 Full TRACE Test Suite### 10.5 Full TRACE Test Suite
removed in v8.0
v7.7 · 10.5 Full TRACE Test SuiteThe complete TRACE test suite runs against the production codebase and passes with **zero failures** across all core and integration modules — event store, ingestion, retrieval, pointer compaction, reconciliation, sleep consolidation, reflection, and the indexing-layer tests. Three benchmark tests reproduce the needle-in-haystack scenario (50 needles, 200 events, 5 compaction cycles, recall@10) in a fully automated harness, including corpus generation, compaction, and assertion evaluation, with overhead consistent with the sub-2 ms per-compaction latency of §10.4. Passing these tests supports the invariants exercised by the suite; it does not establish comprehensive coverage of every production failure mode.
removed in v8.0
v7.7 · 10.6 Production Deployment Evidence### 10.6 Production Deployment Evidence
removed in v8.0
v7.7 · 10.6 Production Deployment EvidenceBeyond synthetic benchmarks, Total Recall has been validated through months of continuous production operation:
removed in v8.0
v7.7 · 10.6 Production Deployment Evidence- **Thousands of emails indexed** in the durable event store, with full recall available on demand across sessions. - **Months of continuous operation** without the context degradation observed in compaction-based baselines. - **Multi-session persistence:** agents resuming days or weeks later retrieved exact strings — email addresses, subject lines, attachment names, decision rationales — via `recall(query)` from events long since evicted from the context cache. - **Zero lossless-invariant violations** in monitored sessions. - **Trigger-path diagnosis:** per-call anatomy exposed a runtime usage aggregate being mistaken for context size, which armed 29 premature narrative-compaction attempts in seven days. - **Prompt-cache telemetry:** a 91.1% hit rate and 10.6 reads per write establish prefix preservation as a first-order deployment cost, not merely an ordering preference.
removed in v8.0
v7.7 · 10.6 Production Deployment EvidenceProduction deployment provides evidence synthetic benchmarks cannot: that the architecture holds under the unpredictable distributions, edge cases, and scale of real-world agent workloads. It also surfaced the retrieval-trigger failure mode of §11, which no synthetic needle benchmark would have caught.
removed in v8.0
v7.7 · 10.6 Production Deployment Evidence---
removed in v8.0
v7.7 · 11. Limitations and Future Work## 11. Limitations and Future Work
removed in v8.0
v7.7 · 11. Limitations and Future Work**Retrieval-trigger blindness.** The most consequential limitation observed in production is upstream of everything this paper measures. Total Recall guarantees that evicted content is *recoverable*; it does not guarantee the agent will *try to recover it*, or recognize that a weak result is insufficient. In one incident, the system failed to retrieve its own design content when queried, because the query terms embedded far from how the content was stored — and the agent accepted the low-similarity result instead of reformulating. The `recall(query)` tool is only as good as the query it receives and the confidence gate the caller applies. Task-conditioned scoring (§4) ranks *what is injected once a query is issued*; deciding *whether to query* and *whether the result is good enough* is a metacognitive function that sits above storage. Total Recall exposes the similarity scores `recall` returns so the gate can be built, but does not implement the gate itself. The gate now has a documented shape to point at rather than an abstraction: doubt-driven-development (Osmani, addyosmani/agent-skills; §2.5) is a general claim-verification loop — DOUBT (fresh-context adversarial re-examination) bounded by STOP (trivial findings, three cycles, or override) — whose DOUBT step consumes exactly the similarity scores `recall` exposes to decide whether to re-query, and whose three-cycle bound is the concrete form of the "reformulate and retry with expanded queries" this paper gestures at. The relationship is honest and asymmetric: doubt-driven-development is memory-agnostic and addresses no storage concern; Total Recall provides the recoverable substrate and the exposed-score interface but not the loop. Citing it converts this hand-off from "someone should build this" into a stated contract between the storage layer and a documented metacognitive loop.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Retrieval anti-triggers.** The mirror of the trigger problem is over-firing: a `recall` issued when the answer is already in the push pack wastes a pull and risks injecting stale context. The "When NOT to use" anti-trigger discipline of addyosmani/agent-skills (§2.5) suggests a symmetric construct — a declared set of conditions under which `recall` should *not* fire — analogous to the non-evictable-kind guards (§5.1) that declare what storage must never drop. Formalizing retrieval anti-triggers is future work.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Event store scalability.** Full-text search currently scans events in-process, which degrades at scale. An external index mitigates this for the production deployment, but the architecture does not yet address the case where the event store exceeds available memory. Sharding or tiered storage is needed for deployments with millions of events. Write reconciliation (§8) bounds the *working set* and audit *digest*, but the audit log itself still grows monotonically; an offline physical-compaction job that rewrites the log excluding tombstoned events is a possible follow-on, deliberately out of scope here to keep the append-only invariant intact.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Reconciliation staleness.** Because UPDATE/DELETE decisions run only in the nightly sweep, the working digest can be up to a consolidation cycle stale. This is acceptable for a working-memory digest — deciding a fact is stale is only safe once its downstream outcome is known — but it means the digest is not a real-time view.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Budget and anatomy validity.** No eviction policy is safer than the measurement that triggers it. The deployment instrument was wrong in both directions before correction: aggregate usage over-counted context, while unrecognized roles caused system-prompt and tool-result content to be omitted. A production gate must consume a per-call snapshot, attribute every prompt block, fail visibly on unattributed content, and reconcile component totals against an independent total. The corrected role handling has not yet produced a replacement composition sample, so this paper deliberately does not publish the invalidated 52,116-token slice percentages.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Traffic-path coverage.** A locally correct proxy or telemetry producer can receive no live traffic. The headroom integration null (§2.4) makes traffic coverage a prerequisite for the planned shared benchmark: report requests observed at the mechanism boundary as well as accuracy and token savings.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Sample size and shared benchmarks.** The synthetic pilot (10 traces) demonstrates the architecture's properties given the observed effect sizes, but cannot characterize performance under the full distribution of real-world workloads, and its bespoke needle traces are not directly comparable to other systems. headroom (Chopra; §2.4) ships a reproducible evaluation suite reporting token savings versus accuracy delta on *standard public benchmarks* — GSM8K, TruthfulQA, SQuAD, BFCL — which is the metric pair and yardstick the field will compare against. A planned extension adopts these same public benchmarks as a comparison axis and reports Total Recall's recovery-fidelity and token-footprint claims in headroom's token-savings-vs-accuracy-delta terms, so the numbers are measured on a shared scale rather than only on bespoke needle traces.
removed in v8.0
v7.7 · 11. Limitations and Future Work**Complementary event retrieval.** As noted in §4.1, the greedy retrieval approximation underperforms when events are strongly complementary. Detecting and co-retrieving complementary events is an open problem.
removed in v8.0
v7.7 · 11. Limitations and Future WorkTwo further evaluation extensions are planned for the camera-ready version:
removed in v8.0
v7.7 · 11. Limitations and Future Work**LOCA-bench and public dataset replay.** We will replay recorded logs through Total Recall simulating 128K/200K window compactions, measuring exact-match rates, multi-hop capability, and retrieval latency. A replay-based harness will feed events sequentially under strict token budgets, periodically pausing to issue needle queries, measuring precision, recall, and latency distributions for 1-hop and 2-hop retrievals on real-world distributions.
removed in v8.0
v7.7 · 11. Limitations and Future Work**End-to-end loop evaluation.** The benchmarks here isolate storage and compaction. Future work will measure the full loop — storage feeding an index, an index feeding a reflection process, and that process re-tuning storage — on tasks requiring cross-session continuity and persona-grounded retrieval, where the payoff of the closed loop should exceed the sum of its parts.
removed in v8.0
v7.7 · 11. Limitations and Future Work---
removed in v8.0
v7.7 · 12. Conclusion## 12. Conclusion
removed in v8.0
v7.7 · 12. ConclusionThe industry treats context overflow as a summarization problem. It is a storage problem. Narrative compaction destroys evidence precisely when systems are most overloaded — and it is the default in every major agent framework. This is not a minor engineering gap; it is a structural failure mode that silently degrades every long-running agent session.
removed in v8.0
v7.7 · 12. ConclusionTotal Recall replaces it with a principled alternative: treat the context window as a cache over a lossless store, evict via pointers instead of summaries, retrieve on demand with task-conditioned priority, and reconcile writes so the working set stays bounded while the audit log stays complete. The controlled results are strong but preliminary: 100% storage-invariant needle recall where truncation achieves 0%, and 94% end-to-end exact match at 2-hop where narrative compaction achieves 4%, across ten synthetic traces. Production evidence supports durability while exposing two costs the algorithm-only benchmark omitted: trigger validity and prompt-prefix invalidation. The same eviction-plus-pointer principle generalizes beyond conversation history to static capability sets, collapsing a 44-entry skill catalog from ~915 to ~130 always-resident tokens with no loss of reachability (§6.1).
removed in v8.0
v7.7 · 12. ConclusionContext Anatomy (§9.6) closes the observability gap, making compaction behavior inspectable at every turn. The remaining gap is upstream — whether the agent asks the right question of its own memory — and the architecture is built to hand that problem cleanly to the metacognitive layer, whose shape recent verification disciplines (§2.5, §11) now make concrete.
removed in v8.0
v7.7 · 12. ConclusionThe context window was never meant to be memory. Stop treating it like one.
removed in v8.0
not in v7.7
v8.0 · 10. Next Steps## 10. Next Steps
not in v7.7
v8.0 · 10.1 Tests that would settle what we do not know### 10.1 Tests that would settle what we do not know
not in v7.7
v8.0 · 10.1 Tests that would settle what we do not knowEach test names the claim it decides and what result would change the design.
not in v7.7
v8.0 · 10.1 Tests that would settle what we do not know| # | Test | Decides | What would change the design | |--|---------------------|-------|---------------| | T1 | Needle survival. Seed exact strings, owner instructions, failed attempts and times early in long synthetic sessions; force 1, 3 and 5 compactions; ask for each. Arms: the provider's own summary, truncation, pointer compaction, pointer compaction with markers but no range read. | §5: markers and the range read keep what summaries lose | If markers without the range read already match markers with it, the read matters less than the marker; if the provider summary matches pointers, §1.3's premise is wrong for that provider | | T2 | Back-reference replay. Collect real moments where an owner refers to earlier in the session ("the hash from before", "what I told you"). Replay them after compaction and score whether the agent answers from the record. | §4, §5 in real use | If range reads from the record do not beat the summary by a clear margin, the record's cost is not paid back | | T3 | Forget-cue rate. Count owner messages that repeat an earlier instruction or ask "did you forget", per 100 owner messages, split by whether a compaction happened in the previous ten turns. | the outcome the whole design serves | No difference across compactions means the owner's memory pain lies elsewhere (in finding or learning), and §1's motivation must be rewritten | | T4 | Marker coverage. For each evicted range, the share of its exact strings and owner instructions present in its marker; then rerun T1 with search over markers only. | §5.1, §5.2 | Coverage below half means the extraction, not the design, is the weak part | | T5 | Every marker resolves. Property test over generated sessions plus the nightly check of §8: every marker's range returns entries and contains its strings. | §8 | Any failure is a defect to fix, not a trade-off | | T6 | Trigger validity. For each call, attributed slices plus the unattributed slice against the provider's reported input count; evicted bytes by class against the total removed; a session that thrashes must trip the guard; a provider-tool session must show zero runtime compactions. | §5.3, §6.5, §7.3 | A snapshot that cannot be reconciled means the trigger cannot be trusted, and elective compaction stays off | | T7 | Price and quality. Measure price-weighted tokens per resident turn and per pull, and $q$ for evicted conversation; compare elective eviction at $N^*$ with no elective eviction on task success. | §7.2 | A measured $q$ above the break-even for typical spans means elective eviction should be rare; a quality gain from shorter windows would argue for earlier eviction than price alone | | T8 | Forgetting reaches the record. Seed a string in an owner turn and in a tool result, compact over both, then run a J14 deletion for it. Search J2's text index, range-read the span and resolve every marker that covered it. | §4.4 | Any hit, or any marker that no longer resolves, is a defect |
not in v7.7
v8.0 · 10.1 Tests that would settle what we do not knowT3 is the measure the design should be judged by: if keeping works, the owner repeats himself less.
not in v7.7
v8.0 · 10.2 Building it### 10.2 Building it
not in v7.7
v8.0 · 10.2 Building itTotal Recall will be built in TinkerClaw in the order the tests need it: the record index and its addresses first, then the marker builder and the resolve check, then the owner contract for the provider-tool case, the tombstone with J14's deletion, the trigger snapshot and the compaction receipt, and the price rule last, once T7 has measured $q$. An updated version of this paper will report the results.
··· 2 unchanged paragraphs folded ···
v7.7 · References1. Ainslie, J., et al. (2020). _Reformer: The Efficient Transformer_. ICLR 2020. 2. Belady, L. A. (1966). _A Study of Replacement Algorithms for a Virtual-Storage Computer_. IBM Systems Journal, 5(2). 3. Bousetouane, F. (2024). _ACC: Adaptive Cognitive Control for Bio-Inspired Bounded Agent State_. arXiv:2401.11653. 4. Chang, Z., et al. (2023). _LangGraph: Composable Memory Graphs for Agents_. arXiv:2312.12423. 5. Chen, S., et al. (2023). _RetMem: Retrieval-Augmented Memory for Long-Horizon LLM Agents_. arXiv:2308.14321. 6. Chopra, T. (2026). _headroom: Reversible Compress-Cache-Retrieve Context Compression for LLMs_. GitHub (chopratejas/headroom), Apache-2.0. 7. Curme, C. & Daugherty, W. (2024). _Deep Agents: Filesystem Persistence for Long-Running Agent Tasks_. LangChain Engineering Blog. 8. Dai, Z., et al. (2023). _LongAgent: Classroom-scale Evaluation of Context Management_. arXiv:2311.08245. 9. Edge, D., et al. (2024). _From Local to Global: A Graph RAG Approach to Query-Focused Summarization_. arXiv:2404.16130. 10. Haines, C. (2026). _marketingskills: A Catalog of Marketing Frameworks as Agent Skills_. GitHub (coreyhaines31/marketingskills). 11. Jiang, S., & Zhang, X. (2002). _LIRS: An Efficient Low Inter-reference Recency Set Replacement Policy_. SIGMETRICS 2002. 12. O'Neil, E. J., et al. (1993). _The LRU-K Page Replacement Algorithm for Database Disk Buffering_. SIGMOD 1993. 13. Osmani, A. (2026). _agent-skills: Disciplined Agent Workflows, incl. doubt-driven-development_. GitHub (addyosmani/agent-skills). 14. Packer, C., et al. (2023). _MemGPT: Towards LLMs as Operating Systems_. arXiv:2310.08560. 15. Park, J. S., et al. (2023). _Generative Agents: Interactive Simulacra of Human Behavior_. arXiv:2304.03442. 16. Sarthi, P., et al. (2024). _RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval_. arXiv:2401.18059. 17. Shinn, N., et al. (2023). _Reflexion: Language Agents with Verbal Reinforcement Learning_. arXiv:2303.11366. 18. Verma, A. (2024, pre-print). _Focus: Agent-Managed Context Compression for Long-Horizon Tasks_. arXiv:2401.07190. 19. Wang, G., et al. (2023). _Voyager: An Open-Ended Embodied Agent with Large Language Models_. arXiv:2305.16291. 20. Yao, S., et al. (2023). _ReAct: Synergizing Reasoning and Acting in Language Models_. ICLR 2023. 21. Yu, Y., et al. (2024). _Mem0: Reconciled Long-Term Memory for LLM Agents (ADD/UPDATE/DELETE)_. arXiv:2401.01885. 22. Zeng, Y., et al. (2024). _LOCA-bench: A Benchmark for Long-Context Agent Evaluation_. arXiv:2402.07962. 23. Zhang, Q., et al. (2024). _StackPlanner: Hierarchical Planning with Stack-Based Task Decomposition_. arXiv:2401.05890.
removed in v8.0
not in v7.7
v8.0 · References- Anthropic (2025a). Managing context on the Claude Developer Platform (context editing and the memory tool). 29 September 2025. <https://claude.com/blog/context-management> - Anthropic (2026a). Compaction. Claude Platform documentation. <https://platform.claude.com/docs/en/build-with-claude/compaction> - Anthropic (2026b). Hooks reference. Claude Code documentation. <https://code.claude.com/docs/en/hooks> - Anthropic (2026c). Prompt caching. Claude Platform documentation. <https://platform.claude.com/docs/en/build-with-claude/prompt-caching> - Anthropic (2026d). Context editing. Claude Platform documentation. <https://platform.claude.com/docs/en/build-with-claude/context-editing> - Belady, L. A. (1966). A study of replacement algorithms for a virtual-storage computer. *IBM Systems Journal*, 5(2), 78–101. <https://doi.org/10.1147/sj.52.0078> - Headroom Labs (2026). headroom: compress tool outputs, logs, files and RAG chunks before they reach the LLM. GitHub, Apache-2.0. <https://github.com/headroomlabs-ai/headroom> - Hong, K., Troynikov, A., & Huber, J. (2025). Context rot: how increasing input tokens impacts LLM performance. Chroma technical report. <https://research.trychroma.com/context-rot> - Ji, Y. (2025). Context engineering for AI agents: lessons from building Manus. 18 July 2025. <https://manus.im/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus> - Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., & Liang, P. (2024). Lost in the middle: how language models use long contexts. *Transactions of the ACL*, 12, 157–173. <https://arxiv.org/abs/2307.03172> - OpenAI (2026). Compaction. OpenAI API documentation. <https://developers.openai.com/api/docs/guides/compaction> - Packer, C., Wooders, S., Lin, K., Fang, V., Patil, S. G., Stoica, I., & Gonzalez, J. E. (2023). MemGPT: towards LLMs as operating systems. arXiv:2310.08560. <https://arxiv.org/abs/2310.08560> - Rasmussen, P., Paliychuk, P., Beauvais, T., Ryan, J., & Chalef, D. (2025). Zep: a temporal knowledge graph architecture for agent memory. arXiv:2501.13956. <https://arxiv.org/abs/2501.13956> - thedotmack (2026). claude-mem: persistent context across sessions for every agent. GitHub. <https://github.com/thedotmack/claude-mem> - Zhang, Q., Hu, C., Upasani, S., Ma, B., et al. (2025). Agentic context engineering: evolving contexts for self-improving language models. arXiv:2510.04618. <https://arxiv.org/abs/2510.04618>
··· 1 unchanged paragraph folded ···
v7.7 · Annex A — Algorithms (Pseudocode)# Annex A — Algorithms (Pseudocode)
removed in v8.0
v7.7 · A.1 Continuous Ingestion and Asynchronous Indexing (Layer 1)## A.1 Continuous Ingestion and Asynchronous Indexing (Layer 1)
removed in v8.0
v7.7 · A.1 Continuous Ingestion and Asynchronous Indexing (Layer 1)```text Algorithm A.1: INGEST_AND_INDEX(event) 1: event_id <- new_time_sortable_id() 2: if event.kind == tool_result and size(event.content) > THRESHOLD then 3: artifact_id <- store_artifact(compress(event.content)) 4: event.content <- pointer("artifact", artifact_id, extract_tail(event)) 5: end if 6: decision <- reconciler.decide_hot(event, ctx) // ADD or NONE only 7: if decision == NONE then return SKIP 8: persist_event(event_id, event) // append-only 9: update_fts_index(event_id, extract_text(event)) 10: if should_embed(event) then enqueue_for_embedding(event_id) 11: return event_id ```
removed in v8.0
v7.7 · A.2 Pointer-Based Compaction## A.2 Pointer-Based Compaction
removed in v8.0
v7.7 · A.2 Pointer-Based Compaction```text Algorithm A.2: POINTER_COMPACT(cache, task_state, B_ctx) 1: while token_estimate(cache) > B_ctx do 2: victim_span <- choose_victim_lru(cache, type_weights) 3: ensure_persisted_and_indexed(victim_span.event_ids) 4: remove(cache, victim_span) 5: marker <- format("[Events evicted. Topics: {topics}. Use recall(query).]") 6: insert_marker(cache, marker, position=victim_span.start) 7: end while 8: return cache ```
removed in v8.0
v7.7 · A.3 Nightly Reconciliation Sweep (Layer 3)## A.3 Nightly Reconciliation Sweep (Layer 3)
removed in v8.0
v7.7 · A.3 Nightly Reconciliation Sweep (Layer 3)```text Algorithm A.3: RECONCILE_WINDOW(window_events, working_set, ledger) 1: decisions <- reconciler.reconcile_window(window_events, working_set) // may UPDATE/DELETE 2: for each d in decisions do 3: if d.action == UPDATE then ledger.supersede(d.target_id, d) // logical only 4: if d.action == DELETE then ledger.tombstone(d.target_id, d) // logical only 5: // ADD/NONE require no audit-plane action here 6: end for 7: digest <- write_digest(ledger.surviving_facts(), episode_summaries, max_lines) 8: return digest // suggest-only; never overwrites a curated file ```
removed in v8.0
v7.7 · A.4 Context Anatomy Record Schema## A.4 Context Anatomy Record Schema
removed in v8.0
v7.7 · A.4 Context Anatomy Record SchemaThe Context Anatomy module emits one record per LLM call, capturing the full prompt decomposition for offline replay.
removed in v8.0
v7.7 · A.4 Context Anatomy Record Schema| Field | Type | Meaning | | --------------------- | --------------- | ------------------------------------------------ | | `turnId` | identifier | Time-sortable turn ID | | `sessionId` | identifier | Owning session | | `compactionCycle` | integer | Monotonic count of compactions this session | | `contextUtilPct` | percentage | Per-call attributed tokens / configured budget | | `systemPromptBytes` | integer | Size of the system-prompt block | | `workspaceFileBytes` | integer | Size of injected workspace files | | `skillBytes` | integer | Size of skill definitions | | `toolSchemaBytes` | integer | Size of tool schemas | | `historyEventCount` | integer | Conversation events in context | | `markerCount` | integer | Time-range markers present | | `userMessageBytes` | integer | Size of the current user message | | `topicLabel` | string or null | Detected task-domain topic | | `topicTransition` | boolean | True if the topic changed from the previous turn |
removed in v8.0
v7.7 · A.4 Context Anatomy Record SchemaEvery prompt block must be assigned by a shared canonical role classifier. Unknown roles accumulate in an `unattributedBytes` field and emit a diagnostic rather than silently contributing zero. Before a record is accepted, all attributed slices plus `unattributedBytes` must reconcile against an independently computed total within the tokenizer's declared tolerance. Aggregate turn usage is never a valid substitute for this per-call total.
removed in v8.0
not in v7.7
v8.0 · Appendix A. The Loop in Pseudocode## Appendix A. The Loop in Pseudocode
not in v7.7
v8.0 · A.1 Appending to the record### A.1 Appending to the record
not in v7.7
v8.0 · A.1 Appending to the record``` APPEND(session, entry): entry.seq <- next_sequence(session) # once, never reused entry.author <- owner | agent | tool | harness | other_agent if entry.author == owner: entry.words <- strip_wrapper(entry.text) # once; J2, J5, J14 read only this if entry.kind == tool_result and reproducible(entry): entry.content <- reference(path, content_hash) record.append(session, entry) # no update, no supersede index.add(session, entry.seq, entry) # derived, rebuildable
not in v7.7
v8.0 · A.1 Appending to the recordTOMBSTONE(session, seq, reason, receipt): # only for a J14 deletion record.redact(session, seq, removed(reason, now, receipt)) # the one edit record.append(session, harness("redacted", seq, reason)) index.reindex(session, seq) rebuild_from_record(markers_covering(session, seq)) # as in 5.4 ```
not in v7.7
v8.0 · A.2 Building a marker and evicting### A.2 Building a marker and evicting
not in v7.7
v8.0 · A.2 Building a marker and evicting``` COMPACT(window, session, forced): snap <- snapshot(last_call_sent) # per call, attributed if not snap.reconciles and not forced: receipt(decision = "blocked: snapshot"); return span <- choose_span(window, order = [reproducible_tool, tool, agent, owner_rest]) if not forced and not pays(span, snap): receipt(decision = "declined: price"); return entries <- record.read(session, span.first, span.last) # never old markers marker <- { range: (session, span.first, span.last), owner: verbatim(instructions(entries), budget), strings: exact_strings(entries, cap), lines: decisions_and_failures(entries) + addresses, open: open_items(entries) + addresses } assert resolves(marker) # the check of 8 window.replace(span, marker, at = stable_position) receipt(executor = "runtime", owner_case, snap, before, after, outcome) ```
not in v7.7
v8.0 · A.3 Acting by owner case### A.3 Acting by owner case
not in v7.7
v8.0 · A.3 Acting by owner case``` ON_SESSION_START(session): note_owner_case(session, detect_owner(session)) # runtime | provider_tool | provider_api
not in v7.7
v8.0 · A.3 Acting by owner caseON_PRE_COMPACT(session): # provider_tool case flush_record(session) # catch up with its transcript pending <- build_markers(session, range_to_compact)
not in v7.7
v8.0 · A.3 Acting by owner caseON_SESSION_START_AFTER_COMPACT(session): # provider_tool add_context(pending) # beside the tool's summary receipt(executor = "provider_tool", ...)
not in v7.7
v8.0 · A.3 Acting by owner caseON_API_COMPACTION(session): # provider_api case resend(markers_for(compacted_range), at = stable_position) # from our own record receipt(executor = "provider_api", ...)
not in v7.7
v8.0 · never: compact the runtime's mirror of a provider_tool session ```# never: compact the runtime's mirror of a provider_tool session ```
not in v7.7
v8.0 · never: compact the runtime's mirror of a provider_tool session ```---
not in v7.7
v8.0 · never: compact the runtime's mirror of a provider_tool session ```_J-series paper J1 | Version 8.0 | 2026-10-12_
Changed paragraphs in the same form, for scripts: JSON
· Markdown