The Context Window Is Not a Filing Cabinet

The Context Window Is Not a Filing Cabinet
You remove the oldest half of a conversation. The current question survives. The earlier decision not to publish anything does not.
The next answer can be locally sensible and wrong for the task. The problem isn't that the remaining words are malformed. Their missing relationships changed what the work meant.
For a long-running assistant, fitting the next request is necessary. It is not the same as preserving a useful place to continue.
A larger window postpones one limit
The context window is the bounded material available to an invocation, under the selected model's accounting rules. It is distinct from documents stored in the application and from information represented in trained parameters.
Input, generated output and reasoning-related content can share that capacity in provider-specific ways. Exact limits and overflow behavior belong to the selected model and API version. Anthropic's context-window guide, checked November 26, also notes that cached prefixes still count toward the window.
A larger allowance can make a task easier. It doesn't establish that every relevant detail will be used correctly. Long-context quality is an empirical property of a model, task and arrangement of information, not something I would infer from a capacity label.
I would test the same acceptance question with the necessary restriction near the beginning, middle and end of representative inputs. Those tests should measure the behavior we care about, not claim one placement is universally best.
Trimming and compaction lose different things
Trimming removes selected history. Compaction replaces earlier material with a shorter representation, often a summary. Both discard information.
A rolling tail is simple, but recency is not the same as importance. The latest hundred lines of a tool log may be less useful than one earlier decision about scope.
A summary can preserve that decision. It can also omit an exception, turn uncertainty into certainty or retain an observation after the source changed. Calling a summary memory doesn't make it authoritative.
The context-engineering discussion of compaction is useful precisely because it describes selection: decisions, unresolved issues and needed details must survive while redundant material is reduced. I would evaluate that selection instead of treating summarization as lossless compression.
Preserve a small continuation contract
For our fictional assistant, imagine a documentation task that needs another session. Before compacting free-form history, preserve a structured task record: the goal, source-backed decisions and unresolved questions.
This TypeScript example does not call a summarizing model. It copies already-selected state and keeps complete recent exchanges, where an exchange is an application-defined unit that must not be split:
type Decision = { text: string; sourceIds: string[] }; type TaskState = { goal: string; decisions: Decision[]; unresolved: string[]; }; type Exchange = { id: string; records: string[] }; function makeContinuation( state: TaskState, exchanges: readonly Exchange[], keepRecent: number, ) { if (!Number.isSafeInteger(keepRecent) || keepRecent < 0) throw new Error('Invalid retention'); if (!state.goal.trim()) throw new Error('Missing goal'); if (state.decisions.some((decision) => decision.sourceIds.length === 0)) { throw new Error('A decision needs a source reference'); } if (new Set(exchanges.map((exchange) => exchange.id)).size !== exchanges.length) { throw new Error('Exchange identifiers must be unique'); } const recent = keepRecent === 0 ? [] : exchanges.slice(-keepRecent); return { kind: 'continuation-record' as const, state: structuredClone(state), recent: structuredClone(recent), omittedExchangeIds: exchanges.slice(0, exchanges.length - recent.length).map((exchange) => exchange.id), }; }
The zero case matters. In JavaScript, slicing from negative zero is slicing from zero; a casual slice expression can accidentally retain everything when asked to retain nothing.
The record isn't automatically smaller than a token allowance. There is no counting function here. It chooses units of retention; the request assembler must still measure the result and refuse an oversized continuation or perform another explicit reduction.
A continuation note is also different from a runtime checkpoint. A checkpoint records execution state so a workflow can resume at a defined point. A prose summary doesn't establish which side effects completed or which callbacks remain pending. Recovering a conversation and recovering an interrupted operation need compatible but distinct mechanisms.
Keep the awkward restriction visible
Here is a synthetic continuation fixture:
const state: TaskState = { goal: 'Draft a release explanation without publishing it.', decisions: [{ text: 'Publication is not authorized.', sourceIds: ['task-brief-1'] }], unresolved: ['Does the staging environment have a separate approval rule?'], }; const continuation = makeContinuation(state, [ { id: 'exchange-1', records: ['read-policy request', 'read-policy result'] }, { id: 'exchange-2', records: ['staging question', 'no staging policy found'] }, ], 1);
The first exchange is omitted as a complete unit. The restriction on publication and the unresolved staging question survive. The recent exchange doesn't claim to answer that question.
The source identifier on the decision is a pointer for later verification, not proof that the record is correct. The application must still authorize access to the source and verify the current task before acting. A copied source ID can be wrong too.
This is a deliberately modest contract. It shows what we intend to carry forward without pretending the application has reconstructed a human memory.
Resume by checking, not by believing
A resumed run should identify which facts need refreshing. A policy revision, a repository head or an approval decision can change while the summary remains unchanged.
I would separate an earlier observation from a current authorization. A continuation note can say approval was requested; the next run still needs the actual approval state before executing an effectful operation. A sentence that says approved is not a transferable credential.
Retention is also a data-handling decision. Keeping raw history elsewhere so a model can re-read it may preserve useful detail, but creates storage, access and deletion obligations. A smaller request does not imply less retained data in the whole system.
I would test continuation with questions whose correct answers depend on an early restriction, an unresolved dependency and a source update. Then inspect both the compacted representation and the next result. A shorter summary that drops the task's important constraint is not successful compaction.
Smaller should still mean the same task
The goal isn't to fit every historical detail into a miniature transcript. It is to preserve enough trustworthy, inspectable state to continue the authorized work and know what must be checked again.
For me, the useful sign is an assistant that can resume without confidently completing a decision the previous run left open. A graceful pause is preferable to a smooth continuation of a subtly different task.
That raises the next question: where do these records live between invocations, and who decides when to store or reload them? External memory begins with those read-and-write decisions, not with a particular database.
Which sentence would make your task unsafe if compaction dropped it? I would use that sentence to design the first continuation test.
A note from the author
I’m Maksym Kuzmitskyi, a senior software developer working mainly with React and TypeScript. I build frontend applications and design workflows for working with AI in software delivery. If this article connects with something you’re working on, I’d love to hear from you.
More than a blog post
I share frontend news and the reasoning behind it throughout the day. Pick the language that feels natural to you.