# Total Recall: The Context Window as a Cache Over the Session Record: v8.1 → v8.2

From v8.1 (12 Oct) to v8.2 (12 Oct): 9,850 words to 9,482 words, 1,781 words in new or rewritten paragraphs and 2,149 taken out, 96 paragraphs changed.

## Change note of v8.2

**Tightened: abstract and most sections shorter, a few details added**

Mostly tightening. The abstract is cut from about 400 to 226 words, related work and the limitations are shorter, and nearly every section loses a few sentences. A few sections grow: what goes into the record, sessions that are never kept, and the case where a provider's API controls part of the window.

## Changed paragraphs

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

### Abstract

Think of the colleague you trust with a long job. On Monday you tell them the server name, the [-one-] command [-they must-] never {+to+} run [-in daytime,-] {+by day+} and the fix you [-already tried. On-] {+tried; on+} Friday they still know all three, [-and if a detail has slipped they-] {+or+} look [-it up in their notes instead of asking you again.-] {+them up.+} We would like [-to hand-] an AI agent [-work that runs for days in-] {+we can trust+} the same way.

### Abstract

But an agent reads only what fits in its context [-window, and when the window-] {+window. When it+} fills, [-something has to leave. Usually-] a model [-writes a summary of-] {+usually summarises+} the old part, [-and from then on the summary is all the model reads of it. The full history may still sit in a log, but nothing in the window says what is there or how to reach it, and the summary keeps-] {+keeping+} the gist [-while-] {+and+} dropping what a long job needs: [-the-] exact strings, the cause of a failure, the attempt that [-did not work,-] {+failed,+} the owner's own words. [-Often-] {+Nothing in+} the [-agent-] {+window points to the full log, and often a provider+} does [-not even control its window: a provider's tool or API decides when to compact and writes-] the [-summary itself.-] {+compacting.+}

### Abstract

[-Here we-] {+We+} propose Total Recall, a design for {+keeping,+} the first stage of an agent's [-memory, keeping.-] {+memory.+} The [-full-] session [-record, every turn word for word,-] {+record+} is the ground [-truth,-] {+truth+} and the context window [-is-] a cache over it. [-Compaction-] {+Compaction, through the hooks of whoever controls the window,+} leaves a [-small-] marker [-in place of what it evicts, with-] {+carrying+} the {+evicted+} range's address, its exact strings and the owner's instructions word for [-word, so any line can be read back exactly. Whoever controls the window, the memory layer acts through that controller's own hooks.-] {+word.+}

### Abstract

[-For the agent you run, this means every instruction you give stays recoverable word for word, and stays in view for as long as your instructions fit a fixed budget; a hash from three hours ago comes back exactly; and each compaction is priced before it happens. The design is not yet built. We name the tests that will decide it, starting with the one that matters most: whether a marker beats a summary when both come with the same way back into the record. If it holds, an agent could carry a week of work without asking what you already told it.-]

### Abstract

{+The design is not yet built. Its deciding test gives a summary and a marker the same way back into the record and asks which keeps the owner's words. If the marker wins, an agent could carry a week of work without asking you anything twice.+}

### Abstract

**Keywords:** [-AI agents,-] agent memory, context window, compaction, prompt [-caching, session transcript, agent harness.-] {+caching.+}

### 1.1 Friday's question

Nothing [-in this story-] {+here+} needs a bad [-model. The model that wrote-] {+model;+} the summary did what summaries do. The failure is in the design: the next inference got a description of the afternoon and no way back to the afternoon itself.

### 1.2 Why a bigger window does not settle it

Context windows have grown to a million tokens, but [-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,-] {+And+} a long-running agent fills any [-window. A-] {+window: a+} day of tool output, file reads and logs runs to millions of [-tokens, and a week does not fit anywhere.-] {+tokens.+} So compaction stays, and the question is what it should leave behind.

### 1.3 What summaries lose

A fifth kind matters [-more than the four:-] {+more:+} the owner's own words. An [-instruction, a preference-] {+instruction+} or a correction given during the session is the one thing the owner expects never to [-repeat. In-] {+repeat, and in+} a summary it becomes "the user gave some guidance", or [-it vanishes.-] {+vanishes. Repeated compaction makes this worse: when each summary is written from the previous one, detail erodes at every round, which Zhang et al. (2025) call "context collapse".+}

### 1.3 What summaries lose

[-Repeated 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.-]

### 1.4 Who holds the pen

[-There is a second obstacle, newer and less discussed.-] In many deployments the agent's runtime does not control 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 {+before the model reads them,+} or compact on its [-servers, and one of them returns the compacted state as an encrypted item the client cannot read (OpenAI, 2026).-] {+servers partway through a response.+} 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, and [-that work changes-] nothing the model [-sees.-] {+sees changes.+}

### 1.5 The claim

**The context window is a cache over the session record, and compaction is eviction from that cache, not a rewrite of history.** The record keeps every turn word for word and is never edited, [-with one exception-] {+except+} for privacy erasure (§4.4). What leaves the window is replaced by a marker that carries the evicted range's exact strings and the owner's instructions and points back into the [-record.-] {+record. The design has four parts: the record (§4), the marker (§5), one adapter contract for every kind of window controller (§6, Appendix C) and a price for compaction (§7); §10 names the tests that decide it.+}

### 1.5 The claim

[-The stage's codename, ENGRAM, is the neuroscientists' word for the physical trace a memory leaves in the brain. We use it only as a reminder of what this stage is for: a durable trace that outlives the moment.-]

### 1.5 The claim

{+The codename, ENGRAM, is the neuroscientists' word for the physical trace a memory leaves in the brain: a durable trace that outlives the moment.+} This is one of four designs for one agent's [-memory, each owning a stage:-] {+memory:+} keeping (this paper, [-J1); writing, which decides-] {+J1), writing+} what becomes a long-term fact (the writing paper, [-J14);-] {+J14),+} finding [-things-] {+it+} again (the finding paper, [-J2);-] {+J2)+} and turning experience into behaviour (the learning paper, J5). The series [-is judged by-] {+follows+} one owner correction [-followed from end to end. It is-] {+through all four on a shared reference trace, printed in the learning paper (J5 Appendix B, the reference trace); this stage owns its first status,+} *captured* [-here, *accepted* (or visibly held) by writing, *retrievable* through finding, and *active* or *enforced* through learning (§10.1). This paper owns the first status.-] {+(§4.6).+}

### 1.5 The claim

[-The contributions, each with the section that argues it:-]

### 1.5 The claim

