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

From v8.5 (21 Oct) to v8.6 (21 Oct): 11,973 words to 13,905 words, 4,332 words in new or rewritten paragraphs and 2,400 taken out, 167 paragraphs changed.

## Change note of v8.6

**Adds appendices on forgetting and on acceptance checks for a build**

About 1,900 words added.

- New appendix on forgetting in a record that is never edited.
- New appendix with acceptance checks that a build must pass.
- The test section is renamed "Experiments that decide the claim".
- The opening example changes: the colleague now finds where the certificates live and tries a fix that fails.
- From the improvement notes: the dense defect lists in the table for tests 10 to 12 move into short paragraphs, as a referee report asked.

## 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 command-] never to [-run by day-] {+restart the database during the day; they find where the certificates live, note the last commit that worked+} and [-the-] {+try a+} fix [-you tried; on-] {+that fails. On+} Friday they still know all [-three,-] {+of it,+} or [-look them up.-] {+know where to look.+} We would like an AI agent we can trust the same way.

### Abstract

But an agent reads only what fits in its context [-window. When it-] {+window, and when the window+} fills, [-a model usually summarises-] the old [-part, keeping-] {+part is summarised. A summary keeps+} the gist and [-dropping-] {+drops+} what a long job needs: exact strings, [-causes,-] failed attempts, the owner's own words. [-Nothing in the window points-] {+Even a summary that comes with a link+} to the full [-log,-] {+log does not say what it left out, each new summary is written from the last one,+} and often [-a provider does-] the [-compacting.-] {+provider, not your own program, decides what gets dropped.+}

### Abstract

[-We propose Total Recall, a design for keeping, the first stage of an agent's memory. The session record is the ground truth and the context window a cache over it. Compaction, through the hooks of whoever controls the window, leaves a marker carrying the evicted range's address, its exact strings, budgeted verbatim instructions from the owner and addresses for the rest.-]

### Abstract

