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

From v8.7 (21 Oct) to v8.8 (25 Nov): 15,820 words to 14,699 words, 592 words in new or rewritten paragraphs and 1,713 taken out, 68 paragraphs changed.

## Change note of v8.8

**Main text cut by about 1,300 words; embeddings governed like the record**

The main text goes from about 11,000 to 9,800 words, as a referee report asked. Nearly every section loses some sentences, and no section is added or removed.

- Introduction, related work and several design sections are shorter.
- The adapter contract appendix grows.
- From the improvement notes: the paper now says why search needs both words and embeddings, that embeddings are derived copies of the record, and that erase, quarantine and temporary sessions apply to them too.

## Changed paragraphs

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

### 1.1 Monday to Friday

The agent's runtime, the program that runs the model and its tools, compacts: a model rereads the first hours and writes a summary. The best tools today write a good one. Claude Code asks for a structured summary that lists [-every message from-] the [-owner,-] {+owner's messages,+} keeps the ones that look like safety rules word for word, lists [-the errors met-] {+errors, files+} and [-how they were fixed, the files touched-] {+pending tasks,+} and [-the tasks still pending, and it-] gives the model the path of the full transcript [-to open when it needs exact wording-] (Anthropic, 2026i). A standing rule such as "never restart the production database during the day" [-is exactly what it is told to keep, and it-] would survive. [-The summariser's-] {+Its+} instructions also carry the warning that matters here: what the summary leaves out, the next window will not know to look for.

### 1.1 Monday to Friday

The staging sentence is another kind of thing. It is no safety rule, and nobody would write it into the project's always-loaded instruction [-file, since-] {+file:+} it belongs to this job and matters only {+at+} the next [-time a renewal is tested.-] {+test renewal.+} The job runs all week. The window fills several times a day, and each night [-the session is closed and-] a new [-one-] {+session+} starts from what the last one left. By Friday the sentence has been through a dozen compactions, each summary written from the one [-before plus the newer turns,-] {+before,+} and [-through-] four new sessions. On Friday afternoon the agent tests a renewal against production, hits the same rate limit, and the owner has to say again what they said on Monday.

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

Context windows have grown to a million tokens, but models [-do not read long inputs evenly. Detail-] {+use detail+} in the middle of a long [-context is used-] {+input+} less well than [-detail-] at [-the start or end-] {+its ends+} (Liu et al., 2024), and accuracy falls as input grows even on simple tasks (Hong et al., 2025). A week of tool [-output, file reads and logs-] {+output+} can also outrun any window. So compaction stays, and the question is what it should leave behind.

### 1.3 What summaries lose

[-A summary keeps the shape of the work and drops its substance. The table below lists four kinds of detail that summaries tend to drop when they must be short; it is not measured here, and test 1 measures it.-]

### 1.3 What summaries lose

{+A summary keeps the shape of the work and drops its substance: exact strings (a path, a hash, an error line) come back paraphrased, causes collapse into "it failed", failed attempts give way to what worked, and times look like noise. That is a tendency, not a measurement here; test 1 measures it.+}

### 1.3 What summaries lose

[-A fifth kind matters more: the-] {+The+} owner's own [-words.-] {+words matter more.+} An instruction or a correction is the one thing the owner expects never to repeat. A good summary is asked to list the owner's messages and to keep safety rules word for word, but a correction said in passing is left to the summariser's judgement, a long list gets shortened, and nothing tells the model what was cut. Repeated compaction makes it worse: each summary is written from the previous one and loses detail again, which Zhang et al. (2025) call "context collapse".

### 1.3 What summaries lose

[-| Kind | Example | Why a short 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 summariser |-]

### 1.4 Who holds the pen

Three things sit between the owner and the model. The **runtime** is the program the owner runs: it takes the owner's messages, calls tools and logs the session (some call it the harness). Inside it, the **memory layer** is the part this paper designs. And something decides, on every call, exactly what text the model reads; we call it the **window controller**. Sometimes that is the runtime, which builds each request to the model's API itself. Sometimes it is a provider's command-line agent, such as Claude Code, [-that the runtime drives: the agent-] {+which+} keeps its own copy of the [-conversation,-] {+conversation and+} compacts it when it [-chooses and writes its own summary.-] {+chooses.+} Sometimes it is the provider's API, which may clear old tool results or compact [-on its servers-] partway through a reply.

### 1.5 The claim

This is one of four designs for one agent's memory: keeping what happened (this paper, J1), writing what becomes a long-term fact (the writing paper, J14), finding it again (the finding paper, J2) and turning experience into behaviour (the learning paper, J5). The other three are [-listed-] in the References (Serra, 2026a, 2026b, [-2026c), and-] {+2026c);+} a pointer such as "J2 §6.8" names [-a section of-] one of [-them. The learning paper follows one owner correction through all four (J5 Appendix B);-] {+their sections, and+} Appendix E lists the [-handoffs that pass through this one.-] {+handoffs.+}

### 2. One Span, Start to Finish

Table 1 sets the marker beside six other ways to carry a long job past a full window, on the two things of §1.1 [-a reader of the window most needs:-] {+that matter:+} the correction given at 14:34 and the exact renewal error.

### 2. One Span, Start to Finish

| Approach | The passing correction (14:34) | The exact renewal error | Way back to the original | Where it breaks | |-----------|---------------|-------------|-----------|------------------| | Bigger window (a million tokens) | in view, deep in a long input, where models use detail less well (§1.2) | in view, with the same caveat | none needed until it overflows | every call rereads it all; a week of logs still overflows | | Summary only (an API's default) | kept if the summariser judged it important | usually paraphrased | none | the model cannot know what was dropped | | Structured summary and transcript path (Claude Code today) | listed among the owner's messages; kept word for word only if judged a safety rule | listed among errors; exact wording not required | one path to the whole [-transcript, which the model must open and search-] {+transcript+} | does not say what it left out; each summary is written from the last; [-no size limit and no notice;-] a new session starts without it | | Retrieval over chunks (vector memory) | returned only if a search runs and ranks it | returned if its chunk ranks | similarity search | nothing prompts a search before the agent acts; hashes and error codes match poorly by meaning | | Cross-chat memory (Claude, ChatGPT) | only if saved as a lasting fact | no | links to past chats (Claude) | built for preferences across chats, not the details of one job | | Always-loaded file (CLAUDE.md, AGENTS.md; custom instructions) | in every call of every session, once someone writes it there | not its job | none needed | holds only what someone [-thought to write-] {+wrote+} down; every line costs every [-call; a one-job instruction does not belong there-] {+call+} | | Marker and range read (this paper) | word for word while it fits the owner's budget or is pinned, then a pointer line; carried into the next session (§5.6) | a line with the error and its address; [-one-] {+a+} range read returns the exact text | an address per item | the agent must still follow a pointer (test 7); [-costs marker tokens and-] one cache rewrite per eviction |

### 2. One Span, Start to Finish

[-The structured summary and the marker can share the same way back into the record. What the marker adds is what the window says is there:-]

### 2. One Span, Start to Finish

[-- an address for each item, where the summary has one path to everything; - a size limit for the owner's words, and a notice when one of them leaves view (§5.5); - markers rebuilt from the record, where each summary is written from the one before (§5.4); - a check that every quote, string and address resolves (§8.2); - markers that carry into the next session (§5.6); - one contract whichever program controls the window, with each receipt saying how much it can confirm (§6).-]

### 2. One Span, Start to Finish

[-Whether that raises recovery enough to pay for building the marker and for its tokens is what test 1 decides (§10). Table 2 gives each approach a picture and a rough price.-]

### 2. One Span, Start to Finish

{+The structured summary and the marker can share the same way back into the record. What the marker adds is what the window says is there: an address per item, a budget and a notice for the owner's words (§5.5), a rebuild from the record each time (§5.4), a check that every address resolves (§8.2), a carry into the next session (§5.6) and one contract for every controller (§6). Whether that pays for the marker is what test 1 decides (§10). Table 2 gives each approach a picture and a rough price.+}

### 2. One Span, Start to Finish

| Approach | Picture | What it pays | |--------------|----------------------|----------------------| | Bigger window | a bigger [-desk: everything is on it, and-] {+desk, where+} you still skim the middle of the pile | every call rereads the whole [-window from cache,-] {+window,+} about 100,000 units a call at a million tokens | | Summary | someone clears the desk and leaves a sticky note | one model call per compaction, and the cache written again from the summary on | | Structured summary with a transcript path | a tidy memo, and the key to the archive | the same as a summary | | Retrieval over chunks | a clerk who fetches pages [-about your question-] if you think to ask, and [-who-] is poor at serial numbers | one more call per search, about 20,000 units in the example of §7.2 | | Cross-chat memory | the notebook you keep about a client between projects | its lines, read on every call | | Always-loaded file | the sign on the wall | its lines, read on every call | | Marker (this paper) | a call slip where the folder was, with your instruction copied out in full and the shelf number of every page | about 300 tokens in the window; once per eviction, a cache rewrite plus building the marker, about 157,000 units in the example of §7.2 |

### 3. Related Work

| System | What it already does | How Total Recall relates | |-----------------|------------------------------|------------------------------| | MemGPT and Letta (Packer et al., 2023; Letta, 2026) | pages context in and out like an operating system, keeps the full history in a searchable recall store, and compacts [-automatically-] with a configurable [-summariser, including modes that keep the prompt prefix cache-friendly-] {+summariser+} | same hierarchy and full history; the evicted range leaves a marker [-with exact strings and addresses-] instead of a summary (§5.1), and test 1 compares the two with the same record access | | ARC (Dang et al., 2026) | keeps tool observations in an append-only log with IDs and replaces older ones with short citations [-that-] the agent can expand exactly; reports 99.40% exact-answer accuracy on needle-in-a-haystack [-tests with this recall,-] {+tests,+} against 88.12% for its best baseline | the closest mechanism, for tool [-output, with a measured result;-] {+output;+} Total Recall adds the owner's words under a budget (§5.5), erasure [-and quarantine-] (§4.4) and one contract for every [-window-] controller (§6), and test 1 extends the measurement to the owner's words and to repeated compaction | | Provider compaction (Anthropic, 2026a, 2026d, 2026e; OpenAI, 2026a) | clears old tool [-results behind a placeholder,-] {+results,+} or summarises at a threshold, sometimes inside a response; Anthropic can pause after its [-summary and lets a client replace the summary instructions,-] {+summary,+} OpenAI carries state in an opaque item | [-works through these controls:-] markers go in at the pause or before the next request, and an unprotected stretch is recorded (§6.4) | | Claude Code and claude-mem (Anthropic, 2026b, 2026i; thedotmack, 2026) | Claude [-Code's compaction-] {+Code+} writes the structured summary of §1.1 [-with the transcript path,-] and offers hooks before and after [-it;-] {+compaction;+} claude-mem [-captures-] {+compresses+} what the agent [-does, compresses it-] {+does+} with a model and injects it into later sessions | the strongest baseline (Table 1); uses the same hooks (§6.3), keeps the summary, and adds addressed markers built from the record | | Manus (Ji, 2025) | compresses only in restorable ways (drop a page, keep its URL), keeps the prefix stable for the cache and leaves failed attempts in view | extends "restorable" to the whole conversation and prices moving the prefix (§7.2) | | headroom (Headroom Labs, 2026) | compresses what the agent reads and gives the model a tool to fetch the originals | headroom keeps a smaller version in the window; Total Recall removes the span and leaves a pointer | | [-Zep-] {+Zep, Graphiti+} and [-Graphiti-] {+Mem0+} (Rasmussen et al., 2025; Zep, {+2026; Mem0,+} 2026) | [-stores-] {+store+} raw episodes [-and links each extracted entity back to the episode it came from | the same layering, applied to the context window: what stays advertised after eviction | | Mem0 (Mem0, 2026) | ranks extracted memories by query, and can store raw-] {+or+} messages exactly as [-given-] {+given, and link extracted memories back to them+} | exact storage exists already; Total Recall's part is what replaces the evicted text and how it reaches the model (§5, §6) | | Claude and ChatGPT memory (Anthropic, 2026h; OpenAI, 2026b) | carry context from earlier chats into new [-ones; Claude links the past chats it used,-] {+ones,+} and [-both-] let the owner manage what is kept | owners already expect to see what is kept; Total Recall's receipts and notices feed the finding paper's view for the owner (J2 §6.8) |

### 3. Related Work

ARC shows that exact, addressable recall of evicted observations already [-works in a research setting.-] {+works.+} Total Recall therefore claims a combination: the owner's words kept apart and budgeted, privacy handling, and one contract for every window controller. Whether the combination beats its parts is not yet shown; test 1 checks it with an arm that drops the owner's section. [-Agentic Context Engineering-] {+Against context collapse+} (Zhang et al., [-2025) names brevity bias and context collapse; our answer to collapse is that-] {+2025),+} every marker is written from the record (§5.4).

### 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 whether it is phishing wrote the question, not the email. So `owner_words` is first cut into **spans**, then labelled. The cutter is plain code: it splits at sentence ends, semicolons, line breaks, list items, and a comma before [-"and",-] {+a joining word ("and",+} "but", [-"also" or "then"-] {+"then", kept per language)+} when a new verb follows. [-Those words are kept per language; in a language the cutter has no list for, it splits only at the marks, which can leave two instructions in one span.-] In doubt it cuts, since a cut too fine costs an extra span and one too coarse puts two corrections under one address. A span is immutable and addressed (§4.2); the cutter's version is stored with it, and a newer cutter never re-cuts a stored entry.

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

The first label says whose words they are. A span is *owner* when the owner says it in their own voice, and *quoted* when they paste, forward or report what someone else said. Layout settles most [-cases: a-] {+cases (a+} pasted block, a forwarded header, quotation [-marks. A-] {+marks), and a+} check for reported speech ("she says we should...") settles the rest. When [-that check is-] unsure, the span counts as quoted until the owner confirms [-it; the confirmation is stored as-] {+it in+} a new [-entry, and the span itself never changes.-] {+entry.+} The two mistakes do not cost the [-same. Taking-] {+same: taking+} the owner's instruction for a quote costs one [-repetition. Taking-] {+repetition, while taking+} a pasted attack for the owner's instruction lets a stranger give the agent orders.

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

The second label says what an owner span is for: an instruction, a correction, praise, or nothing in particular. One classifier assigns it, shared with the learning stage [-(its contract is in J5-] {+(J5+} Appendix A.1), and it only ever sees owner spans. Quoted spans get no second label, so they never become an instruction or a correction, and they keep their quotation marks wherever they are copied. The learning stage reads the stored labels [-when it queues a correction and when it replays one,-] and never classifies the text again. A span the classifier [-could not label, or-] is unsure [-of,-] {+of+} counts as an instruction until the nightly pass labels it (J5 [-§6.2); that late label is added-] {+§6.2),+} with its own version.

### 4.3 Never edited, never superseded

Edits and deletes in a chat follow the same rule. [-Chat channels let people edit a sent message or delete it for everyone, and neither changes a stored entry.-] An edit is appended as a new entry linked to the one it changes, [-its spans-] cut and labelled like any owner message, so [-the writing and learning stages read-] an edited correction {+reads+} as a correction of that [-span and-] {+span,+} not [-as-] a second one. A delete is appended as a runtime entry and passed to the writing stage: from the owner [-it is-] a likely erase request, [-and the stage asks when the intent is unclear;-] from a third party in a shared chat [-it is-] a privacy event [-the stage must answer (§4.4). Claude Tag, Anthropic's agent for a team's chat channels, already handles edits this way: the agent gets a note with the text before and after, and both stay in the session transcript (Anthropic, 2026g).-] {+(§4.4).+}

### 4.4 Erase and quarantine

[-We keep everything, but some-] {+Some+} text must go: a phone number the owner wants forgotten, a key pasted by mistake, a line an attacker slipped in. So the record allows one edit, the tombstone, and one ordering [-rule, so that no read sees the state from before the deletion.-] {+rule.+} The writing paper decides when an erase or a quarantine applies (J14 §7.7); this section says what each does to the record.

### 4.4 Erase and quarantine

**Erase** is for privacy. The entry, or only the spans the erase names, is redacted at the same address, span by span. Address, author and time stay; the text is replaced by a tombstone that says content was removed, when, why and under which deletion receipt. The tombstone holds no part of the content, not even a hash, since the hash of a short string such as a phone number can be guessed. A string erased from a file read is replaced in a new copy of the file, so the rest of the file stays (Appendix D). Everything derived is rebuilt from the redacted record: the [-text index,-] {+search index and its embeddings,+} every marker that covered it (§5.4), the copies handed to the window controller, and the live window.

### 4.4 Erase and quarantine

[-Deleting takes time, and reads keep arriving meanwhile;-] §8.1 [-and Figure 6 give-] {+gives+} the ordering rule that keeps [-them-] {+reads+} from seeing the old [-text.-] {+text while a deletion runs.+} Addresses do not move, so every pointer still resolves. Appendix D covers [-what a builder needs beyond this: files-] shared [-by many entries,-] {+files,+} copies a provider holds, and the strongest claim this stage may make when [-it is-] done.

### 4.5 One record, not copies

The record needs no new database. [-The runtime already writes a transcript of every session, and a provider's tool writes its own. The record-] {+It+} is the runtime's transcript plus three additions: the fields written [-when an entry is appended-] {+at append+} (§4.1), a store of file contents, and an index that finds any entry by its address. The memory layer writes entries of its own only for [-the-] {+its+} markers and [-maps it builds,-] {+maps,+} and for API sessions [-that leave-] {+with+} no readable transcript (§6.4). It never keeps a second, partial copy, [-because-] {+since+} a range read against [-a partial copy-] {+one+} returns an answer that looks complete and is not.

### 4.5 One record, not copies

{+Search over the record belongs to the finding stage, whose index pairs words with embeddings over meaning (J2 §4.1). Each leg misses what the other finds: meaning misses hashes and error codes (Table 1), words miss an instruction the owner later describes differently. Both legs are derived copies, rebuilt from the record. An embedding counts as a copy of its text, since much of a text can be rebuilt from its vector (Morris et al., 2023), so an erase or a quarantine reaches it as it reaches a marker (§4.4), and a temporary session never enters it (§4.7).+}

### 4.6 When a message is captured

An owner message is *captured* when its entry, with `owner_words`, its spans and their labels, is [-in-] {+written and flushed to+} the [-session-] record [-durably (written and flushed) and has-] {+with+} its address. The runtime appends [-the message-] {+it+} from its own copy before the model call that answers it, so capture does not wait for a provider's [-transcript. One-] {+transcript, and one+} flush captures every correction in [-a message, each an immutable span with its labels and their versions.-] {+the message.+} If the process dies before the learning stage queues them, the restart rebuilds the queue events from the stored labels, asking no classifier.

### 4.6 When a message is captured

Until then the message is pending, and the agent says nothing about keeping it. If the append fails (a full disk, a crash), the runtime shows the message as not captured and retries from its in-memory [-copy.-] {+copy; Appendix C says how a retry or a restart avoids a second entry.+}

### 4.6 When a message is captured

[-A retry must not create a second entry. Each incoming message carries its source's message ID, and the record stores the pair (message ID, address) in the same durable write as the entry. A retry or a duplicate delivery finds the pair and gets the existing address back, also when the append was durable and only its acknowledgement was lost. 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 message recoverable from neither side is reported as lost, never as kept.-]

### 4.7 Sessions that are never kept

A key pasted into a chat should become `[credential removed]` before anything is [-written. Some things should never reach the long-term side, and-] {+written:+} the place to stop [-them-] {+it+} is 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 it need it. Its record and blobs live-] in a namespace shared with no ordinary session, even for the same file. The long-term stages skip it: no fact, no lasting index row, no learning evidence. At its end the namespace is deleted whole, with a [-receipt, and an ordinary session that read the same bytes keeps its own copy. Where the controller offers a no-retention setting, the-] {+receipt. The+} adapter turns [-it on;-] {+on the controller's no-retention setting where one exists, and+} otherwise {+tells+} the owner [-is told at the start-] that the provider keeps [-its own-] {+a+} copy.

### 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 or search [-with, and can be mistaken for a fact.-] {+with.+} Everything in a marker is a quote or a line that points at one. The one-line items are the only part a model writes (§7.2), and the [-string each carries is what the-] check of §8.2 tests {+the string each carries+} against the entry it [-cites, so a line that names the wrong entry fails the check.-] {+cites.+} The exact strings [-serve-] {+let+} the [-model, which can often-] {+model+} act without pulling [-anything because the hash is right there,-] {+anything,+} and {+let+} a later [-search, which finds-] {+search find+} the span by the strings the owner will use.

### 5.3 What leaves first

One eviction removes one run of whole turns: the oldest turns after the last marker, as many as it takes to free the room needed, and a marker covers exactly that range (§5.1). The run is cut whole because every eviction moves the cache prefix (§7.2), and many small cuts would pay that price many [-times. Older-] {+times; older+} turns [-leave-] {+go+} first, since recent content is the best guess at what is needed next. [-What the marker keeps of the run follows §5.2.-] When only a little room is needed, clearing old tool output in [-place, as a provider's clearing does,-] {+place+} may be enough; the receipt lists what was cleared.

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

When a merge rebuilds markers, the new marker is built from the record entries the old markers pointed to, not from their text. This rule stops context [-collapse. A-] {+collapse: a+} summary of a summary loses detail [-at-] every round, while a marker written from the record draws on the same entries at the hundredth compaction as at the first (Figure 2). That is a promise about the source, not about what stays in view: merged [-markers share-] {+lists are+} capped [-lists,-] and old instructions [-move out to-] {+become+} pointer lines [-(§5.5). What-] {+(§5.5), but what+} drops out of view [-stays at-] {+keeps+} its [-address in the record.-] {+address.+}

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

That would take down an early safety rule before a late formatting [-preference. To stop that,-] {+preference, so+} the owner can pin an instruction, and a pinned one never comes down. [-Pins share the board; if-] {+If+} pins alone would fill [-it,-] {+the board,+} the agent asks the owner to move one into the always-loaded file. Each time an instruction comes down, the next reply says so and offers the pin, and the receipt lists the move (§7.4).

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

Pointer lines take room too, so the board holds at most $k$ of them. When one more would pass $k$, they all give way to a single line: "Eleven earlier instructions, s7#12 to s7#311, are listed in the directory at s7#320." The directory is a new {+record+} entry [-in the record-] that lists every instruction taken down, with its [-address. It is read like any long tool result, a page at a time, and §5.3 may evict it again like one; each page holds-] {+address, in pages of+} at most $D$ [-tokens and ends-] {+tokens, each ending+} with the address of the next. [-Three hundred instructions of about 30 tokens fill five pages at $D$ = 2,000.-] {+It is read and evicted like any long tool result.+}

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

The guarantees hold whatever the three values [-are, but a builder needs numbers on day one.-] {+are.+} As unmeasured starting points: $B_o$ = 1,500 tokens, about fifty instructions; $k$ = 10; $D$ = 2,000. Test 1 sweeps them, and test 11 checks that the limits [-hold.-] {+hold. Table 5 follows the staging correction of §1.1 through the three states, with $k = 2$.+}

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

[-However long the session, the owner's instructions never take more than $B_o$ of the window, each one can be read back word for word from its address, and the owner hears when one leaves view. Table 5 follows the staging correction of §1.1 through the three states, with an illustrative limit of $k = 2$ pointer lines.-]

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

[-The directory entry lists all three addresses, s7#24/0 among them, and its pages obey $D$.-] The wording stays at s7#24/0 unless it is erased or a temporary session [-ends. The record keeps the instruction-] {+ends,+} while its presence in what the model reads grows [-weaker, and that weakening is the risk-] {+weaker;+} test 7 [-measures.-] {+measures that risk.+} So the promise has three [-parts:-] {+parts. Every instruction stays **recoverable** word for word through its address while it is not erased, though a long directory is read a page at a time. It stays **in view** while it fits or is pinned, and the owner is told when it leaves. It is **carried into the next session** while the opening budget allows (§5.6), and **held for good** only in the always-loaded file.+}

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

[-1. Every instruction stays **recoverable** word for word through its address, as long as the record lives and it has not been erased. That does not make them all loadable together, since a long directory is read a page at a time. 2. It stays **in view** word for word while it fits or is pinned, and when it leaves, the owner is told. 3. It is **carried into the next session** by its marker while the opening budget allows (§5.6), and **held for good** only in the always-loaded file.-]

### 5.6 From one session to the next

A long job outlives its [-session. A runtime may close a session each night, or after an hour of quiet (§7.5),-] {+session,+} and the next [-one-] {+session+} should not start blind. So when a session closes, the runtime appends a closing entry that lists the markers in its window, and the next session opens with them, pinned instructions first, while they fit its opening budget. A carried marker keeps its own session and range: markers from two sessions never merge into one, since a range is one session's sequence numbers (§5.1). Carried markers that do not fit give way to one line that points at the closing entry, which lists them all.

### 5.6 From one session to the next

[-An instruction is carried beyond its session by its marker while the opening budget allows, and held for good only in the always-loaded file, where the writing and learning stages promote a rule the owner keeps repeating (J14 §8.2; J5 §5).-] Figure 3 follows the staging correction [-of §1.1-] through the week. {+A rule the owner keeps repeating is promoted to the always-loaded file by the writing and learning stages (J14 §8.2; J5 §5).+} The path has one weak [-point, and the design names it:-] {+point:+} once the correction is a pointer line, it protects the owner only if the agent follows it, or if the owner pinned it when told it had moved. Test 7 measures the first.

### 6.1 Three window controllers

[-The window controller is whoever decides, on each call, what the model reads.-] There are three [-cases,-] {+window controllers,+} shown in Figure 4, and one agent can move between them as it switches models or tools:

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

- Before compaction (`PreCompact`). The hook [-makes-] {+completes+} the record [-complete-] up to this moment, reading the tool's [-own-] transcript where needed. It does not say [-which part-] {+what+} the tool will summarise, so the adapter [-takes-] {+builds markers from the record for+} everything since the previous compaction [-(or the session start) as the range-] and [-builds markers from the record; a marker for a turn the tool keeps verbatim costs a few tokens. The pending markers are written-] {+writes them+} durably before the hook returns. [-The hook could block-] {+It lets+} the [-compaction, but when the tool compacts to recover from-] {+compaction run, since blocking a compaction forced by+} a full [-window, blocking-] {+window+} fails the [-request, so the default is to let it run.-] {+request.+} - After compaction (`PostCompact`, then `SessionStart` with `source=compact`). The adapter stores the tool's summary as a runtime entry [-where the event carries it,-] and injects the stored markers [-into the new context-] {+beside it+} before the next model [-call, beside the summary.-] {+call.+} - Delivery check (every turn). The adapter looks for the marker IDs in the tool's transcript. A marker that is absent is sent again with the next prompt's injected text, and the receipt counts the turns run without it (§6.6).

### 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. Three moves cover it. First, the runtime keeps its own record of everything [-it-] sent and [-received;-] {+received, which+} after [-a-] {+an opaque+} server-side compaction [-this may be-] {+is+} the only readable [-copy, and with opaque compacted state it certainly is.-] {+copy.+} Second, it uses the API's [-own controls to protect what must stay:-] {+controls:+} it names the tools whose results are never cleared and sets a minimum to clear, so a small clearing does not break the [-cache for a small gain.-] {+cache.+}

### 6.6 The adapter contract

An adapter [-is the small piece of code that-] connects the memory layer to one window controller, the way a printer driver connects a computer to one [-model of-] printer. All adapters follow one contract (Appendix C). Each starts by listing what its controller [-allows: does it warn-] {+allows (a warning+} before compacting, [-can its transcript be read, can-] {+a readable transcript,+} text [-be-] added before the next [-call? Anything the adapter-] {+call); anything it+} cannot confirm counts as missing. It [-then-] runs every compaction as a checklist (noticed, [-record-] saved, [-markers-] built, [-markers-] injected, [-markers-] seen, closed) and writes each tick to the record [-before the next step starts,-] {+first,+} so [-after-] a crash [-it carries on-] {+resumes+} from the last tick.

### 6.6 The adapter contract

Every receipt also says how much the memory layer can know. When the runtime built the call, it knows [-exactly-] what the model read: *known input*. When a provider's tool or API sits in between, it knows {+only+} what it [-sent (and, for a tool, the summary the tool wrote), never what the model kept:-] {+sent:+} *sent, unconfirmed*. It is the difference between handing someone a letter and posting it. Nothing may claim more than its receipt's level; in particular, the learning stage never counts a rule that was only sent, unconfirmed, as one the model saw (J5 §5.4).

### 7.1 Forced and elective

A compaction is forced when the next call would not fit the [-window: there is no choice about whether,-] {+window;+} only [-about-] what to evict (§5.3) and [-what to-] leave [-(§5.1).-] {+(§5.1) is open.+} It is elective when the window has room but keeping a span costs more than evicting it, or a smaller window would be read better (§1.2); only an elective [-compaction-] {+one+} can be declined on price.

### 7.2 The price of moving the prefix

With 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 everything after the first changed token is written to cache again at a premium (Anthropic, 2026c; Ji, 2025). Take a box out of the middle of a full shelf and every box to its right has to move; the cache works the same way. [-Evicting a span from the middle of the window changes everything after it.-] So eviction has one-time costs, a running saving, and the cost of the pulls it causes. All of it is counted per call (§1.4); the finding paper counts the same unit and calls it a turn.

### 7.2 The price of moving the prefix

With the assumed inputs of Appendix F, a 40K-token span with the five-minute cache pays back after about 40 calls if nothing is pulled from it, after about 57 if one later call in twenty pulls, and never once more than about one call in six pulls. A 100K-token span [-pays back after-] {+needs+} about 22 [-calls;-] {+calls,+} a 10K-token span [-needs-] about 131. The [-cache matters as much as the span: with the-] one-hour cache ($w = 2$) {+raises+} the 40K span [-needs-] {+to+} about [-58 calls, with-] {+58,+} reads at 0.05 {+to+} about [-82, and with both about 119. Cheaper cache reads push break-even out.-] {+82.+} Whether [-a session still has-] {+sessions have+} that many calls [-ahead when the window has room,-] {+left,+} and how often [-it pulls,-] {+they pull,+} is what test 5 measures; until then the rule says how to decide, not [-whether-] {+how often+} elective eviction will [-be common or rare.-] {+run.+}

### 7.2 The price of moving the prefix

Three design rules hold whatever the numbers. Evict large runs at once, since the rewrite is paid per [-eviction and the saving grows with the span.-] {+eviction.+} Prefer runs that are rarely pulled: age is a fair guess [-at that, which is why a run starts at the oldest turn-] (§5.3), but a run that reaches the latest error output will often be pulled back and should stop short of it. And leave a {+placed+} marker unchanged [-once it is placed, as §5.3 rules.-] {+(§5.3).+} The benefit of a shorter window (§1.2) is unpriced; test 5 measures it.

### 7.3 A trigger you can trust

Every compaction decision starts from [-one number:-] how full the window is, taken from the call actually sent. A figure that sums [-several-] {+the+} calls of one turn [-can be many times the window and-] fires compaction far too early; one that misses a block of the prompt fires it too late.

### 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: a missing receipt is the alarm (J5 §9.1). The receipt is also the eviction event of §6.6, and its evicted field lists cleared tool results as well as marker ranges, since an API's clearing leaves no marker. It [-says-] {+records+} who ran [-the compaction-] {+it, what was decided+} and [-under which controller, whether it was forced or elective-] {+why, what left+} and what was [-decided, the call breakdown, the tokens before and after, every evicted range with the files read in it, the markers written and-] {+written,+} whether each {+marker+} was delivered, [-the instructions moved,-] and how much the memory layer can know [-(§6.6).-] {+(§6.6);+} Appendix C lists the fields.

### 7.5 Idle sessions: compact before the cache lapses, or start fresh

A prompt cache keeps the processed start of a conversation for five minutes, or [-for-] an hour on the longer [-setting. When-] {+setting; once+} it expires, the next message pays to process the whole window [-again, whatever we do.-] {+again.+} So the best moment to compact an idle session is just before [-the cache expires.-] {+expiry.+} If the owner [-comes back after it has expired,-] {+returns later,+} the {+compaction's+} rewrite [-that a compaction causes-] costs nothing extra, [-because the-] {+since+} expiry forces it anyway, and the marker was cheaper to build while the old text was [-still-] cached. If the owner [-comes back-] {+returns+} sooner, the [-compaction-] {+cache+} moved [-the cache-] for nothing; if [-nobody comes back,-] {+never,+} the marker was built for nothing. Test 6 measures how often each happens. Claude Code shipped this timing in October [-2026:-] {+2026, compacting+} a conversation over 200K tokens [-left-] idle for about 54 minutes [-is compacted-] just before its one-hour cache expires (Anthropic, [-2026f). Where-] {+2026f); where+} the runtime controls the window, that moment builds markers [-instead of a summary.-] {+instead.+}

### 7.5 Idle sessions: compact before the cache lapses, or start fresh

A session idle for hours raises a different question: compact [-it-] again, or start [-a new one? A-] {+fresh? Claude Tag, Anthropic's agent for team+} chat [-that never ends would otherwise compact forever. Claude Tag-] {+channels,+} starts a fresh session [-for a channel-] after about an hour of [-quiet, or when the session is about a day old and the channel is-] quiet (Anthropic, 2026g). [-In this design-] {+Here+} a fresh session loses nothing: it opens with the {+old session's+} markers [-the old one ended with-] (§5.6), the always-loaded files and [-the-] long-term memory, and every {+old+} address [-in the old record-] still resolves. We propose a fresh session when the cache has expired and the old markers fit the new [-session's-] opening budget, and a compaction otherwise; test 6 decides.

### 8.1 The range read

Every range read and [-every-] window build [-looks at-] {+checks+} the counter [-first. If a deletion has been announced and not yet applied,-] {+first:+} it [-waits. If-] {+waits while+} a deletion is announced {+and not applied, and runs again if one is announced+} while it [-runs, its result is thrown away and it runs again.-] {+runs.+} So [-between the decision and the end of the rebuild,-] no read returns erased text and no window carries it to the model. The work is [-also-] safe to repeat: progress is written [-to the record-] as it goes, so a crash resumes where it stopped, and a deletion order that arrives twice [-gets the same answer the second time without being-] {+is+} applied [-again-] {+once+} (Appendix B.1).

### 8.2 Every marker resolves

A marker that names entries the range read cannot return is a broken promise, and a check forbids it. [-Resolving a marker's-] {+Its+} range must return every sequence number from first to last (a tombstone or [-a-] placeholder counts as present); every blob it [-refers to-] {+names+} must be [-in the blob store;-] {+stored;+} every exact string and owner sentence [-it carries-] must appear in an entry inside the range; and [-the string on-] each one-line [-item-] {+item's string+} must appear in the entry [-that line-] {+it+} cites. The check runs when the marker is written and again in the nightly tests.

### 8.3 Asking a past session

Sometimes the best source is the session that did the work; the finding paper decides when to ask one (J2 §6.9). The session is woken in place, not copied: its record grows by a runtime entry that marks a later visit, then one question and one answer, so a reader can tell what it said at the time from what it said when woken. Before the question it gets a short wake-up note: today's date, how long it slept, and what changed since, as far as the record and the store can say cheaply (facts it touched that [-were superseded or erased,-] {+changed,+} newer commits to [-files it edited,-] {+its files,+} rules added or retired). Its answer is testimony from its own time, [-which the asker checks-] {+checked+} against the current [-store; a-] {+store. A+} session is not woken while an erasure epoch is [-still-] unapplied to it, and a temporary session {+never+} is [-never woken, since its record is gone-] (§4.7).

### 9.1 In short

After compaction, an [-agent's next inference-] {+agent+} sees a description of its [-past, at best with one path to the whole transcript,-] {+past+} and nothing that says what the description left out; a new session sees less. Total Recall keeps the whole session as an addressed [-record and-] {+record,+} makes compaction leave markers that quote what a description drops and point back into the record, carries them into the next session, and follows one contract whichever controller holds the [-window, claiming no more about the model's view than that controller lets it know.-] {+window.+} If it holds, [-and the marker reached the model,-] what the owner said on Monday has an exact answer on Friday: [-the instruction is-] in view while it fits [-the owner's budget-] or is pinned, or a line in view says where it is. Whether the agent [-then-] acts on that line is the open question (test 7). If it does, the agent [-becomes-] {+is+} the colleague of the opening: told once on Monday, still careful on Friday.

### 9.2 Limitations

- Markers depend on extraction by code and a classifier; a missed string is still in the record, but the marker no longer advertises it. - The one-line items are written by a model. The check of §8.2 catches a line whose string is not in its entry, not a line that misreads an entry it quotes correctly. - Past the owner's budget, old instructions are a pointer line or a directory page away, and the oldest go first, so an early safety rule leaves view before a later preference unless the owner pins it. Past the opening budget of a new session, they are one read further. The agent must follow the pointer when it matters (test 7). - Hooks are the provider's to change. An API that compacts mid-response without a pause leaves the rest of that response unprotected, and opaque compaction cannot be [-checked; the receipt says so, but the gap remains.-] {+checked.+} A [-tool's or an API's-] {+provider's+} own copy of erased [-or quarantined-] content is reached only by ending the session and rebuilding it. - The record grows without bound, and the capture detector will miss some secrets; years of sessions will need tiered storage, which the design does not cover. - The price rule rests on unmeasured inputs ($q_{\text{call}}$, $H$, $c$, $\ell$) and on how many calls a session has left, and cheaper cache reads push break-even further out. - Recoverable is not recovered: whether the agent asks for what it can read back is the finding paper's question. - A woken session answers from its own time. The wake-up note tells it what changed only as far as the record and the store know.

### 10.1 Experiments that decide the claim

Two tests carry the claim. Test 1 checks the mechanism: given the same way back into the record, does a marker keep the owner's words and the exact strings better than a summary? Test 3 checks the [-outcome-] {+outcome: does+} the owner [-feels: do they have to-] repeat themselves less? The other five measure what the design guesses [-at. Tests-] {+at; tests+} 8 to 15, the checks a build must pass, [-where any failure is a defect,-] are in Appendix E.

### 10.1 Experiments that decide the claim

[-A test that tunes something-] {+Tuning+} (the [-string-] extractor, the classifier thresholds, the budgets) [-tunes on-] {+uses+} development sessions and is scored on held-out ones (J5 §9.2). Live arms are randomised by [-session. Arms that are-] {+session, and+} compared {+arms+} get the same context budget and [-the same-] compaction [-schedule,-] {+schedule+} and [-each reports its-] {+report their+} total token cost, so a gain cannot come from a larger window or fewer compactions.

### 10.1 Experiments that decide the claim

| # | Test | Decides | What would change the design | |--|---------------------|-------|---------------| | 1 | Needle survival. Seed exact strings, owner instructions (standing rules and [-corrections said in passing),-] {+passing corrections),+} failed attempts and times early in long synthetic sessions; force 1, 3 and 5 compactions; ask for each, scoring [-the owner's-] instructions apart from [-the-] strings. Arms: the provider's summary alone; the provider's structured summary with its transcript path; truncation; **the summary plus the same searchable record and range read (the control)**; markers plus range read; markers without the owner's section, which is close to ARC; markers alone. Sweep $B_o$, $k$ and $D$ around §5.5's starting values. | §5: the marker, not mere access to the record, keeps what summaries lose; the owner's section adds to addressed citations | Control or structured summary matches markers: the gain is the way [-back, not the marker.-] {+back.+} Markers without the owner's section match [-full markers-] on instructions: the budget adds nothing. Markers alone [-match markers with the read:-] {+match:+} the read matters less | | 2 | Back-reference replay. Real moments where the owner refers to earlier in the session ("the hash from before"), replayed after compaction under the control and under markers. | §4, §5 in real use | The 95% interval of the margin over the control includes zero: no gain is shown, and markers have not earned their cost | | 3 | Forget-cue rate. Owner messages that repeat an instruction or ask "did you forget", per 100, under the control and under markers, split by a compaction in the previous ten turns and by a new session since the instruction; sized from the measured baseline to detect a one-third drop (80% power). | the outcome the design serves | The interval of the difference includes zero: no reduction is shown, and the promise of §1 stays unproven | | 4 | Marker coverage. For each evicted range, the share of its exact strings and owner instructions present in its marker. | §5.1, §5.2 | Below half: the extraction, not the design, is the weak part | | 5 | Price and quality. Measure calls per turn, the calls a session still has when the window has room, $q_{\text{call}}$, $H$ and $K$; compare elective eviction at $N^*$ with none, on task success. | §7.2 | A $q_{\text{call}}$ above break-even, or sessions shorter than $N^*$, make elective eviction rare; a quality gain from shorter windows argues for earlier eviction | | 6 | Idle sessions. Replay idle sessions under three policies: compact on the next message, [-compact-] just before the cache lapses, [-and-] {+or+} start [-a-] fresh [-session-] with the carried markers. Compare tokens per resumed turn and [-the measures of-] tests 1 and 3. | §5.6, §7.5 | Compaction before expiry costing no less than compaction on the next message, or a fresh session losing needles the compacted session keeps, changes the policy | | 7 | Acting on a moved instruction. A simulated repair session pushes the staging correction of §1.1 into the directory (Table 5), then reaches a [-point where a-] {+due+} test [-renewal is due. Nobody asks the agent to recall the instruction; whether-] {+renewal. Unprompted, does+} it [-renews-] {+renew+} against [-staging is scored, then whether-] {+staging; asked, can+} it [-can-] quote the [-instruction when asked. Run within-] {+instruction? Within+} one session and after a new [-session.-] {+one.+} | §5.5, §5.6: a pointer line or a directory line still protects the owner | Production used more often than with the wording in view: moved instructions need a stronger cue, or fewer of them may leave the window |

### References

- Anthropic (2026a). Compaction at a token threshold. Claude Platform documentation. <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> - Anthropic (2026e). Compaction overview. Claude Platform documentation. <https://platform.claude.com/docs/en/build-with-claude/compaction> - Anthropic (2026f). Claude Code changelog, version 2.1.299 (idle compaction). <https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md> - Anthropic (2026g). How Claude Tag works. Claude documentation. <https://claude.com/docs/claude-tag/concepts/how-it-works> - Anthropic (2026h). Use Claude's chat search and memory to build on previous context. Claude Help Center. <https://support.claude.com/en/articles/11817273-use-claude-s-chat-search-and-memory-to-build-on-previous-context> - Anthropic (2026i). Claude Code, version 2.1.306: the compaction instructions shipped in the program (npm package `@anthropic-ai/claude-code`), read 21 October 2026. <https://www.npmjs.com/package/@anthropic-ai/claude-code> - 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> - Dang, T., Ichikawa, Y., Fatima, S., & Shirahata, K. (2026). Addressable recall compaction for long context-window control in AI agents. arXiv:2607.25066. <https://arxiv.org/abs/2607.25066> - 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> - Letta (2026). Compaction. Letta documentation. <https://docs.letta.com/v1-sdk/messages/compaction> - 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> - Mem0 (2026). Add memory. Mem0 documentation. <https://docs.mem0.ai/core-concepts/memory-operations/add> - {+Morris, J. X., Kuleshov, V., Shmatikov, V., & Rush, A. M. (2023). Text embeddings reveal (almost) as much as text. *EMNLP 2023*. <https://arxiv.org/abs/2310.06816> -+} OpenAI (2026a). Compaction. OpenAI API documentation. <https://developers.openai.com/api/docs/guides/compaction> - OpenAI (2026b). Memories. ChatGPT Learn. <https://learn.chatgpt.com/docs/customization/memories> - 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> - Serra, O. (2026a). MNEMOSYNE: one check on every memory write. J-series paper J14 (the writing paper), version [-2.6,-] {+2.7,+} 21 October 2026. Available from the author. - Serra, O. (2026b). INSTANT RECALL: finding what the agent already owns. J-series paper J2 (the finding paper), version [-8.6, 21 October-] {+8.8, 25 November+} 2026. Available from the author. - Serra, O. (2026c). Sleep consolidation: a repeated correction earns a diagnosed, tested repair. J-series paper J5 (the learning paper), version [-7.7,-] {+7.8,+} 21 October 2026. Available from the author. - thedotmack (2026). claude-mem: persistent memory for Claude Code. GitHub. <https://github.com/thedotmack/claude-mem> - Zep (2026). Adding episodes. Graphiti documentation. <https://help.getzep.com/graphiti/core-concepts/adding-episodes> - 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 C. The Window Controller Adapter Contract

{+**Retries and restarts (§4.6).** A retry must not create a second entry. Each incoming message carries its source's message ID, and the record stores the pair (message ID, address) in the same durable write as the entry. A retry or a duplicate delivery finds the pair and gets the existing address back, also when the append was durable and only its acknowledgement was lost. 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 message recoverable from neither side is reported as lost, never as kept.+}

### Appendix E. Acceptance Checks for a Build

- erased text served before the epoch is applied; - a hit in the [-index,-] {+search index (words or embeddings),+} a marker or the controller's transcript; - a lost neighbouring span, the rest of the file lost with the erased string, or a marker that stops resolving; - a duplicate epoch that hangs or applies twice; - a quarantined line in a call built after the receipt, or visible outside the audit view; - a provider compaction reported as removal; - a pulled item the finding stage still counts as in the window; - a tool's or an API's copy neither removed nor named.

### Appendix F. The Price Rule in Full

_J-series paper J1 | Version [-8.7-] {+8.8+} | [-2026-10-21_-] {+2026-11-25_+}