[-1. A record that holds everything said and read word for word, file contents included, with one controlled exception (§4). 2. A marker that is a pointer, not a summary, with a stated guarantee for the owner's instructions when they outgrow their budget (§5). 3. One versioned adapter contract for the three kinds of window controller (§6, Appendix C). 4. A price for compaction that counts the cost of building the marker (§7). 5. Invariants checked in code, and the tests that decide the design (§8, §10).-]

### 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 the window controller's decision (§6), so the model [-does not spend-] {+spends no+} attention on managing its own pages, and the marker [-it leaves-] carries the exact strings a later search needs (§5.1).

### 2. Related Work

**Provider context management** makes the provider a window controller. Anthropic's context editing clears the oldest tool results once the prompt passes a threshold and leaves a [-placeholder saying a result was removed;-] {+placeholder;+} the caller can name tools whose results are never cleared and a minimum amount to clear, because each clearing invalidates the cached [-prefix. The clearing happens on the server before the prompt reaches the model,-] {+prefix,+} and the client keeps the [-full, unmodified-] {+full+} history (Anthropic, 2026d). Its [-server-side-] {+threshold+} compaction [-replaces-] {+has the model summarise+} older turns [-with-] {+partway through+} a {+request and then continue the response, unless the caller asks it to pause after the+} summary [-the model writes-] (Anthropic, [-2026a), and its memory tool lets the model keep files outside the window, in storage the developer controls (Anthropic, 2025).-] {+2026a).+} OpenAI's compaction [-returns an encrypted item that carries-] {+also prunes context and continues inference in the same response, carrying+} prior state forward {+in an item that is opaque+} and [-is-] not meant to be read (OpenAI, 2026). So the history is often [-kept;-] {+kept, but+} what the next inference sees is a placeholder or a [-summary,-] {+summary+} with no address for the missing [-part and nothing in it to search with.-] {+part.+} Our marker (§5.1) is that placeholder with the address and the exact strings added, and [-our-] {+the+} main test (T1, §10) gives both [-arms-] the same way back into the [-history. An opaque item is the strongest case for the runtime keeping its own record (§6.4).-] {+history.+}

### 2. Related Work

**Claude Code's hooks** (Anthropic, 2026b) are the levers a memory layer has when a provider's tool controls the window: an event before compaction that can block it, an event after it that receives the summary the tool wrote, a session-start event after a compaction that adds text to the new context, and an event on every prompt that adds text alongside it. **claude-mem** (thedotmack, 2026) [-captures-] {+uses hooks of the same family to capture+} what an agent [-does through hooks on session start, prompt submission, tool use and session end,-] {+does,+} compresses it with a model and injects relevant context into later sessions. [-We use the same family of levers (§6.3). We differ on what is kept: claude-mem's-] {+Its+} memory is the compressed [-observation, and-] {+observation;+} ours is the record itself, with compression [-used-] only as a map that points back into [-it.-] {+it (§6.3).+}

### 2. Related Work

**Manus** (Ji, 2025) reports a production agent's lessons: compress only in ways that can be restored (drop a page's content, keep its URL), keep the prompt prefix stable because the cache hit rate drives cost, keep the context append-only, and leave failed attempts in view. Total Recall takes "restorable" from tool outputs to the whole conversation and puts a price on moving the prefix [-(§7.2).-] {+(§7.2). **headroom** (Headroom Labs, 2026) compresses what an agent reads before the model sees it, stores the originals locally and gives the model a tool to fetch them. It keeps a smaller version in the window; we remove the span and leave a pointer. The two compose, and §7.2 says when each is cheaper.+}

### 2. Related Work

[-**headroom** (Headroom Labs, 2026) compresses what an agent reads (tool outputs, logs, files, retrieved chunks and conversation history) before the model sees it, stores the originals locally and gives the model a tool to fetch them. It keeps a smaller version in the window; we remove the span and leave a pointer. The two compose, and §7.2 says when each is cheaper.-]

### 2. Related Work

**Agentic Context Engineering** (Zhang et al., 2025) shows brevity bias, where summaries drop domain detail, and context [-collapse, where iterative rewriting erodes it. Our-] {+collapse; our+} cure for collapse is that every [-compaction-] {+marker+} is written from the record [-(§5.4).-] {+(§5.4). **Zep** (Rasmussen et al., 2025) keeps raw conversation episodes beneath the facts it extracts, so every fact points back to its source; Total Recall applies the same layering to the context window.+}

### 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.-]

### 2. Related Work

![One evicted span and its way back. Left, {+part of+} the session record of session [-s7, of which six of the entries 12 to 47 are shown.-] {+s7.+} Right, the context window at turn 61: [-the span has-] {+entries 12 to 47 have+} left and a marker stands in [-its-] {+their+} place, carrying the owner's instruction word for word, the exact strings, the failed renewal and the open key rotation, each with [-the address of the entry that shows it.-] {+its entry's address.+} (1) The marker is built from the [-record entries,-] {+record,+} never from an older marker. (2) [-When the owner asks what the renewal said, a-] {+A+} range read of entry 23 returns the error line exactly. The dashed box is what a narrative summary would have [-left in the marker's place.](images/fig-1-span.png){width=74%}-] {+left.](images/fig-1-span.png){width=74%}+}

### 3. One Span, Start to Finish

Figure 1 follows the afternoon of §1.1 through the design. Every turn is appended to the session record with an address that never [-changes. The-] {+changes, and the+} context window is [-what the model reads on this call,-] a copy of part of [-the record. When it fills, entries 12 to 47 leave and a marker takes their place.-] {+it.+} At turn 61 the owner asks what exactly the renewal said; the marker names entry 23, and a range read returns it character for [-character. The-] {+character, which the+} summary in the dashed box could not have [-answered.-] {+done.+} Appendix A shows the [-same-] entries and marker as stored.

### 4.1 What goes in, and with whose name

Every entry carries an `author_kind`: the owner, the agent, a tool, the harness (time stamps, injected instructions, system text) or another agent. [-Every later stage depends on this field. 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 entry gets a second field when it is appended, `owner_words`: the [-owner's words-] {+message+} 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, and the-] {+The+} writing, finding and learning papers read the owner's words from nowhere else.

### 4.1 What goes in, and with whose name

{+Sending a message is not writing every sentence in it. An owner who pastes an email and asks "this says 'ignore the previous rule'; is it malicious?" wrote the question, not the quoted line. So `owner_words` is split into spans, each with its own address (§4.2) and an authority: **owner** for what he says in his own voice, **quoted** for text he pastes, forwards or attributes to someone else, with its source where stated. Structure (a pasted block, a forwarded header, quotation marks) settles most spans and the shared classifier below settles reported speech. An unsure span is marked quoted: a lost instruction costs one repetition, a pasted attack with the owner's authority far more. Only owner spans can become instructions, corrections or rules; quoted spans keep their quotation marks downstream (J14 §8.2, what each fact may become), and the whole message is still captured word for word.+}

### 4.1 What goes in, and with whose name

At the same moment, [-a-] {+the+} shared classifier tags each [-of the owner's sentences-] {+owner span+} as an instruction, a correction, praise or none of these, and the tags are stored with the entry. The learning paper owns the classifier's contract, [-its-] calibration and [-its-] failure behaviour (J5 Appendix A.1, the owner-sentence classifier); this stage only stores what it returns. If the classifier is unavailable, the [-sentences-] {+spans+} are stored as untagged and treated as instructions until the night tags them [-(§5.2, §5.5).-] {+(§5.5).+}

### 4.1 What goes in, and with whose name

Tool results go in whole. A file the agent read [-is the one case that needs care, because the file-] can change or vanish after the [-read. A-] {+read, and a+} content hash would show that it changed [-but could not give-] {+without giving+} back what it said. So the {+returned+} bytes [-the tool returned-] are stored [-once,-] as a content-addressed [-blob,-] {+blob+} before the window drops them, and the entry holds the path and the blob's hash. Identical contents are stored [-once,-] {+once per blob namespace,+} so the cost grows with [-the number of-] distinct versions read, not with [-the number of-] reads. [-One-] {+Ordinary sessions share one namespace, so one+} blob can [-therefore-] back [-many entries,-] {+entries+} in many [-sessions, which matters when it-] {+of them (§4.4); each temporary session+} has [-to be erased (§4.4).-] {+its own (§4.7).+}

### 4.2 Addresses that never move

Each entry gets an address made of the session and a sequence [-number,-] {+number (s7#12),+} and a {+span of an owner entry adds its index (s7#12/0). A+} range is 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.-] {+month. The learning paper's correction ID is a span address, so one message can carry several corrections.+}

### 4.3 Never edited, never superseded

The record is append-only. No compaction or clean-up edits or deletes an entry, and the record has no [-supersede at all:-] {+supersede:+} a turn that was said stays said, even after what it said stops being true. [-Fact changes happen-] {+Facts change+} one stage later, [-where a fact is superseded, retracted or erased-] as [-a-] new [-revision and the old one keeps its history-] {+revisions+} (J14 §7.3, three ways a fact [-ends). The-] {+ends), and the+} record entry [-the-] {+a+} fact was drawn from is not touched. [-Which facts change is the writing paper's call; what-] {+What+} a default search hides is the finding paper's {+call+} (J2 §8.1, filters in a fixed order).

### 4.4 Erase and quarantine

[-Two cases call for treating an entry differently, and the series handles them with one policy.-] The writing paper decides when [-either-] {+an erase or a quarantine+} applies and runs the deletion manifest over everything derived (J14 §7.7, erase and quarantine); this section says how each looks in the record.

### 4.4 Erase and quarantine

**Erase** is for [-privacy:-] {+privacy. The entry, or only+} the [-owner asks to forget something about a person. The record entry-] {+spans the erase names,+} is redacted, the [-only-] {+one+} edit the record allows. [-It keeps its address,-] {+Address,+} author and [-time, and its-] {+time stay; the+} text, [-its-] `owner_words`, [-its-] tags and any blob [-it holds-] are replaced by a tombstone that says content was removed, when, why, and {+under+} which deletion [-receipt covers it.-] {+receipt.+} The tombstone holds no part of the content, not even a hash, because the hash of a short string such as a phone number can be confirmed by guessing. A blob is shared by every read {+in its namespace+} that returned the same [-bytes (§4.1),-] {+bytes,+} so [-tombstoning one entry would leave those bytes readable through the others. An-] {+an+} erase that reaches a blob [-therefore-] deletes [-the blob-] {+it+} and tombstones every entry that references [-it, in any session. The redaction is also appended as a-] {+it. A+} harness [-entry, so the record still shows-] {+entry records+} that something left, and when. Everything derived is rebuilt from the redacted record: the text index drops the [-entry's-] rows, [-and-] every marker whose range covers it is written again (§5.4), [-which drops any string or sentence that came from it.-] {+and the copies the runtime handed the controller (markers, per-turn injections, the learning stage's provisional lines) are redacted in the controller's transcript. Trace step 11 shows it on a two-correction message: span 0 erased, span 1 kept, every marker resolving, the live window rebuilt with an eviction event (§6.6), the provider's copy named.+}

### 4.4 Erase and quarantine

**Quarantine** is for attack evidence: a line shown to have been injected. Nothing is [-edited. A-] {+edited; a+} harness entry [-is appended that-] flags the entry as untrusted, with the writing paper's [-decision attached.-] {+decision.+} The content [-stays, because it is what happened and the evidence of the attack,-] {+stays as evidence,+} but it [-is excluded from-] {+leaves+} the window, [-from-] every marker [-(the covering markers are rebuilt-] {+(rebuilt+} without it), [-from-] ordinary range [-reads, which-] {+reads (which+} return a "quarantined" [-placeholder at its address,-] {+placeholder)+} and [-from-] ordinary [-search (J2 §8.1, filters in a fixed order). It is visible-] {+search;+} only [-in-] an audit [-view.-] {+view shows it.+}

### 4.4 Erase and quarantine

[-Either way addresses do not move, so every pointer still resolves (§8). Both transcripts of a session (§4.5) are treated alike, and copies in live sessions or on the controller's side go through the adapter (§6.6).-]

### 4.4 Erase and quarantine

{+Either way addresses do not move, so every pointer still resolves (§8).+} For an erase, this stage fills in its rows of the [-writing paper's-] deletion [-manifest (J14 §7.7), with a completion status for each place:-] {+manifest:+} the runtime's record entries, the controller's [-own-] transcript, the blobs, the markers, and live sessions or provider state, reached through the adapter [-(§6.6, Appendix C).-] {+(§6.6).+} Each place is reported done, not present, or out of reach, and a copy out of reach is [-named.-] {+named; "all reachable copies removed" is the strongest claim this stage makes.+}

### 4.5 One record, not copies

Most 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-] {+A+} third, partial [-copy. A-] copy [-that keeps only some kinds of entry, say the agent's replies, is-] {+would be+} worse than none, because a range read against it returns an answer that looks complete and is not. The record is therefore an index over the transcript the runtime already writes, plus the blob [-store of §4.1. The-] {+store; the+} memory layer writes entries of its own only where no readable transcript exists [-(an API compaction that leaves nothing readable, §6.4)-] {+(§6.4),+} and for the markers and maps it derives.

### 4.6 When a turn is captured

An owner turn is [-*captured*, the first of the series' statuses (§1.5),-] {+*captured*+} when its entry, with `owner_words`, {+its spans and their tags,+} is in the session record durably (written and flushed) and has its address. The runtime appends the turn from its own copy before the model call that answers it, so capture does not wait for a provider's transcript to catch [-up.-] {+up. In the reference trace this is step 1: one flush captures both corrections of one message, and if the process dies before the learning stage queues them, both are rebuilt from the record (step 2).+}

### 4.6 When a turn is captured

Until then the turn is pending, and the agent says nothing about having kept it. If the append fails (a full disk, a crash), the harness shows the turn as not captured and retries from its in-memory copy. After a crash, the restart reconciles the record with the controller's transcript through the sequence map and appends what is missing in the controller's order. A turn that cannot be recovered from either side is reported as lost; it never reads as [-kept. The tests are T10's (§10). Whether it then becomes accepted, retrievable, and active or enforced is for the other three stages, each with its own pending and failure states.-] {+kept (T10, §10).+}

### 4.7 Sessions that are never kept

Some things should never reach the long-term [-side at all,-] {+side,+} and the place to stop them is [-capture, before anything is written to disk.-] {+the write itself.+}

### 4.7 Sessions that are never kept

A **temporary session** keeps its record only for its own life, since compaction and range reads inside [-the session still-] {+it+} need it. {+Its record and blobs live in a namespace of their own, so it shares no blob with an ordinary session, even for the same file.+} The [-record carries a temporary flag, and the-] long-term stages skip it: no [-fact is drawn from it,-] {+fact,+} no lasting index [-row-] {+row, no learning evidence. At its end the namespace+} is [-built, no evidence is kept for learning. When-] {+deleted whole, with a receipt, and an ordinary session that read+} the [-session ends,-] {+same bytes keeps+} its [-record, blobs and markers are deleted, and the deletion writes a receipt like any other.-] {+own copy.+} Where the [-window-] controller offers [-its own setting for not retaining-] a [-session,-] {+no-retention setting,+} the adapter turns it on; [-where it offers none,-] {+otherwise+} the owner is told at the start that the provider keeps its own copy.

### 4.7 Sessions that are never kept

[-**Prohibited capture classes** are kinds of content that are never written in any session: credentials and keys by default, plus any class the owner names. A detector runs at append, before the write, and replaces a match with a typed placeholder (`[credential removed]`), so the raw bytes never reach the record. The model may already have read the value in the turn it arrived; markers built later carry only the placeholder. The detector will miss some; a miss found later is handled as an erase (§4.4).-]

### 4.7 Sessions that are never kept

{+**Prohibited capture classes** are never written in any session: credentials and keys by default, plus any class the owner names. The detector sits on the runtime's one write path, which every copy the runtime persists passes through: its transcript writer, which the record indexes (§4.5), file bytes bound for the blob store, and text handed to a controller (injections, markers). A match becomes a typed placeholder (`[credential removed]`) before anything is written, and an altered blob is marked as such. Prohibited bytes are outside the verbatim guarantee; a range read returns the placeholder. Two copies lie beyond this path. A provider's tool keeps its own transcript, and blocking a prompt does not keep its text off the tool's disk (Anthropic, 2026b); the adapter replaces a match in a tool result before the tool's model reads it, through the hook after each tool call, redacts the tool's transcript at the next hook, and names any copy it cannot reach in a receipt. And the model may have read a value in the turn it arrived. A detector miss found later is handled as an erase (§4.4).+}

### 5.1 The marker

1. The range: the session and the first and last sequence numbers. 2. The owner's words: every instruction, preference and correction [-the-] {+in an+} owner [-gave-] {+span+} inside the range, verbatim, within the budget of §5.5. 3. Exact strings: the paths, hashes, host names, identifiers, numbers, error lines and times 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.

### 5.1 The marker

There 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 {+one. The exact strings serve two readers: the model, which can often act without pulling anything because the hash is right there, and+} a [-quote.-] {+later search, which finds the span by the same strings the owner will use when he asks.+}

### 5.1 The marker

[-The exact strings serve two readers. The model reads them and can often act without pulling anything: the hash is right there. And a later search finds the span by the same strings the owner will use when he asks ("the nginx path", "that hash").-]

### 5.2 Word for word, one line, or a pointer

[-Each kind of content gets one treatment when its range is evicted:-]

### 5.2 Word for word, one line, or a pointer

{+Each kind of content gets one treatment when its range is evicted. Which owner spans are instructions comes from the tags stored at append (§4.1); a span the classifier is unsure of, or could not tag, is kept verbatim, because keeping it costs a few tokens and losing an instruction costs the owner's trust.+}

### 5.2 Word for word, one line, or a pointer

[-Which of the owner's sentences are instructions comes from the classifier tags stored at append (§4.1). A sentence the classifier is unsure of, or could not tag, is kept verbatim, because keeping a sentence costs a few tokens and losing an instruction costs the owner's trust. Whether a correction later becomes a standing rule is the learning paper's question; this stage makes sure it survives the session.-]

### 5.3 What leaves first

Never evicted: the system text, the always-loaded files and the current task's own short statement. Markers are not evicted either; they merge (§5.5). Within each class, older content leaves before newer, since recent content is the best available guess at what will be needed next. This is the practical stand-in for Belady's [-rule: we cannot know what will be needed furthest in the future, but we can know-] {+rule (§2):+} what costs least to get [-back.-] {+back, since no one knows what is needed furthest ahead. The selector chooses from the window as the model will read it on the next call, after any provider clearing, and reports what it evicted by class, adding up to the total removed.+}

### 5.3 What leaves first

[-The selector reports what it evicted, by class, adding up to the total removed, and it chooses from the window as the model will read it on the next call, after any provider clearing, so each class it names is still there.-]

### 5.4 Written from the record, never from the last marker

When 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 rule stops context [-collapse. A-] {+collapse: a+} summary of a summary loses detail at every [-round;-] {+round, while+} a marker written from the record has the same detail on the hundredth compaction as on the first.

### 5.5 Merging markers, and the budget for the owner's words

Markers have a total budget in the window, and the owner's instructions inside them have a budget of their [-own.-] {+own, $B_o$ tokens.+} Both are fixed by the deployment; the guarantees below do not depend on their [-values.-] {+values. When the markers outgrow their budget, adjacent markers merge into one covering both ranges. A merge is a compaction, so §5.4 applies; the merged lists of exact strings and one-line items are capped by count, and what falls off is still reachable through the merged range.+}

### 5.5 Merging markers, and the budget for the owner's words

[-When the markers outgrow their budget, adjacent markers merge into one covering both ranges. Each merge is a compaction, so §5.4 applies: the merged marker is written from the record. Its lists of exact strings and one-line items are capped by count, and what falls off is still in the record, reachable through the merged range.-]

### 5.5 Merging markers, and the budget for the owner's words

[-The owner's instructions are kept verbatim for as long as they fit their budget. Untagged sentences (§4.1) count against this budget as instructions until the night tags them (J5 §6.2, the nightly auditor); a later tag of "none" releases their place. A long session can outgrow any budget, so the guarantee has two parts. Every instruction stays **recoverable** word for word through its address, for as long as the record lives and the owner has not had it erased. And it stays **in the window** word for word while the instructions fit. When a new instruction would exceed the budget, the oldest instruction in the window leaves its marker and is replaced by a one-line pointer: when it was said, its first few words and its record address. The agent tells the owner in its next reply which instructions moved out of view, and the compaction receipt lists them (§7.4). An instruction the owner wants to hold beyond the session belongs in the always-loaded file, which is the writing and learning papers' to admit (J14 §8.2, what each fact may become; J5 §7, keeping the always-loaded file honest).-]

### 5.5 Merging markers, and the budget for the owner's words

[-So the promise to the owner is recoverability, not permanent residence in the window, and when residence ends he is told. T9 (§10) tests a session whose instructions alone exceed the budget.-]

### 5.5 Merging markers, and the budget for the owner's words

{+$B_o$ holds the instructions kept verbatim, at most $k$ pointer lines ($k$ fixed with $B_o$) and one directory line. Untagged spans count as instructions until the night tags them (J5 §6.2, the nightly auditor). When a new instruction does not fit, the oldest verbatim one becomes a pointer line: when it was said, its first words, its address. When one more pointer would pass $k$, all pointer lines fold into the directory line, "*N* earlier instructions, s7#12 to s7#311, are not shown one by one". It points at a directory entry appended to the record that lists every moved instruction with its address, so one range read returns them all. However long the session, the owner's instructions never take more than $B_o$ of the window. Each move is told to the owner in the next reply, with the warning that what moved is no longer individually in view, and listed in the receipt (§7.4).+}

### 5.5 Merging markers, and the budget for the owner's words

{+So the promise has two parts. Every instruction stays **recoverable** word for word through its address, for as long as the record lives and it has not been erased. It stays **in the window** word for word only while it fits, and when it leaves, the owner is told. An instruction the owner wants held beyond the session belongs in the always-loaded file, which the writing and learning papers admit (J14 §8.2, what each fact may become; J5 §7, keeping the always-loaded file honest).+}

### 6.1 Three window controllers

- The runtime builds every call to the model API from its own state. Compaction is the runtime's to do. - A provider's command-line tool 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 takes the calls the runtime builds, then clears old tool results or compacts on its servers once a threshold is [-crossed, and returns either a readable summary or an opaque item.-] {+crossed.+}

### 6.1 Three window controllers

[-The memory layer notes which case it is in at the start of every session, and again when the model or tool changes.-]

### 6.1 Three window controllers

![The three window controllers and what the memory layer does in each: before a compaction, after it, and how it confirms that the marker reached the model. The bottom row is what the memory layer can know about the model's [-view in each case.-] {+view: known input when the runtime builds the call, otherwise only what was sent.+} In all three, the session record is the ground truth and every marker points into [-it.](images/fig-2-controllers.png){width=86%}-] {+it.](images/fig-2-controllers-v82.png){width=86%}+}

### 6.3 When a provider's tool controls the window

- Before compaction. The hook makes the record complete up to this [-moment: it copies into the record anything the runtime has not yet recorded,-] {+moment,+} reading the tool's own transcript where needed. The hooks do not say which part the tool [-is about to-] {+will+} summarise, so the adapter takes everything since the previous compaction (or the session start) as the [-range,-] {+range+} and builds [-its-] markers from the [-record. A-] {+record; a+} marker for a turn the tool [-happens to keep-] {+keeps+} verbatim costs a few [-tokens and does no harm.-] {+tokens.+} The pending markers are written durably before the hook returns. The hook could block the compaction, but [-blocking a compaction-] {+when+} the tool [-needs-] {+compacts+} to recover from a full [-window makes-] {+window, blocking fails+} the [-request fail,-] {+request,+} so the default is to let it run. - After compaction. The event after compaction hands the hook the summary the tool [-wrote;-] {+wrote, which+} the adapter stores [-it in the record-] as a harness entry. The session-start event that follows a compaction adds text to the new context before the next model call, and the adapter adds the markers there, beside the tool's summary. - Every turn. Text injected with each prompt reaches the tool's model, so the [-push of relevant memory, the-] finding paper's [-stage,-] {+push+} works here as anywhere else, and a marker whose delivery failed is sent again this way.

### 6.4 When a provider's API controls part of the window

Here the runtime builds every call, but the API may change the conversation after it is sent. [-Two-] {+Three+} moves cover it. First, the runtime keeps its own record of everything it sent and everything that came [-back. With tool-result clearing the client still holds the full history;-] {+back;+} after a server-side compaction [-the runtime's record-] {+this+} may be the only readable copy, and when the compacted state is opaque it certainly is. Second, [-the runtime-] {+it+} uses the API's own controls to protect what must stay: it names the tools whose results must never be cleared and sets [-the-] {+a+} minimum amount to [-clear at once,-] {+clear,+} so a small clearing does not break the cache for a small [-gain. After each compaction event it re-sends the markers for the compacted range, in the same place every time, so the prefix stays stable.-] {+gain.+}

### 6.4 When a provider's API controls part of the window

{+Third, it promises only what it can deliver. A threshold compaction runs inside a request, and the model may go on answering from the compacted context in the same response (Anthropic, 2026a; OpenAI, 2026). The runtime places markers only in requests it builds, so the guarantee is delivery before the next client-controlled request. Where the API can pause after its summary, the adapter takes the pause and adds the markers, so the first inference after compaction has them; where it cannot, the rest of that response is recorded in the receipt as unprotected. Markers go in the same place every time, so the prefix stays stable.+}

### 6.5 Never compact a copy nobody reads

[-A runtime that mirrors a conversation a provider's tool controls will see the mirror grow and will be tempted to compact it. That compaction costs time and changes nothing the model reads. So in-] {+In+} the provider-tool case the runtime [-does not compact-] {+never compacts+} its mirror [-at all; it-] {+of the conversation, which would cost time and change nothing the model reads (§1.4). It+} writes a [-compaction-] receipt for each of the tool's compactions (§7.4) and builds markers for them [-(§6.3). A-] {+(§6.3); a+} compaction is counted only when it changed what the model reads.

### 6.6 The adapter contract

All three paths share one versioned contract, given in full in Appendix C. Each adapter declares its controller's capabilities and re-detects them when the model or tool changes; a capability it cannot confirm counts as absent. Each compaction moves through durable pending states (detected, flushed, markers built, injected, [-acknowledged,-] {+delivered,+} closed), each appended to the record before the next step starts, so a crash between hooks resumes where it stopped. A [-sequence map pairs runtime addresses with the controller's entry IDs (§4.5). A-] marker counts as [-acknowledged-] {+delivered+} when its ID appears in [-the next-] {+a+} call the runtime sent or in the tool's transcript; until then [-the-] {+its+} range is not treated as in view, the per-turn injection sends it again, and the receipt counts the turns run without [-it. Every receipt carries a knowledge level: in the runtime case the memory layer knows what the model read; otherwise it has recorded what it sent (and, for a tool, the summary the tool wrote), and with an opaque compacted state it cannot know what the model kept. No claim about the model's view goes beyond that level. Each missing capability has a named fallback, and the receipt names every fallback used.-] {+it.+}

### 6.6 The adapter contract

{+Every receipt carries one of two knowledge levels. **Known input**: the runtime built the call, so it knows what the model read. **Sent, unconfirmed**: a tool or an API stands between, so the memory layer knows what it sent (and, for a tool, the summary the tool wrote), not what the model kept. No claim about the model's view goes beyond that level, and the learning stage never treats a sent-but-unconfirmed rule as one the model saw (J5 §5.4, when a rule recurs, ask why before climbing).+}

### 6.6 The adapter contract

The adapter also serves two other stages. Its compaction receipts are published as eviction [-events, which-] {+events for+} the finding paper's read ledger [-uses to forget that it had already shown a file-] (J2 §6.7, what the context already holds). {+Where residency is unknown, after any compaction by a tool or an API, the event covers everything sent before it, not only the inferred range, since an unannounced summary may also have dropped what an earlier one kept; the read ledger forgets all of it.+} And an erase that reaches a live session goes through [-it: in-] {+the adapter:+} the runtime [-case it-] rebuilds [-the-] {+its+} window without the content; for a tool or an API [-it-] {+the adapter+} ends or compacts the live [-session and-] {+session,+} uses the controller's [-own-] deletion control where one exists, and otherwise reports the copy as out of reach [-in the writing paper's deletion manifest-] (J14 §7.7, erase and quarantine).

### 7.1 Forced and elective

A 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-] {+It+} 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.-] The price matters for elective compaction, because it is the one we can decline.

### 7.2 The price of moving the prefix

We use the finding paper's notation and prices (J2 §7.1, a read costs a turn): 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. Let $q_{\text{turn}}$ be the probability that a given later turn of the same session pulls from the evicted span (horizon: one later [-turn). It is not-] {+turn;+} the finding paper's [-$q$, whose horizon is-] {+$q$ has+} the rest of the [-session.-] {+session as its horizon).+} A pull is a full turn and costs the finding paper's $C_{\text{pull}} = rL + wx + g\,o$: it re-reads the $L$ tokens of cached context, writes the $x$ tokens it returns and produces $o$ output tokens. Here the returned slice then stays in the window for $H$ turns until it is evicted again, so a pull from an evicted span costs

### 7.2 The price of moving the prefix

The added term [-is-] {+makes+} the residency assumption [-made-] explicit: a pull returns a slice of the span ($x \ll S$), [-not the whole span, and the slice is-] resident until the next eviction.

### 7.2 The price of moving the prefix

Building the marker has a cost too. Exact strings and the owner's words need no model call (the strings are matched by code, the owner's [-sentences-] {+spans+} were tagged at append), but the one-line decisions and open items do. The model that writes them reads the span once at an input price $c$ and writes the marker, so the construction cost is $K = cS + [-g\,m$. A-] {+g\,m$; a+} merge reads the union of [-the ranges it covers,-] {+its ranges,+} so its $K$ grows with [-the merged range. The classifier's cost is paid at append whether or not anything is ever compacted, so it is not part of $K$.-] {+them.+}

### 7.2 The price of moving the prefix

Figure 3 is [-one scenario,-] an [-illustration and-] {+illustration,+} not a rule, [-because-] {+since+} $q_{\text{turn}}$, $H$ and $c$ [-have not been measured.-] {+are unmeasured.+} In it, a 40K-token span pays back after about 40 turns if it is never pulled, of which about 10 are the cost of building its marker; after about 57 turns if a later turn pulls from it with probability 0.05; and never if that probability exceeds about 0.17. A 100K-token span pays back after about 22 turns. A 10K-token span needs about 131 turns with no pulls and never pays above a probability of 0.04. Cheaper cache reads make eviction pay later: at a read price of 0.05 the 40K span needs about 82 turns.

### 7.2 The price of moving the prefix

Three design rules hold whatever the numbers: evict large spans at once, since the rewrite is paid per eviction and the saving grows with the span; prefer spans that are large and rarely pulled, which §5.3's order selects; and keep markers at a stable place, so the next eviction does not move them and pay the rewrite again. One benefit is left out: a shorter window is read better [-(§1.2). It-] {+(§1.2); it+} is real but unpriced, so [-we leave-] {+T7 tests+} it [-to a test (T7) and do not add it to-] {+instead of+} the formula [-as a guess.-] {+guessing it.+}

### 7.3 A trigger you can trust

Every compaction decision starts from one number: how full the window is. That number must come from the call actually sent. 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.-] {+late.+}

### 7.3 A trigger you can trust

So the trigger reads a per-call [-snapshot:-] {+breakdown:+} 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-] {+breakdown+} that does not add up blocks elective [-compaction and is logged;-] {+compaction;+} forced compaction still runs, because the provider will reject a call that does not fit whatever our counter [-believes.-] {+believes. A 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.+}

### 7.3 A trigger you can trust

[-A 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.-]

### 7.4 One compaction receipt per compaction, whoever ran it

Every compaction, by every executor, writes one receipt, and so does a decision not to compact, under the series rule that a missing receipt is the alarm [-and a zero is a valid result-] (J5 §9.1, a receipt for every [-run).-] {+run, and a zero means zero).+} The receipt is also the eviction event of [-§6.6: the finding paper's read ledger reads-] {+§6.6, and+} its evicted field [-(J2 §6.7, what the context already holds), which-] lists cleared tool results as well as marker ranges, since an API's clearing leaves no marker.

### 7.4 One compaction receipt per compaction, whoever ran it

| Field | Meaning | |-----------|---------------------| | session, started, ended | which session, and when | | executor, controller case | runtime, provider tool or provider API; the §6 case | | kind, decision | forced, elective or none; ran, declined on price, blocked on [-snapshot,-] {+call breakdown,+} did not run | | [-snapshot-] {+call breakdown+} | attributed slices, unattributed slice, provider-reported input count | | tokens before and after | as measured on the call before and the call after | | evicted | each evicted record range, with [-the-] path, region and blob hash of every file read [-inside-] {+in+} it; each tool result an API cleared; [-for-] {+after+} a [-provider's-] tool [-(§6.3), the whole range since the previous-] {+or API+} compaction, [-marked-] {+everything sent before it,+} as [-inferred-] {+residency unknown+} | | markers | IDs and ranges [-written,-] {+written;+} whether each [-resolved, whether each-] {+resolved and+} was [-acknowledged-] {+delivered+} | | instructions moved | owner instructions [-that left-] {+moved to pointers or+} the [-window as pointers-] {+directory+} (§5.5) | | knowledge level, fallbacks | [-what the memory layer can know-] {+known input or sent, unconfirmed+} (§6.6); each degraded path [-used-] {+used; any inference run unprotected (§6.4)+} | | outcome | completed, failed (with reason), interrupted |

### 8.1 The range read

The range read takes a range and returns the record's entries in it, verbatim, with their authors and times; a file read comes back with its blob, whatever happened to the file since. An erased entry {+or span+} comes back as its [-tombstone and-] {+tombstone,+} a quarantined one as its placeholder [-(§4.4).-] {+(§4.4), and a prohibited match as its typed placeholder (§4.7).+} The finding paper's pull tool offers [-this read-] {+it+} as one [-of its modes,-] {+mode,+} next to a search over the record (J2 §6.6, the [-pull). How that search ranks, when the agent is handed something without asking,-] {+pull); ranking+} and [-whether the pull tool is offered at all-] {+push+} are the finding [-paper's. This-] {+paper's, and this+} stage guarantees that the search runs over the same record the markers point into.

### 9.1 In short

[-A long-running agent forgets in one way that matters: after-] {+After+} compaction, [-the-] {+an agent's+} next inference sees a description of its past and has no way back to the past itself. Total Recall keeps the whole session as an addressed record, makes compaction leave markers that quote what a description drops and point back into the record, and works through whichever controller holds the [-window.-] {+window, claiming no more about the model's view than that controller lets it know.+} If it holds, the owner's Friday question about Monday's instruction has an exact answer: the instruction is in view, or [-one-] {+a+} line says where it is, and the owner knows which.

### 9.2 Limitations

- Markers depend on [-extraction. Which strings are exact strings and which sentences are instructions are judgements made-] {+extraction+} by code and a [-classifier. A-] {+classifier; a+} missed string is still in the record, but the marker no longer advertises [-it, so the agent has to search to find-] it. - [-The-] {+Past the+} owner's [-budget bounds what stays in view. Past it, the oldest-] {+budget, old+} instructions are a pointer {+or a directory+} away, and the agent [-has to-] {+must+} follow [-the pointer-] {+it+} when it matters. - Hooks are the provider's to [-change. If-] {+change, and an API that compacts mid-response without+} a [-provider removes-] {+pause leaves+} the [-event after compaction, markers reach the model only with the next turn's injection, and-] {+rest of that response unprotected;+} the receipt says [-so. --] {+so, but the gap remains.+} 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.-] {+checked at all.+} - The record grows without [-bound. Storage is cheap next to an owner's time, but-] {+bound;+} years of sessions will need tiered [-storage for old records,-] {+storage,+} which the design does not cover. - The price rule rests on unmeasured [-inputs: $q_{\text{turn}}$, the residency $H$ and the construction price $c$. Until-] {+inputs ($q_{\text{turn}}$, $H$, $c$); until+} they are measured, elective eviction should be conservative. - The capture detector [-of §4.7-] will miss some [-secrets;-] {+secrets, and+} a [-miss is caught-] {+provider's own copies are reached+} only [-when someone asks for an erase.-] {+after the fact.+} - Recoverable is not [-recovered. Every guarantee here is about what can be read back. Whether-] {+recovered: whether+} the agent asks for {+what+} it [-when it should-] {+can read back+} is the finding paper's question.

### 10.1 Tests that would settle what we do not know

Each test names the claim it decides and what result would change the design. [-Every-] {+A+} test that tunes something (the string extractor, the classifier thresholds, the budgets) tunes on development sessions and is scored on held-out [-sessions it never saw, drawn-] {+ones,+} from a later period {+or,+} for [-real data and from different-] {+synthetic data, other+} seeds and string types [-for synthetic data; the series' rules for keeping these sets apart are the learning paper's-] (J5 §9.2, three [-streams-] {+streams,+} kept apart). [-Where two-] {+Live+} arms are [-compared on live sessions,-] {+assigned+} sessions [-are assigned to arms-] at random.

### 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 summary alone; truncation; **the [-provider's-] summary plus the same searchable record and range read (the control)**; markers plus range read; markers [-without range read.-] {+alone.+} | §5: the marker, not mere access to the record, keeps what summaries lose | [-If the control-] {+Control+} matches [-markers,-] {+markers:+} the gain is the way back, not the [-marker; if markers without the range read-] {+marker. Markers alone+} match markers with [-it,-] {+the read:+} the read matters less [-than the marker-] | | T2 | Back-reference replay. Real moments where the owner refers to earlier in the session ("the hash from before"), replayed after compaction under the control [-arm-] and under markers. | §4, §5 in real use | No clear margin over the [-control means-] {+control:+} markers do not pay their cost | | T3 | Forget-cue rate. Owner messages that repeat an [-earlier-] instruction or ask "did you forget", per [-100 owner messages, in sessions run-] {+100,+} under the control [-arm-] and under markers, split by [-whether-] a compaction [-happened-] in the previous ten turns. | the outcome the design serves | No [-difference means-] {+difference:+} the owner's pain lies in finding or learning, and §1 must be rewritten | | T4 | Marker coverage. For each evicted range, the share of its exact strings and owner instructions present in its marker. | §5.1, §5.2 | [-Coverage below half means-] {+Below half:+} the extraction, not the design, is the weak part | | T5 | Every marker resolves. Property test over generated sessions plus the nightly [-check of §8.2;-] {+check;+} files read, then changed and deleted, [-must-] come back as read. | §4.1, §8.2 | Any failure is a defect, not a trade-off | | T6 | Trigger validity. Slices against the provider's input [-count per call;-] {+count;+} evicted tokens by class against the total; a thrashing session [-must trip-] {+trips+} the guard; a provider-tool session [-must show zero-] {+shows no+} runtime [-compactions.-] {+compaction.+} | §5.3, §6.5, §7.3 | [-A snapshot that cannot be reconciled-] {+An unreconciled call breakdown+} keeps elective compaction off | | T7 | Price and quality. Measure $q_{\text{turn}}$, [-$H$, $K$-] {+$H$+} and [-price-weighted tokens;-] {+$K$;+} compare elective eviction at $N^*$ with [-no elective eviction-] {+none,+} on task success. | §7.2 | A [-measured-] $q_{\text{turn}}$ above break-even [-for typical spans-] makes elective eviction rare; a quality gain from shorter windows argues for earlier eviction | | T8 | Erase and quarantine. Erase {+one span of+} a [-string seeded in an-] {+two-correction+} owner turn and a {+string in a+} tool [-result: no-] {+result (trace step 11); quarantine an injected line. | §4.4 | A+} hit in the [-text-] index, {+a marker or+} the [-range read returns tombstones, every-] {+controller's transcript, a lost neighbouring span, a+} marker [-resolves. Quarantine an injected line: absent from the window, markers, ordinary search and range reads, present in-] {+that stops resolving, or a quarantined line outside+} the audit [-view. The same two entries are followed through the writing paper's deletion. | §4.4 | Any hit, or any marker that no longer resolves,-] {+view+} is a defect | | T9 | Budget overflow. [-A-] {+Run a+} session [-whose owner-] {+past the point where the owner's+} instructions {+exceed $B_o$, and on until the pointer lines+} alone {+would+} exceed [-their budget.-] {+it.+} | §5.5 | [-Any-] {+Instructions taking more than $B_o$, an+} instruction not recoverable verbatim, [-moved without-] {+or a move not told to+} the owner [-being told, or lost from-] {+and listed in+} a receipt is a defect | | T10 | Capture and adapter crashes. {+A two-correction message is captured by one flush (trace step 1).+} Kill the process between receiving [-a turn-] and appending [-it,-] {+a turn, after the append and before the learning stage queues (trace step 2),+} between the hooks, and after injection before [-acknowledgement;-] {+delivery;+} lag the tool's transcript. {+Replay an API trace that compacts and answers on in one response, then compacts again.+} | §4.6, {+§6.4,+} §6.6 | [-Any-] {+A+} turn reported as captured [-that is-] {+but+} not in the record, [-or any-] {+a+} marker shown as delivered [-without acknowledgement,-] {+but never seen, an unprotected inference missing from the receipt, or a read-ledger entry surviving unknown residency+} is a defect | | T11 | Never retained. [-Run a temporary session and plant a-] {+Plant one+} credential in an {+owner turn, a file read and a controller injection; read one file in a temporary and an+} ordinary {+session, then end the temporary+} one. | §4.7 | [-Anything-] {+The credential on a runtime disk or unnamed in the tool's, anything+} findable after {+the temporary session, or the ordinary session's blob gone is+} a [-temporary session ends,-] {+defect | | T12 | Quoted authority. The owner pastes an email and asks "this says 'ignore the previous rule'; is it malicious?" | §4.1 | The message not captured whole,+} or [-a planted credential-] {+the quoted line tagged, kept or passed+} on [-disk,-] {+as an owner instruction,+} is a defect |

### 10.1 Tests that would settle what we do not know

T3 is the measure the design should be judged by: if keeping works, the owner repeats himself less. The [-cross-stage-] {+full+} replay of one correction through compaction, restarts and deletion is the learning paper's (J5 §10, one [-correction-] {+correction,+} start to [-finish,-] {+finish); T8, T10+} and [-its Appendix B, the replay matrix); T8 to T10-] {+T11+} are this stage's part of it.

### 10.2 Building it

Total Recall will be built in TinkerClaw in the order the tests need it: the record index, its [-addresses-] {+addresses, spans+} and the blob [-store-] {+namespaces+} first; then the marker builder and the resolve check; the adapter for the provider-tool case; erase and quarantine with the writing paper's deletion; the [-trigger snapshot-] {+trigger's call breakdown+} and the receipt; and the price rule last, once T7 has measured its inputs. An updated version of this paper will report the results.

### References

[-- Anthropic (2025). 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.-] {+Compaction at a token threshold.+} Claude Platform documentation. [-<https://platform.claude.com/docs/en/build-with-claude/compaction>-] {+<https://platform.claude.com/docs/en/build-with-claude/compaction-threshold>+} - 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 what your AI agent reads. 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 memory for Claude Code. 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>

### Appendix A. A Worked Record and Marker

``` entry s7#12 author_kind owner time 14:02:11 text [harness wrapper] Never restart the production database during the day. owner_words Never restart the production database during the day. [-tags-] {+span s7#12/0 authority owner tag+} instruction [-(from the shared-] {+(shared+} classifier) controller tool transcript, entry 118

### Appendix A. A Worked Record and Marker

entry s7#16 author_kind tool time 14:09:40 call read_file /etc/nginx/sites-enabled/app.conf content blob [-sha256:7d2a...-] {+ordinary/sha256:7d2a...+} (4,812 bytes, stored before the window dropped it)

### Appendix A. A Worked Record and Marker

marker m-s7-12-47 v2 built from the record, not from v1 range s7 #12-47 owner [-#12-] {+#12/0+} "Never restart the production database during the day." strings /etc/nginx/ssl 9f3c2e1 14:32 "too many certificates already issued" lines failed #23: certbot renew, rate limit chose #27: keep the old chain until Monday open #31: rotate the key ```

### B.1 Appending to the record

``` APPEND(session, entry): # before the model call that answers it {+ns <- session.temporary ? namespace(session) : "ordinary" # 4.7+} entry.seq <- next_sequence(session) # once, never reused entry.author_kind <- owner | agent | tool | harness | other_agent entry.text <- [-replace_prohibited(entry.text)-] {+persist_filter(entry.text)+} # [-4.7, before any write-] {+4.7; also on text sent to a controller+} if entry.author_kind == owner: entry.owner_words <- strip_wrapper(entry.text) # once; never rewritten [-entry.tags-] {+entry.spans+} <- [-classify(entry.owner_words) or "untagged"-] {+split_authority(entry.owner_words) # owner | quoted; unsure: quoted tag_owner_spans(entry.spans)+} # J5 [-A.1-] {+A.1; else "untagged"+} if entry.returns_file: entry.content <- [-blob_put(bytes) # content-addressed-] {+blob_put(ns, persist_filter(bytes))+} record.append_durable(session, entry) # status: captured (4.6) index.add(session, entry.seq, entry) # derived, rebuildable

### B.1 Appending to the record

ERASE(session, seq, {+spans,+} receipt): # writing stage's decision b <- record.blob(session, seq) # none if the entry holds no file hit <- entries_with_blob(b) if b else [(session, [-seq)]-] {+seq, spans)]+} # [-in any session-] {+same namespace+} for (s, [-n)-] {+n, sp)+} in hit: record.redact(s, n, {+sp,+} tombstone(now, receipt)) # the one edit record.append(s, harness("erased", [-n))-] {+n, sp))+} index.reindex(s, n); rebuild(markers_covering(s, n)) {+adapter.redact_controller_copies(s, n, sp) # 4.4, 6.6 adapter.erase_live(s, n, sp) # 6.6: rebuild window, eviction event, name provider copy+} if b: blob_delete(b) manifest.report(status_per_place) # J14 7.7; out of reach named

### B.2 Building a marker and evicting

``` COMPACT(window, session, forced): [-snap-] {+bd+} <- [-snapshot(last_call_sent)-] {+call_breakdown(last_call_sent)+} # 7.3 if not [-snap.reconciles-] {+bd.reconciles+} and not forced: receipt("blocked: [-snapshot");-] {+breakdown");+} return span <- choose_span(window, order = [unchanged_source, tool, agent, owner_rest]) if not forced and not pays(span, [-snap):-] {+bd):+} receipt("declined: price"); return entries <- record.read(session, span.first, span.last) # never old markers marker <- new_marker(range = span, owner = instructions(entries), # [-tags,-] {+owner spans,+} verbatim strings = exact_strings(entries, cap), lines = decisions_and_failures(entries), # with addresses open = open_items(entries)) moved <- enforce_owner_budget(window, marker) # [-5.5; tell the owner-] {+5.5: pointers, then directory+} assert resolves_full_range(marker) # 8.2 window.replace(span, marker, at = stable_position) receipt(executor = runtime, [-snap,-] {+level = known_input, bd,+} before, after, moved, outcome) ```

### Appendix C. The Window Controller Adapter Contract

Version [-1-] {+2+} of the contract. Every adapter implements all rows; a capability it cannot confirm counts as absent.

### Appendix C. The Window Controller Adapter Contract

| Part | What it holds | Rule | |----------|-------------------------|-------------------------| | Version | contract version; adapter version; controller name and version | re-detected at session start and on any model or tool change | | Capabilities | builds calls; event before compaction (can block); summary after compaction; injection before the next call; per-turn injection; {+tool-result replacement;+} readable transcript; clearing controls; {+pause after compaction;+} compacted state readable or opaque | choose the path of §6.2, §6.3 or §6.4 | | Pending state | one harness entry per step: detected, flushed, markers built, injected, [-acknowledged,-] {+delivered,+} closed | each state appended durably before the next step; a restart resumes from the last state; marker IDs make a repeat harmless | | Sequence map | runtime address paired with the controller's entry ID | written at flush; entries only the controller saw get runtime numbers in the controller's order | | Delivery check | marker ID seen in the next call sent (runtime, API) or in the tool's [-transcript-] {+transcript; an API's pause used where offered+} | {+promised before the next client-controlled request;+} not seen by the next turn: resend with the per-turn [-injection;-] {+injection and+} count the turns [-run-] without [-it-] {+it; inference before delivery recorded as unprotected+} | | Knowledge level | [-model view-] {+known input+} (runtime); [-sent and summary (tool); sent only (opaque-] {+sent, unconfirmed (tool,+} API) | [-written-] on every receipt; no claim about the model's view exceeds {+it; after a tool or API compaction, everything sent before+} it {+is residency unknown+} | | Degraded paths | no event before compaction: detect afterwards (a summary appears, input tokens fall), flush, then build; no injection after compaction: per-turn injection, receipt marked late; unreadable transcript: record what the runtime saw and mark the gap in range reads | each path used is named in the receipt | | {+Capture filter | the runtime's one write path, before persistence; tool results replaced where a hook allows; the tool's transcript redacted at the next hook | a copy out of reach is named in a receipt (§4.7) | |+} Erase in live state | rebuild the window (runtime); {+redact copies handed to the controller;+} end or compact the [-session and use-] {+session, using+} the controller's deletion control (tool, API) | each place reported to the [-writing stage's-] deletion manifest (§4.4), unreachable copies named | | Never retained | the controller's no-retention setting, where offered | where none is offered, the owner is told at session start |

### Appendix C. The Window Controller Adapter Contract

_J-series paper J1 | Version [-8.1-] {+8.2+} | 2026-10-12_