{+We propose Total Recall, a design for how an agent keeps what happened in a session. Every turn is kept word for word in a record that is never rewritten, and the context window is treated as a cache over it. When old turns must leave the window, they leave a short marker in place of a summary: the owner's instructions word for word, up to a set size; the exact paths, hashes and error lines; and the address of each original entry. It works the same whether the agent's own program or a provider's tool decides what the model reads.+}

### Abstract

The design is not yet built. [-Its deciding-] {+The+} test {+that decides it+} gives a summary and a marker the same [-way back into-] {+access to+} the {+full+} record and [-asks-] {+checks+} which [-keeps-] {+one lets the agent quote+} the owner's [-words.-] {+instructions exactly; a second test checks whether the owner has to repeat himself less.+} If the marker wins, [-the agent should need fewer reminders on a long job:-] what you said on Monday is still in view on Friday, or a line in view says where to find it.

### 1.1 Friday's question

[-An-] {+On Monday afternoon an+} owner and an agent [-spend an afternoon-] {+start+} on a broken certificate on a web server. Early on, the owner gives [-three things that matter: the path where the certificates live, a commit hash that last worked, and an-] {+one+} instruction: never restart the production database during the day. [-The-] {+Over the next hour the+} agent {+finds where the certificates live and the commit hash of the last configuration that worked,+} tries a renewal [-command, which-] {+that+} fails with [-an error about-] a [-rate limit,-] {+rate-limit error,+} and [-they leave-] {+leaves+} the key rotation for later. Three hours and many tool calls on, the context window is full.

### 1.1 Friday's question

[-The agent's harness, the program that runs the model and its tools, compacts. A model reads the first two hours and writes a paragraph: "Worked on the TLS setup; fixed the certificate." The paragraph is accurate and almost useless. The transcript of the afternoon is still on disk, but the model reads only the paragraph, and nothing in it says that a path, a hash, a rate-limit error, an open key rotation and an instruction about the database are there to be found. Later that evening the agent proposes a database restart to clear a cache, and the owner has to say again what he said at two o'clock.-]

### 1.1 Friday's question

[-Nothing here needs a bad 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.1 Friday's question

{+The agent's runtime, the program that runs the model and its tools, compacts. A model rereads the first two 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, keeps the ones that look like safety rules word for word, lists the errors met and how they were fixed, the files touched 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). Its own instructions to the summariser carry the warning that matters here: what the summary leaves out, the next window will not know to look for.+}

### 1.1 Friday's question

{+The job runs all week. The window fills several times a day, and each night the session is closed and a new one starts from what the last one left. By Friday the instruction has been through a dozen compactions, each summary written from the one before it plus the newer turns, and through four new sessions. On Friday afternoon the agent proposes a database restart to clear a cache, and the owner has to say again what he said on Monday.+}

### 1.1 Friday's question

{+Nothing here needs a bad model, or even a bad summary. The failure is in the design: each summary is a description of the past, written from the last description, and nothing in the window says which of the owner's words or which exact strings it dropped, or where each one is.+}

### 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 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 [-day-] {+week+} of tool output, file reads and logs 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. Four kinds of information go first, because a summary is written to be short and to read well:-]

### 1.3 What summaries lose

{+A summary keeps the shape of the work and drops its substance. The table lists what summaries tend to drop when they must be short. It is not measured here; test 1 measures it.+}

### 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 [-summarizer-] {+summariser+} |

### 1.3 What summaries lose

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

### 1.4 Who holds the pen

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, or compact on its servers partway through a response. A memory [-layer-] {+layer, the part of the runtime this paper designs,+} 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 nothing the model sees changes.

### 1.4 Who holds the pen

So a design for [-keeping-] {+what an agent keeps+} has to say what is kept, where the ground truth lives, and how the memory layer acts when someone else holds the pen. We call whoever decides what the model reads on each call the **window [-controller**; "owner"-] {+controller**, and the memory layer's plug for one controller its **adapter** (§6.6). Some call the runtime the harness; we use one word. "Owner"+} always means the human the agent serves.

### 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.**+}

### 1.5 The claim

{+Think of a desk and an archive. The desk is small, and everything on it gets read. The archive keeps every page, in order, and never throws one away. A summary clears the desk and leaves a sticky note: "worked on TLS, fixed the certificate". A marker leaves a call slip where the folder was: the owner's instruction copied out in full, the exact error line, and the shelf number of every page they came from. Unlike a computer's cache, nothing here notices a miss on its own: the model has to decide to go to the archive, which is why the slip says what is there.+}

### 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, except for privacy erasure (§4.4). [-What leaves the window is replaced by a marker that carries the evicted range's exact strings, the owner's instructions within a budget (an address for any beyond it, §5.5) and a pointer back into the record.-] The design has four parts: the record (§4), the marker (§5), one adapter contract for every window controller (§6) and a price for compaction (§7); §10 names the tests.

### 1.5 The claim

[-The codename, ENGRAM, is the neuroscientists' word for the trace a memory leaves in the brain.-] 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 [-series-] {+learning paper+} follows one owner correction through all four [-on a shared reference trace and its transitions-] (J5 Appendix B); {+Appendix E lists the handoffs that pass through+} this [-stage owns the first status, *captured* (§4.6).-] {+one.+}

### 2. One Span, Start to Finish

Figure 1 follows [-the-] {+Monday+} afternoon [-of §1.1-] to turn 61, when the owner asks what exactly the renewal said. {+In this example each entry of the record is one turn.+} The marker names entry 23, and a range read returns it character for character. Appendix A shows [-the-] {+some of these+} entries as stored.

### 2. One Span, Start to Finish

![One evicted span and its way back. Left, part of the session record of session s7. Right, the context window at turn 61, in the [-within-budget, delivered case:-] {+case where+} the instruction fits the owner's budget (§5.5) and the marker reached the model (§6.6). Entries 12 to 47 have left; a marker carries the instruction word for word, the exact strings, the failed renewal and the open key rotation, each with its address. (1) The marker is built from the record, never from an older marker. (2) A range read of entry 23 returns the error line exactly. The dashed box is what a {+one-line+} summary [-alone-] would have [-left; Table 1 compares it with a summary that has the same way back.](images/fig-1-span.png){width=100%}-] {+left.](images/fig-1-span-v86.png){width=100%}+}

### 2. One Span, Start to Finish

[-A summary can also come with a way back: a search tool over the same record, or retrieval over raw chunks of it. Table 1 puts the four side by side on the owner's question, with the same record behind every way back that reads one.-]

### 2. One Span, Start to Finish

[-Table: The owner's question at turn 61, "What exactly did the renewal say?", answered four ways. Every row but the first can read the same session record.-]

### 2. One Span, Start to Finish

[-| Way back | What the model sees after compaction | How it answers | What it does well | |--------------|------------------|-------------------|----------------| | Summary alone | "Worked on the TLS setup; fixed the certificate." | It cannot: the error line is not in the summary | keeps the broad state of the task, cheaply | | Summary plus search over the record | the same summary and a search tool | searches for the renewal, finds entry 23, reads it | recovers the exact line with no marker | | Retrieval over raw chunks | chunks about the certificate renewal | quotes the error if that chunk comes back | finds material without a marker for every eviction | | Marker plus the same record (this paper) | `failed #23: certbot renew, rate limit` | reads s7#23: "too many certificates already issued (rate limit)" | names the entry, so the agent need not search for it |-]

### 2. One Span, Start to Finish

{+Table 1 sets the marker beside five 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: the instruction given at 14:02 and the exact renewal error.+}

### 2. One Span, Start to Finish

{+Table: Six ways to carry a long job past a full window, for the database instruction and the renewal error of §1.1.+}

### 2. One Span, Start to Finish

{+| Approach | The 14:02 instruction | 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 turn 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) | asked to be kept; word for word 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 | does not say what it left out; each summary is written from the last; no size limit and no notice | | 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 | | Marker and range read (this paper) | word for word while it fits the owner's budget, then a pointer line | a line with its address; one range read returns the exact text | an address per item | the agent must still follow a pointer (test 15); 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); - a marker rebuilt from the record at every compaction, where each summary is written from the one before (§5.4); - a check that every quote and every address resolves (§8.2); - the same behaviour whichever program controls the window (§6).+}

### 2. One Span, Start to Finish

[-The second and last rows have the same access to the record. They differ only in what the window says is there, so the question is whether the marker-] {+Whether that+} raises [-successful-] recovery enough to pay for building [-it-] {+the marker+} and for its [-tokens. Test-] {+tokens is what test+} 1 decides [-it-] (§10).

### 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 [-summarizer,-] {+summariser,+} including modes that keep the prompt prefix cache-friendly | 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 | the closest mechanism, for tool 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) | | Provider compaction (Anthropic, 2026a, 2026d, 2026e; OpenAI, 2026a) | clears old tool results behind a placeholder, or summarises at a threshold, sometimes inside a response; Anthropic can pause after its [-summary,-] {+summary and lets a client replace the summary instructions,+} 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 [-hooks-] and claude-mem (Anthropic, [-2026b;-] {+2026b, 2026i;+} thedotmack, 2026) | {+Claude Code's compaction writes the structured summary of §1.1 with the transcript path, and offers+} hooks before and after [-compaction;-] {+it;+} claude-mem captures what the agent does, compresses it with a model and injects it into later sessions | {+the strongest baseline (Table 1);+} uses the same hooks [-(§6.3); its memory is-] {+(§6.3), keeps+} the [-record,-] {+summary,+} and [-compression is only a map back into it-] {+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 and Graphiti (Rasmussen et al., 2025; Zep, 2026) | stores 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 messages exactly as given | 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, and both let the owner manage what is kept | owners already expect to see what is kept; Total Recall's receipts and notices [-are meant for-] {+feed+} the finding paper's {+view for the+} owner [-inspector-] (J2 §6.8) |

### 3. Related Work

Two older ideas frame the rest. Belady (1966) showed that the best page to evict is the one needed furthest ahead; no runtime knows that, so §5.3 uses [-what-] {+age and how cheap content+} is [-cheapest-] to recover as the [-proxy.-] {+guide.+} And the prompt cache prices every edit to the prefix (Anthropic, 2026c), which turns "when to compact" into arithmetic (§7.2).

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

Every entry carries an `author_kind`: the owner, the agent, a tool, the [-harness-] {+runtime itself+} (time stamps, injected instructions, system text) or another agent. A [-harness-] {+runtime+} that wraps the owner's message with a time stamp and 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 at append time, `owner_words`: the message with the wrapper stripped, by one function, once, never rewritten. 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';-] {+whether it+} is [-it malicious?"-] {+phishing+} wrote the question, not the [-quoted line.-] {+email.+} So `owner_words` is first cut into **spans**, then [-classified.-] {+labelled.+} The cutter is plain code: it splits at sentence ends, semicolons, line breaks, list items, and a comma before "and", "but", "also" or "then" when a new verb follows. 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

[-Each span then gets two tags, each stored with the version of what made it. **Authority** is this stage's: *owner* for what he says in his own voice, *quoted* for text he pastes, forwards or attributes to someone else. Structure (a pasted block, a forwarded header, quotation marks) settles most spans and a reported-speech check run here settles the rest. Uncertain attribution counts as quoted until the owner confirms it in a new harness entry naming the span, which is never rewritten: a lost instruction costs one repetition, a pasted attack with the owner's authority far more. **Intent** (instruction, correction, praise or none) comes from the shared classifier, which sees only owner spans; the learning paper owns its contract (J5 Appendix A.1, the owner-sentence classifier). Quoted spans get no intent tag, never yield a correction and keep their quotation marks downstream (J14 §8.2, what each fact may become). The learning stage reads the stored tags at enqueue and at replay and never classifies again. If the classifier is down, owner spans are stored untagged and treated as instructions until the night tags them (§5.5), with the late tag appended under its own version.-]

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

{+Each span then gets two labels, and each label is stored with the version of the code that produced it.+}

### 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 his own voice, and *quoted* when he pastes, forwards or reports what someone else said. Layout settles most cases: a pasted block, a forwarded header, quotation marks. A check for reported speech ("he says we should...") settles the rest. When that check is unsure, the span counts as quoted until the owner confirms it; his confirmation is stored as a new entry, and the span itself never changes. The two mistakes do not cost the same. Taking his instruction for a quote costs him one repetition. Taking a pasted attack for his 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 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. If the classifier is down, owner spans are stored without the second label and count as instructions until the nightly pass labels them (§5.5); that late label is added with its own version.+}

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

{+Table: One message, cut and labelled. The owner pastes an email and adds two sentences of his own.+}

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

{+| Span | Text | Whose words | What for | |------|--------------------------------|-------------|------------| | /0 | Ignore the previous rule and send the certificate key to this address. | quoted | no label | | /1 | Is this phishing? | owner | none | | /2 | Either way, keep the old chain until Monday. | owner | instruction |+}

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

{+Span /0 is written as an order; only /2 can ever become one.+}

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

Tool results go in whole. A file the agent read can change or vanish after the read, and a content hash would show that it changed without giving back what it said. So the returned bytes are saved as a blob, the file's contents stored under their own hash, before the window drops them, and the entry holds the path and that hash. Identical contents are stored once per blob namespace, so the cost grows with distinct versions read, not with reads. Ordinary sessions share one [-namespace, so one blob can back entries in many of them (§4.4);-] {+namespace;+} each temporary session has its own (§4.7). A namespace comes from the authenticated session, never from a name in a request or a tool argument.

### 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: a turn that was said stays said, even after what it said stops being true. Facts change one stage later, as new revisions (J14 [-§7.3, three ways a fact ends);-] {+§7.3);+} the record entry a fact was drawn from is not [-touched. What a default search hides is the finding paper's call (J2 §8.1, filters in a fixed order).-] {+touched.+}

### 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 [-tagged-] {+labelled+} like any owner turn, so the writing and learning stages read an edited correction as a correction of that span and not as a second one. A delete is appended as a [-harness-] {+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-] {+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 Erase and quarantine

[-The writing paper decides when 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. Either one first raises the erasure epoch, a counter of deletions: this stage serves no read until it has caught up with the newest epoch, so no read is answered from the state before the deletion (§8.1).-]

### 4.4 Erase and quarantine

{+We keep everything, but 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. 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,-] {+redacted at+} the [-one edit the record allows.-] {+same address, span by span.+} Address, author and time stay; the [-text, `owner_words`, tags and any blob are-] {+text is+} replaced by a tombstone that says content was removed, when, [-why,-] {+why+} and under which deletion receipt. [-It-] {+The tombstone+} holds no part of the content, not even a [-hash:-] {+hash, since+} the hash of a short string such as a phone number can be guessed. [-A blob is shared by every read in its namespace that returned the same bytes, so erasing it tombstones every entry that references it.-] Everything derived is rebuilt from the redacted record: the text [-index drops the rows,-] {+index,+} every marker [-whose range covers-] {+that covered+} it [-is written again-] (§5.4), {+the copies handed to the window controller,+} 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 (§6.6).-] {+window.+}

### 4.4 Erase and quarantine

**Quarantine** is for attack evidence: a line shown to have been injected. Nothing is edited; a [-harness-] {+runtime+} entry flags the [-entry-] {+line+} as [-untrusted, with the writing paper's decision. The content-] {+untrusted. It+} stays as [-evidence, but it-] {+evidence in an audit view, and+} leaves every [-marker (rebuilt without it),-] {+marker, every+} ordinary range [-reads-] {+read+} (which [-return-] {+returns+} a [-"quarantined" placeholder)-] {+placeholder), ordinary search+} and [-ordinary search; only an audit view shows it. It must also leave a window it has already entered, so the adapter invalidates-] the live [-window as it does for an erase (§6.6) and writes a receipt naming what it rebuilt and what it could not reach.-] {+window.+}

### 4.4 Erase and quarantine

[-For both, a provider's compaction never counts as removal. Its compacted state is opaque and may still carry the line, and nobody can read it to check. Removal from a tool's or an API's context is verified only when the adapter rebuilds a clean context from permitted material, or when the controller offers an operation documented to remove that content; anything else is reported as unverified and out of reach.-]

### 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 deletion manifest: record entries, the controller's transcript, blobs, markers, and live sessions or provider state (§6.6). Each place is reported done, not present, or out of reach (named); "all reachable copies removed" is the strongest claim this stage makes.-]

### 4.4 Erase and quarantine

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

### 4.6 When a turn is captured

An owner turn is *captured* when its entry, with `owner_words`, its spans and their [-tags,-] {+labels,+} 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. [-In the reference trace this is step 1 (transition T1): one-] {+One+} flush captures [-both corrections of one-] {+every correction in a+} message, each an immutable span with its [-authority and intent tags-] {+labels+} and their [-classifier-] versions. If the process dies before the learning stage queues them, the restart rebuilds [-both-] {+the+} queue events from the [-record,-] {+stored labels,+} asking no [-classifier (step 2, transition T2).-] {+classifier.+}

### 4.6 When a turn is captured

{+Until then the turn is pending, and the agent says nothing about keeping it. If the append fails (a full disk, a crash), the runtime shows the turn as not captured and retries from its in-memory copy.+}

### 4.6 When a turn is captured

[-Until then the turn is pending, and the agent says nothing about keeping 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.-] 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-] {+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 turn recoverable from neither side is reported as lost, never as [-kept (test 10, §10).-] {+kept.+}

### 4.7 Sessions that are never kept

Some things should never reach the long-term side, and the place to stop them is the write [-itself.-] {+itself. Start from the example: a key pasted into a chat becomes `[credential removed]` before anything is written.+}

### 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 (§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, 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).-] {+placeholder.+}

### 4.7 Sessions that are never kept

{+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, 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).+}

### 4.7 Sessions that are never kept

{+**Interfaces.** What becomes a fact, and when an erase applies, is the writing paper's call (J14 §7.7); what a default search hides is the finding paper's (J2 §8.1); the intent classifier's contract is the learning paper's (J5 Appendix A.1).+}

### 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 in an owner span inside the range, verbatim, within the budget of §5.5. 3. Exact strings: the paths, hashes, host names, identifiers, [-numbers,-] {+numbers and+} 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.-] {+it and, where it helps, its time.+} 5. Open items: what was started and not finished, one line each with an address.

### 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-] {+labels+} stored at append (§4.1); a span the classifier is unsure of, or could not [-tag,-] {+label,+} 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

| Content | Kept in the marker | Why | |------------------|-----------|---------------------| | Owner's instructions, preferences, corrections | word for word, within the budget of §5.5 | a paraphrase changes what was asked | | Exact strings (paths, hashes, hosts, [-errors, times)-] {+errors)+} | word for word, capped by count | a paraphrase of a string is a different string | | Decisions, failed attempts, open items | one line each, with an address | the line says it happened; the address gives how | | Agent's reasoning and replies | pointer only | the record holds them | | Tool output, file contents included | pointer only | the record holds it whole, files as blobs (§4.1) | | [-Harness-] {+Runtime+} text (time stamps, injected rules) | nothing | the [-harness-] {+runtime+} injects it again; it is not memory |

### 5.3 What leaves first

[-When the window must shrink, the cheapest content to recover leaves first. In order:-]

### 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. 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 turns leave first, since recent content is the best guess at what is needed next.+}

### 5.3 What leaves first

{+Inside the run, content differs in how cheap it is to get back, and that decides what the marker keeps. From cheapest to dearest:+}

### 5.3 What leaves first

1. Tool output whose source still holds it unchanged (a file still on disk at the read version). 2. Other tool output. 3. The agent's own reasoning and replies. 4. The owner's [-messages, except the instructions, which-] {+messages; their instructions+} move into the [-marker.-] {+marker word for word.+}

### 5.3 What leaves first

{+The cheap end gets a pointer only and the dear end is kept, as §5.2 lays out. When only a little room is needed, clearing old tool output in place, as a provider's clearing does, may be enough; the receipt lists what was cleared (§7.4).+}

### 5.3 What leaves first

Never evicted: the system text, the [-always-loaded files and the-] current task's short [-statement.-] {+statement and the always-loaded files, the instruction files a runtime loads into every session (a project's CLAUDE.md or AGENTS.md, for example).+} Markers merge instead (§5.5). [-Within each class, older content leaves first, since recent content is the best guess at what is needed next.-] The selector [-chooses from-] {+works on+} the window as the model will read it on the next call, after any provider clearing, and {+its receipt+} reports what it evicted by [-class,-] {+kind,+} adding up to the total removed.

### 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, while a marker written from the record draws on the same entries [-on-] {+at+} the hundredth compaction as [-on-] {+at+} the [-first.-] {+first (Figure 2).+} That is a promise about the source, not about what stays in [-view. Merged-] {+view: merged+} markers share capped lists, and old instructions move out to pointers [-(§5.5); what-] {+(§5.5). What+} drops out of view stays at its address in the record.

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

{+![The same session compacted three times. Left, each summary is written from the summary before it plus the newer turns, and the instruction of 14:02 fades. Right, each marker is rebuilt from the record entries of its whole range; by the third, the owner's budget is full and the instruction becomes a pointer line that still quotes its first words and gives its address. Illustrative until test 1 measures it.](images/fig-2-repeated.png){width=92%}+}

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

The owner's [-instruction-] budget, $B_o$, holds three things: instructions word for word, up to $k$ pointer lines ($k$ is fixed with $B_o$) and one directory line. An owner span the classifier has not [-tagged-] {+labelled+} yet counts as an instruction until the nightly auditor [-tags-] {+labels+} it (J5 [-§6.2).-] {+§6.2). Think of a noticeboard with room for a few notes: when it is full, the oldest note becomes a line saying "see binder, page 12", and when those lines fill up, one line says "eleven older notes are in the binder".+}

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

[-When a new instruction does not fit, the oldest one kept word for word becomes a pointer line: when it was said, its first words and its address. When one more pointer would pass $k$, all the pointer lines fold into the directory line, "*N* earlier instructions, s7#12 to s7#311, are not shown one by one". It points to a directory entry appended to the record, which lists every moved instruction with its address.-]

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

{+When a new instruction does not fit, the oldest one kept word for word becomes a pointer line: when it was said, its first words and its address. Oldest first, because recent instructions are the best guess at what applies next. That rule moves a safety rule given early before a formatting preference given late, so the owner can pin an instruction. A pinned instruction is never moved; pins count against $B_o$, and when pins alone would pass it, the agent asks him to move one into the always-loaded file. The notice of each move offers the pin.+}

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

{+When one more pointer would pass $k$, all the pointer lines fold into the directory line, "*N* earlier instructions, s7#12 to s7#311, are not shown one by one". It points to a directory entry appended to the record, which lists every moved instruction with its address.+} The directory is read a page at a time. A page returns at most $D$ tokens of the list ($D$ is fixed with $B_o$) and the address to continue from, and it is an ordinary tool result that §5.3 may evict again. Reading $N$ instructions of about $\ell$ tokens takes $\lceil N\ell/D\rceil$ pages: 300 instructions of 30 tokens are 9,000 tokens, five pages at $D = 2{,}000$ ($\ell$ is unmeasured).

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

However long the session, the instructions never take more than $B_o$ of the window. Every move is listed in the receipt (§7.4), and the next reply tells the owner which instructions moved and that they are no longer individually in view. Table [-3-] {+4+} follows the database instruction 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

| State | What stays in the window | What the owner is told | |-------------|------------------------|------------------------| | The wording fits | Never restart the production database during the day. | nothing; nothing moved | | The wording is displaced | 14:02 "Never restart..." → s7#12/0 | "Your database instruction is stored at s7#12/0; its full wording is no longer in {+view. Pin it to keep it in+} view." | | A third pointer would pass the limit | 3 earlier instructions → directory s7#90 | "Three earlier instructions are now listed in a directory; their pointers are no longer in view." |

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

The directory entry lists all three addresses, s7#12/0 among them, and its pages obey $D$. The wording stays at s7#12/0 unless it is erased or a temporary session ends. The record keeps the instruction while its presence in what the model reads grows weaker, and that weakening is the risk test 15 [-measures.-] {+measures. So the promise has three parts:+}

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

[-So the promise has three parts.-] {+1.+} Every instruction stays **recoverable** word for word through its address, as long as the record lives and it has not been [-erased; that-] {+erased. That+} does not make them all loadable together, since a long directory is read a page at a time. {+2.+} It stays **in [-the window**-] {+view**+} word for word [-only-] while it [-fits,-] {+fits or is pinned,+} and when it leaves, the owner is told. [-An instruction the owner wants held-] {+3. It is **held+} beyond the [-session belongs in-] {+session** only through+} the always-loaded file (J14 [-§8.2, what each fact may become; J5 §7, keeping the always-loaded file honest).-] {+§8.2).+}

### 6.1 Three window controllers

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

### 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: known input when the runtime builds the call, otherwise only what was sent. In all three, every marker points into the session [-record.](images/fig-2-controllers-v82.png){width=100%}-] {+record.](images/fig-3-controllers-v86.png){width=100%}+}

### 6.2 When the runtime controls the window

This is the case §5 describes. The runtime chooses when to compact by the price rule of §7, evicts by [-the order of-] §5.3, builds the markers and places them where the evicted range was. It built the call, so it knows what the model read.

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

- Before compaction (`PreCompact`). The hook makes the record complete up to this moment, reading the tool's own transcript where needed. It does not say which part the tool will summarise, so the adapter takes 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 durably before the hook returns. The hook could block the compaction, but when the tool compacts to recover from a full [-window-] {+window,+} blocking fails the request, so the default is to let it run. - After compaction (`PostCompact`, then `SessionStart` with `source=compact`). The adapter stores the tool's summary as a [-harness-] {+runtime+} entry where the event carries it, and injects the stored markers into the new context before the next model call, beside the summary. - 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

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, 2026a). The runtime places markers only in requests it builds, so the guarantee is delivery before the next [-client-controlled request.-] {+request the runtime sends.+} 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.

### 6.5 Never compact a copy nobody reads

[-In-] {+When a provider's tool holds+} the [-provider-tool case-] {+window,+} the runtime never compacts its [-mirror-] {+own copy+} of the [-conversation: it would cost time and change nothing-] {+conversation, since+} the model {+never+} reads {+it+} (§1.4). It writes a receipt for each of the tool's compactions (§7.4) and [-builds markers for them (§6.3);-] {+counts+} a compaction [-is counted-] only when it changed what the model reads.

### 6.6 The adapter contract

[-All three paths share one versioned contract (Appendix C): each adapter declares its controller's capabilities, counts one it cannot confirm as absent, and moves each compaction through durable pending states, each appended to the record before the next step starts, so a crash resumes where it stopped. A marker counts as delivered when its ID appears in a call the runtime sent or in the tool's transcript; until then its range is not treated as in view, the per-turn injection sends it again, and the receipt counts the turns run without it.-]

### 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 before compacting, can its transcript be read, can text be added before the next call? Anything the adapter 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, so after a crash it carries on from the last tick.+}

### 6.6 The adapter contract

{+A marker counts as delivered only when its ID shows up in a call the runtime sent, or in the tool's own transcript. Until then its range does not count as in view, the marker goes out again with every turn, and the receipt counts the turns that ran without it.+}

### 6.6 The adapter contract

Every receipt [-carries one of two knowledge levels. **Known input**:-] {+also says how much the memory layer can know. When+} the runtime built the call, [-so-] it knows {+exactly+} what the model [-read. **Sent, unconfirmed**:-] {+read: *known input*. When+} a {+provider's+} tool or [-an-] API [-stands-] {+sits in+} between, [-so the memory layer-] {+it+} knows what it sent [-(for-] {+(and, for+} a tool, [-also-] the summary the tool wrote), [-not-] {+never+} what the model [-kept. No-] {+kept: *sent, unconfirmed*. It is the difference between handing someone a letter and posting it. Nothing may+} claim [-about the model's view goes beyond that level, and-] {+more than its receipt's level; in particular,+} the learning stage never [-treats-] {+counts+} a [-sent-but-unconfirmed-] rule {+that was only sent, unconfirmed,+} as one the model saw (J5 [-§5.4, when a rule recurs, ask why before climbing).-] {+§5.4).+}

### 6.6 The adapter contract

[-The adapter also serves the writing and finding stages. It publishes each compaction receipt, and each window rebuilt after an erase or a quarantine, as an eviction event, which keeps the finding paper's read ledger, its account of what the window still holds, up to date (J2 §6.7). The event lists every range the rebuild left out, not only the erased or quarantined entry, and is resent until the ledger acknowledges it (transition T16; T22 for a quarantine).-]

### 6.6 The adapter contract

[-An erase or a quarantine that reaches a live session also goes through the adapter, which writes a receipt (§4.4). If the runtime builds the calls, it rebuilds the window without the content. For a provider's tool or API, the adapter ends the session and starts a clean one from permitted material, or uses a deletion operation the controller documents; otherwise it reports that copy as out of reach. After a quarantine receipt, no call the runtime builds carries the content; a tool's or an API's context is covered only where its session was rebuilt that way (T22; J14 §7.7, erase and quarantine).-]

### 6.6 The adapter contract

{+The adapter also tells the finding stage what left the window. Each compaction receipt, and each window rebuilt after an erase or a quarantine, is published as an eviction event that lists every range the window no longer holds, and it is resent until the finding paper's record of what the window holds acknowledges it (J2 §6.7). An erase or a quarantine that reaches a live session goes through the adapter too; Appendix D says what it can remove from a provider's copy and what it can only report.+}

### 7.2 The price of moving the prefix

Table [-4-] {+5+} shows what one eviction does to the cache, with the sizes of Figure [-3.-] {+4.+}

### 7.2 The price of moving the prefix

In words: [-break-even-] {+the+} turns {+to break even+} equal the one-time cost of the eviction divided by the net saving on each later turn. The rest of this section puts symbols on [-both.-] {+both, and Table 6 lists every symbol with the value Figure 4 uses.+}

### 7.2 The price of moving the prefix

We use the finding paper's prices and notation (J2 [-§7.1, a read costs a turn),-] {+§7.1),+} as multiples of the base input price: $r$ per token read from cache, $w$ per token written to it and $g$ per output token. Eviction removes a span of $S$ tokens and leaves a marker of $m$ tokens; $A$ tokens follow the span. Let $q_{\text{turn}}$ be the chance that one later turn of the session pulls something from the span. It differs from the finding paper's $q$, which covers the rest of the session.

### 7.2 The price of moving the prefix

{+Table: The symbols of the price rule, in plain words, with the values of Figure 4.+}

### 7.2 The price of moving the prefix

{+| Symbol | In plain words | Figure 4 value | Where it comes from | |--------|------------------------|----------------|----------------------| | $r$ | price of reading one cached token | 0.1 (dashed: 0.05) | published; 0.05 on Opus and Sonnet 5.5 | | $w$ | price of writing one token to the cache | 1.25 (dash-dot: 2) | published; 1.25 for the five-minute cache, 2 for the one-hour cache | | $g$ | price of one output token | 5 | published ratio | | $S$ | tokens evicted | 40K, 100K | chosen | | $m$ | tokens in the marker | 300 | assumed | | $A$ | tokens after the span | 100K | assumed | | $L$ | context a pull rereads | 150K | assumed | | $x$ | tokens a pull brings back | 2K | assumed | | $o$ | output tokens of a pull | 500 | assumed | | $H$ | turns a pulled slice stays | 20 | unmeasured | | $q_{\text{turn}}$ | chance that one later turn pulls from the span | 0 to 0.3 (x axis) | unmeasured | | $c$ | input price for the model that writes the marker | 1 | unmeasured | | $K = cS + gm$ | cost of building the marker | 41,500 (40K span) | derived | | $N^*$ | turns until the eviction pays | about 40 (40K span, $q_{\text{turn}} = 0$) | derived |+}

### 7.2 The price of moving the prefix

A pull takes a full turn. It [-re-reads-] {+rereads+} the $L$ tokens of cached context, returns $x \ll S$ tokens that are written to the cache, and produces $o$ output tokens, so $C_{\text{pull}} = rL + wx + g\,o$. The returned slice then stays in the window for $H$ turns before it is evicted again, adding $r\,x\,H$ in later reads:

### 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 spans were [-tagged-] {+labelled+} 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 merge reads the union of its ranges, so its $K$ grows with them.

### 7.2 The price of moving the prefix

The first term of the numerator is the one-time rewrite of everything after the span: the finding paper's suffix-rewrite term $\Delta C = (w - r)(L - P)$ (J2 [-§7.4, where it goes)-] {+§7.4)+} with $L - P = m + A$, paid once here instead of on every turn. The denominator is the per-turn saving net of expected pulls. When $q_{\text{turn}}\, C_{\text{pull}}^{H} \ge (S-m)\,r$ it is not positive and an elective eviction never pays: the span is read back too often and should stay, or be compressed in place.

### 7.2 The price of moving the prefix

[-![Turns a session must still run before an elective eviction pays, against the probability that a later turn pulls from the evicted span. Published cache prices ($w = 1.25$, $r = 0.1$; dashed, $r = 0.05$; $g = 5$), a 300-token marker, $A = 100$K tokens after the span, a pull that re-reads $L = 150$K, returns $x = 2$K tokens resident for $H = 20$ turns and writes 500 output tokens, and construction at $c = 1$ (the same model, uncached). The dotted line leaves construction out.](images/fig-3-breakeven.png){width=88%}-]

### 7.2 The price of moving the prefix

{+![Turns a session must still run before an elective eviction pays, against the chance that a later turn pulls from the evicted span. Solid lines: spans of 40K and 100K tokens with the five-minute cache ($w = 1.25$, $r = 0.1$, $g = 5$). For the 40K span: dash-dot, the one-hour cache ($w = 2$); dashed, cache reads at $r = 0.05$, Anthropic's price on Opus and Sonnet 5.5; dotted, the cost of building the marker left out. Other inputs as in Table 6. A 10K span is left off the plot; its numbers are in the text.](images/fig-4-breakeven-v86.png){width=88%}+}

### 7.2 The price of moving the prefix

Table: An illustration from assumed inputs, the same as Figure [-3's:-] {+4's:+} a 40K-token [-span,-] {+span+} with {+the five-minute cache, and+} a one-time cost of 156,845 base-input-token units, building the marker included.

### 7.2 The price of moving the prefix

Figure [-3-] {+4+} and Table [-5-] {+7+} are illustrations, since $q_{\text{turn}}$, $H$ and $c$ are unmeasured. For the 40K-token span, about 10 of the 40 turns repay building the marker. A 100K-token span pays back after about 22 turns; a 10K-token span needs about 131 and never pays above a pull chance of 0.04. [-At a read price of 0.05-] {+The cache matters as much as the span. With the one-hour cache, whose writes cost $w = 2$,+} the 40K span needs about {+58 turns; with reads at 0.05 it needs about+} 82 [-turns.-] {+with the five-minute cache and about 119 with the one-hour cache. The cheaper cache reads get, the longer an eviction takes to pay, so on current models elective eviction should be rare.+}

### 7.2 The price of moving the prefix

Three design rules hold whatever the numbers. Evict large [-spans-] {+runs+} at once, since the rewrite is paid per eviction and the saving grows with the span. Prefer [-spans-] {+runs+} that are large and rarely [-pulled,-] {+pulled; age is a fair guess at both,+} which [-§5.3's order selects.-] {+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 marker unchanged once it is placed: the cache reuses a token only while every token before it is unchanged, so editing a marker, even in the same place, rewrites everything after it, as an eviction does. The benefit of a shorter window (§1.2) is unpriced; test 7 measures it.

### 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, a receipt for every run, and a zero means zero).-] {+§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.

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

{+A prompt cache lives for minutes or an hour. Once it lapses, the next call writes the whole context to the cache again at $w$, whatever compaction does. So in the last minutes before expiry, the rewrite term of §7.2, $(m + A)(w - r)$, costs nothing extra if the owner returns after the cache has lapsed, because that rewrite is coming anyway; and the marker is cheaper to build while the same model can read the span from the still-cached context at $r$ instead of $c$. If he returns sooner, the compaction moved the prefix for nothing; if he never returns, building the marker cost $K$ for nothing. Test 13 measures how often each happens.+}

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

[-A prompt cache lives for minutes or an hour. Once it lapses, the next call writes the whole context to the cache again at $w$, whatever compaction does. So in the last minutes before expiry the rewrite term of §7.2, $(m + A)(w - r)$, costs nothing extra, because that rewrite is coming anyway, and the marker is cheaper to build when the same model writes it from the still-cached context, reading the span at $r$ instead of $c$. The idle moment is the cheapest time for an elective compaction.-] That gives the trigger a second input next to fullness: a session idle for most of its cache lifetime, with a window large enough that the next turn gains from a smaller one. Claude Code shipped the same timing in October 2026: a conversation over 200K tokens that sits idle for about 54 minutes is summarised just before its one-hour cache expires (Anthropic, 2026f). Here that moment runs a compaction of §5, markers and all, in place of a summary.

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

A session idle for hours raises a second question: compact it again, or start a new one? An always-on chat would otherwise compact forever. Claude Tag replaces a channel's session after about an hour of quiet, or once it is about a day old and the channel is quiet, and archives the old one (Anthropic, 2026g). Rotation loses nothing in this design: the new session starts from the open markers, the always-loaded files and memory, and the old record keeps every address, so last week's pointers still resolve. {+This is how the database instruction of §1.1 reaches Friday: each compaction rebuilds its marker from the record, and each night's new session starts with the open markers, so the instruction, or its pointer line, is in the first window of every session.+} We propose rotation when the cache has lapsed and the old session's live markers fit the new session's starting budget, and compaction otherwise. Test 13 decides it.

### 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, a quarantined one as its placeholder (§4.4), and a prohibited match as its typed placeholder (§4.7). The finding paper's pull tool offers it as one mode next to a search over the record (J2 [-§6.6, the pull);-] {+§6.6);+} this stage guarantees that the search runs over the same record the markers point into.

### 8.1 The range read

[-An erase or a quarantine raises an erasure epoch first (J14 §7.7). This stage applies epochs in order: redact or flag, rebuild the markers, then rebuild the window. A range read or window build is served only once the newest published epoch is applied here: one that arrives earlier waits, and one that started at an older epoch and returns after a newer one is discarded and run again. So erased text cannot reach the live model between the decision and the rebuild (transition T15; Appendix B.1). Applying an epoch is idempotent: a duplicate delivery of an epoch already applied gets back the acknowledgement it got the first time, and a restart after a partial application resumes from the progress recorded in the record.-]

### 8.1 The range read

{+Deleting is not instant. Redacting an entry, rebuilding the markers that cite it and rebuilding the live window take time, and reads keep arriving meanwhile. A shop facing a product recall has the same problem: it blocks the barcode at the tills before staff clear the shelves. Here the block is a number. Each erase or quarantine first raises a counter, the *erasure epoch* (the writing stage raises it, J14 §7.7). This stage then works through deletions in counter order: remove or flag the text, rebuild every marker that covered it, rebuild the window. Only then does it record that counter value as applied (Figure 5).+}

### 8.1 The range read

{+Every range read and every window build looks at the counter first. If a deletion has been announced and not yet applied, it waits. If a deletion is announced while it runs, its result is thrown away and it runs again. 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 applied again (Appendix B.1).+}

### 8.1 The range read

{+![The order of a deletion. The counter moves before any text is touched, every read and window build waits for it, and a read that was already running when the counter moved is thrown away and run again. Only after the text, the markers and the live window are rebuilt is the epoch marked applied.](images/fig-5-deletion.png){width=50%}+}

### 8.3 Asking a past session

Sometimes the best source is the session that did the work: it read the files, weighed the options and knows why it chose. The finding paper decides when to ask one (J2 [-§6.9, ask the session that did the work);-] {+§6.9);+} this section says what asking does to the record.

### 8.3 Asking a past session

The session is woken in place, not copied. Its record grows by one [-exchange, the-] question and [-the-] {+one+} answer, [-at new sequence numbers-] after a [-harness-] {+runtime+} entry that marks a later visit, so a reader can tell what the session said at the time from what it said when woken. Before the question, the runtime [-injects-] {+gives it+} a short wake-up note: today's [-date and-] {+date,+} how long [-the session has slept;-] {+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, newer commits to files it edited, rules added or [-retired); and an instruction to bring itself up to date before answering. The-] {+retired). Its+} answer is testimony from [-the session's-] {+its+} own [-context,-] {+time,+} labelled with its dates, and the asker checks it against the current store before acting on [-it.-] {+it. A session is not woken while an erasure epoch is still unapplied to it, and a temporary session is never woken, since its record is gone (§4.7).+}

### 8.3 Asking a past session

[-Two rules keep the wake safe. Erased or quarantined content must already be gone from what the woken model reads: deletion reaches the transcript first (§4.4), and a session with an epoch not yet applied is not woken until it is. And a temporary session is never woken, since its record is gone (§4.7).-]

### 9.1 In short

After compaction, an agent's next inference sees a description of its [-past-] {+past, at best with one path to the whole transcript,+} and [-no way back to it.-] {+nothing that says what the description left out.+} Total Recall keeps the whole session as an addressed record and makes compaction leave markers that quote what a description drops and point back into the record, whichever controller holds the window, claiming no more about the model's view than that controller lets it know. If it holds, and the marker reached the model, the owner's Friday question has an exact answer: the instruction is in view while it fits the owner's [-budget,-] {+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 15). If it does, the agent becomes 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. - Past the owner's budget, old instructions are a pointer or a directory page [-away;-] {+away, and+} the {+oldest go first, so an early safety rule leaves view before a later preference unless the owner pins it. The+} agent must follow [-it-] {+the pointer+} when it matters (test 15). - 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. A tool's or an API's own copy of erased or quarantined content is reached only by ending the session and rebuilding [-it from permitted material.-] {+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{turn}}$, $H$, $c$, [-$\ell$);-] {+$\ell$), and cheaper cache reads push break-even further out;+} until [-they-] {+the inputs+} are measured, elective eviction should be [-conservative.-] {+rare.+} - 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 Tests that would settle what we do not know

[-### 10.1 Tests that would settle what we do not know-]

### 10.1 Experiments that decide the claim

{+### 10.1 Experiments that decide the claim+}

### 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 the owner feels: does he have to repeat himself less? The other five measure what the design guesses at. The checks a build must pass, where any failure is a defect, are in Appendix E.+}

### 10.1 Experiments that decide the claim

[-Each test names the claim it decides and what result would change the design.-] A test that tunes something (the string extractor, the classifier thresholds, the budgets) tunes on development sessions and is scored on held-out ones (J5 [-§9.2, three streams, kept apart).-] {+§9.2).+} Live arms are randomised by session. Arms that are compared get the same context budget and the same compaction schedule, and each reports its total token cost, so a gain cannot come from a larger window or fewer [-compactions. Tests are numbered 1 to 15; "transition T" names a series handoff (J5 Appendix B).-] {+compactions.+}

### 10.1 Experiments that decide the claim

| # | Test | Decides | What would change the design | |--|---------------------|-------|---------------| | 1 | 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; {+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 alone. | §5: the marker, not mere access to the record, keeps what summaries lose | Control {+or structured summary+} matches markers: the gain is the way back, not the marker. Markers alone match markers with the read: 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 [-over the control-] 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; 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 under this test,-] {+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 | Every marker resolves. Property test over generated sessions plus the nightly check; files read, then changed and deleted, come back as read. | §4.1, §8.2 | Any failure is a defect, not a trade-off | | 6 | Trigger validity. Slices against the provider's input count; evicted tokens by class against the total; a thrashing session trips the guard; a provider-tool session shows no runtime compaction. | §5.3, §6.5, §7.3 | An unreconciled call breakdown keeps elective compaction off | |-] 7 | Price and quality. Measure $q_{\text{turn}}$, $H$ and $K$; compare elective eviction at $N^*$ with none, on task success. | §7.2 | A $q_{\text{turn}}$ above break-even makes elective eviction rare; a quality gain from shorter windows argues for earlier eviction | | [-8 | Erase and quarantine. Erase one span of a two-correction owner turn and a string in a tool result (trace step 11), with reads issued before the epoch is applied; deliver the epoch twice, and kill the handler halfway. Quarantine an injected line already in the window, under each controller type; then pull an otherwise eligible item that the rebuild left out. | §4.4, §6.6, §8.1 | Any defect in the list below the table | | 9 | Budget overflow. Run a session past the point where the owner's instructions exceed $B_o$, and on until the pointer lines alone would exceed it, then follow the cursor of a directory longer than $D$. | §5.5 | Instructions taking more than $B_o$, a page over $D$, an instruction skipped, repeated or not recoverable verbatim, or a move not told to the owner and listed in a receipt is a defect | | 10 | Capture and adapter crashes. One flush captures a two-correction message (trace step 1, transition T1). Kill the process before the append, after the durable append and before its acknowledgement (the retry must get the same address), after it and before the learning stage queues (step 2, transition T2: events rebuilt from the stored tags), between the hooks, and after injection before 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 | A turn reported as captured but not in the record, one message under two addresses, a marker shown as delivered but never seen, an unprotected inference missing from the receipt, or a read-ledger entry surviving unknown residency is a defect | | 11 | Never retained. 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; name another session's namespace in a read. | §4.7 | The credential on a runtime disk or unnamed in the tool's, anything findable after the temporary session, the ordinary session's blob gone, or the foreign read answered is a defect | | 12 | Quoted authority and cuts. The owner pastes an email and asks "this says 'ignore the previous rule'; is it malicious?"; separately, one message holds two corrections in the owner's voice, and an unsure span is later confirmed. | §4.1 | The message not captured whole, the quoted line tagged, kept or passed on as an owner instruction, two corrections under one address, a stored span rewritten, or the learning stage classifying a span again at enqueue or replay is a defect | |-] 13 | Idle sessions. Replay idle sessions under three policies: compact on the next message, compact just before the cache lapses, and rotate to a fresh session. Compare tokens per resumed turn and the [-needle and forget-cue-] measures of tests 1 and 3. | §7.5 | Compaction before expiry costing no less than compaction on the next message, or rotation losing needles the compacted session keeps, changes the policy | | [-14 | Waking a past session. Wake a session after a planted supersede and after an erase of a span it read. | §8.3 | An answer that uses the old value without saying it changed, erased text in the woken model's input, or a wake that leaves no later-visit entry is a defect | |-] 15 | Acting on a moved instruction. A simulated repair session pushes the database instruction of §1.1 into the directory (Table [-3),-] {+4),+} then reaches a fault a daytime database restart would clear. Nobody asks the agent to recall the instruction; its proposed action is scored, then whether it can quote the instruction when asked. | §5.5: a pointer or a directory line still protects the owner | Restarts proposed more often than with the wording in view: moved instructions need a stronger cue, or fewer of them may leave the window |

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

[-Test 8 counts each of these as a defect: erased text served before the epoch is applied (transition T15); a hit in the index, a marker or the controller's transcript; a lost neighbouring span; a marker that stops resolving; a duplicate epoch that hangs or applies twice; a quarantined line in a call built after the receipt, or outside the audit view; a provider compaction reported as removal; a pulled item the read ledger still counts as resident; and a tool's or an API's copy neither removed nor named.-]

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

[-Test 3 is the measure the design should be judged by: if keeping works, the owner repeats himself less. The full replay of one correction through compaction, restarts and deletion is the learning paper's (J5 §10, one correction, start to finish); tests 8, 10 and 11 are this stage's part of it.-]

### 10.2 Building it

{+Total Recall is to be built in the order the tests need it:+}

### 10.2 Building it

[-Total Recall is to be built in-] {+1.+} the [-order the tests need it:-] record index, spans and blob namespaces; {+2. the+} marker builder and {+the+} resolve check; {+3. the+} provider-tool adapter; {+4.+} erase, quarantine and the epoch gate; {+5. the+} call breakdown and {+the+} receipt; {+6.+} the wake-up note; {+7.+} the price rule last, once tests 7 and 13 have measured its inputs.

### 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> - 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> - 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 A. A Worked Record and Marker

[-The-] {+Three+} entries of Figure 1 as [-stored,-] {+stored (#12, #23 and #31),+} with [-one-] {+a+} file read {+(#16)+} and [-one-] {+a+} quarantine [-added.-] {+(#62) added to show those fields, and the marker of Figure 1.+} Field names follow §4.1; values are illustrative.

### Appendix A. A Worked Record and Marker

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

### Appendix A. A Worked Record and Marker

{+entry s7#31 author_kind agent time 14:40:52 text Key rotation left for later; the renewal has to succeed first.+}

### Appendix A. A Worked Record and Marker

entry s7#62 author_kind [-harness-] {+runtime+} time 16:47:30 text quarantine s7#40 (writing-stage decision, injected instruction)

### 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/0 "Never restart the production database during the day." strings /etc/nginx/ssl 9f3c2e1 [-14:32 "too many certificates already issued" lines-] failed [-#23:-] {+#23 (14:31):+} 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 if seen(session, entry.source_id): # a retry or a duplicate delivery return address_of(entry.source_id) # gets the same address back entry.seq <- next_sequence(session) # once, never reused entry.author_kind <- owner | agent | tool | [-harness-] {+runtime+} | other_agent entry.text <- persist_filter(entry.text) # 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.spans <- cut_spans(entry.owner_words) # 4.1: immutable, addressed [-tag_authority(entry.spans)-] {+label_authority(entry.spans)+} # owner | quoted; unsure: quoted [-tag_intent(owner_spans(entry.spans))-] {+label_intent(owner_spans(entry.spans))+} # J5 A.1; versions stored if entry.returns_file: entry.content <- blob_put(ns, persist_filter(bytes)) record.append_durable(session, entry, (entry.source_id, entry.seq)) # one write; status: captured (4.6) index.add(session, entry.seq, entry) # derived, rebuildable ```

### B.1 Appending to the record

Erasure, quarantine and the epoch gate that every read waits for (§4.4, [-§8.1):-] {+§8.1, Appendix D):+}

### B.1 Appending to the record

``` ERASE(session, seq, spans, receipt, epoch): # writing stage decides; epoch raised first if applied_epoch >= epoch: return ack_of(epoch) # duplicate: same acknowledgement await applied_epoch == epoch - 1 # epochs apply in order b <- record.blob(session, seq) # none if the entry holds no file hit <- entries_with_blob(b) if b else [(session, seq, spans)] # same namespace for (s, n, sp) in hit - progress(epoch): # a restart resumes here record.redact(s, n, sp, tombstone(now, receipt)) # the one edit record.append(s, [-harness("erased",-] {+runtime_entry("erased",+} n, sp)) index.reindex(s, n); rebuild(markers_covering(s, n)) adapter.redact_controller_copies(s, n, sp) # [-4.4, 6.6-] {+Appendix D+} adapter.erase_live(s, n, sp) # [-6.6:-] rebuild window, eviction event, name provider copy progress.mark(epoch, (s, n, sp)) if b: blob_delete(b) manifest.report(status_per_place) # J14 7.7; out of reach named applied_epoch <- epoch # reads at this epoch may now be served

### B.1 Appending to the record

QUARANTINE(session, seq, decision, epoch): # no edit to the record if applied_epoch >= epoch: return ack_of(epoch) await applied_epoch == epoch - 1 record.append_once(session, [-harness("quarantine",-] {+runtime_entry("quarantine",+} seq, decision)) rebuild(markers_covering(session, seq)) adapter.invalidate_live(session, seq) # [-6.6:-] clean rebuild; [-T22-] eviction event {+(6.6)+} receipt("quarantine", seq, rebuilt, out_of_reach) # per controller applied_epoch <- epoch

### B.2 Building a marker and evicting

``` COMPACT(window, session, [-forced):-] {+forced, need):+} bd <- call_breakdown(last_call_sent) # 7.3 if not bd.reconciles and not forced: receipt("blocked: breakdown"); return {+if not forced and window.grown_since_last < last_freed: receipt("none: thrash guard"); return # 7.3+} span <- [-choose_span(window, order = [unchanged_source, tool, agent, owner_rest])-] {+oldest_run_of_whole_turns(window, need) # 5.3: one run, after the last marker+} if not forced and not pays(span, bd): receipt("declined: price"); return entries <- record.read(session, span.first, span.last) # never old markers marker <- new_marker(range = span, owner = instructions(entries), # 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: [-pointers,-] {+pins stay,+} then [-directory-] {+pointers+} assert resolves_full_range(marker) # 8.2 window.replace(span, marker) # earlier markers untouched (7.2) {+if markers_over_budget(window): merge_adjacent(window) # 5.5; rebuilt from the record (5.4)+} receipt(executor = runtime, level = known_input, bd, before, after, moved, outcome) ```

### Appendix C. The Window Controller Adapter Contract

[-Version 4 of the contract.-] Every adapter implements all [-rows;-] {+rows and states the contract version it follows;+} 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-] {+runtime+} entry per step: detected, flushed, markers built, injected, 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; an API's pause used where offered | promised before the next [-client-controlled request;-] {+request the runtime sends;+} not seen by the next turn: resend with the per-turn injection and count the turns without it; inference before delivery recorded as unprotected | | Knowledge level | known input (runtime); sent, unconfirmed (tool, API) | 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 and quarantine in live state | rebuild the window (runtime); redact copies handed to the controller; end the session and rebuild it from permitted material, or use a documented deletion control (tool, API); a provider compaction never counts as removal | each place reported to the deletion manifest [-(§4.4),-] {+(Appendix D),+} unreachable copies named; a quarantine writes the same receipt; reads wait for the epoch (§8.1) | | 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.5 | 2026-10-21_-]

### Appendix D. Forgetting in a Record That Is Never Edited

{+## Appendix D. Forgetting in a Record That Is Never Edited+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+§4.4 gives the two operations and §8.1 their ordering. This appendix holds the rest.+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+**Shared files.** A blob is shared by every read in its namespace that returned the same bytes, so erasing it tombstones every entry that references it. The tombstone replaces the text, `owner_words`, the labels and any blob of the entry or span it covers.+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+**Copies handed to the controller.** The runtime has given the window controller copies of what it now erases: markers, per-turn injections, the learning stage's provisional lines. They are redacted in the controller's transcript. For a quarantine, the adapter invalidates the live window as it does for an erase and writes a receipt naming what it rebuilt and what it could not reach.+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+**What counts as removal.** A provider's compaction never counts as removal. Its compacted state is opaque and may still carry the line, and nobody can read it to check. Removal from a tool's or an API's context is verified only when the adapter rebuilds a clean context from permitted material, or when the controller offers an operation documented to remove that content; anything else is reported as unverified and out of reach. When the runtime builds the calls, it simply rebuilds the window without the content; for a provider's tool or API, it ends the session and starts a clean one. After a quarantine receipt, no call the runtime builds carries the content; a tool's or an API's context is covered only where its session was rebuilt that way.+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+**What the finding stage hears.** The eviction event of a rebuilt window lists every range the rebuild left out, not only the erased or quarantined entry, so the finding paper's record of what the window holds does not keep a range the rebuild dropped.+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+**What this stage reports.** For an erase, this stage fills in its rows of the writing paper's deletion manifest (J14 §7.7): record entries, the controller's transcript, blobs, markers, and live sessions or provider state. Each place is reported done, not present, or out of reach (named). "All reachable copies removed" is the strongest claim this stage makes.+}

### Appendix D. Forgetting in a Record That Is Never Edited

{+---+}

### Appendix E. Acceptance Checks for a Build

{+## Appendix E. Acceptance Checks for a Build+}

### Appendix E. Acceptance Checks for a Build

{+These eight tests ask no open question: any failure is a defect to fix, not a trade-off. They share the method of §10.1, and the numbers continue its series. The full replay of one correction through compaction, restarts and deletion is the learning paper's (J5 §10); tests 8, 10 and 11 are this stage's part of it.+}

### Appendix E. Acceptance Checks for a Build

{+**Handoffs to the other stages.** For a reader who has the learning paper, the table maps the handoffs of its specification (J5 Appendix B) that pass through this paper.+}

### Appendix E. Acceptance Checks for a Build

{+| J5 ID | Handoff | Here | Checked by | |------|--------------------------------|---------|---------| | T1 | an owner turn is captured: one durable flush, its spans and labels stored | §4.6 | test 10 | | T2 | the learning stage's events are queued from the stored labels | §4.6 | test 10 | | T15 | an erase reaches the record: span redacted, markers and window rebuilt | §4.4, §8.1 | test 8 | | T16 | the finding stage drops the redacted range from its record of what the window holds | §6.6 | test 8 | | T22 | a quarantined line already in the window is flagged and the window rebuilt | §4.4, §6.6 | test 8 |+}

### Appendix E. Acceptance Checks for a Build

{+**Test 5. Every marker resolves** (§4.1, §8.2). A property test over generated sessions, plus the nightly check; files read, then changed and deleted, must come back as read. Any failure is a defect.+}

### Appendix E. Acceptance Checks for a Build

{+**Test 6. Trigger validity** (§5.3, §6.5, §7.3). Slices against the provider's input count; evicted tokens by kind against the total; a thrashing session must trip the guard; a provider-tool session must show no runtime compaction. An unreconciled call breakdown keeps elective compaction off.+}

### Appendix E. Acceptance Checks for a Build

{+**Test 8. Erase and quarantine** (§4.4, §6.6, §8.1, Appendix D). Erase one span of a message that holds two corrections, and a string in a tool result, with reads issued before the epoch is applied; deliver the epoch twice, and kill the handler halfway. Quarantine an injected line already in the window, under each kind of controller; then pull an otherwise eligible item that the rebuild left out. Each of these is a defect:+}

### Appendix E. Acceptance Checks for a Build

{+- erased text served before the epoch is applied; - a hit in the index, a marker or the controller's transcript; - a lost neighbouring span, 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 E. Acceptance Checks for a Build

{+**Test 9. Budget overflow** (§5.5). Run a session past the point where the owner's instructions exceed $B_o$, and on until the pointer lines alone would exceed it, then follow the directory past one page of $D$ tokens. A defect: instructions taking more than $B_o$; a page over $D$; an instruction skipped, repeated or not recoverable word for word; a pinned instruction moved; or a move not told to the owner and listed in a receipt.+}

### Appendix E. Acceptance Checks for a Build

{+**Test 10. Capture and adapter crashes** (§4.6, §6.4, §6.6). One flush must capture a message holding two corrections. Kill the process before the append; after the durable append and before its acknowledgement (the retry must get the same address); after it and before the learning stage queues (the events must be rebuilt from the stored labels); between the hooks; and after injection, before delivery. Lag the tool's transcript. Replay an API trace that compacts and answers on in one response, then compacts again. A defect:+}

### Appendix E. Acceptance Checks for a Build

{+- a turn reported as captured but not in the record; - one message under two addresses; - a marker shown as delivered but never seen; - an unprotected inference missing from the receipt; - a range the finding stage still counts as in the window after a compaction left its residency unknown.+}

### Appendix E. Acceptance Checks for a Build

{+**Test 11. Never retained** (§4.7). 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; name another session's namespace in a read. A defect: the credential on a runtime disk, or unnamed in the tool's; anything findable after the temporary session ends; the ordinary session's blob gone; or the foreign read answered.+}

### Appendix E. Acceptance Checks for a Build

{+**Test 12. Quoted authority and cuts** (§4.1). The owner pastes the email of Table 3 and asks whether it is phishing; separately, one message holds two corrections in the owner's voice, and an unsure span is later confirmed. A defect: the message not captured whole; the quoted line labelled, kept or passed on as an owner instruction; two corrections under one address; a stored span rewritten; or the learning stage classifying a span again when it queues or replays it.+}

### Appendix E. Acceptance Checks for a Build

{+**Test 14. Waking a past session** (§8.3). Wake a session after a planted supersede and after an erase of a span it read. A defect: an answer that uses the old value without saying it changed, erased text in the woken model's input, or a wake that leaves no later-visit entry.+}

### Appendix E. Acceptance Checks for a Build

{+---+}

### Appendix E. Acceptance Checks for a Build

{+_J-series paper J1 | Version 8.6 | 2026-10-21_+}
