Understand context windows, token budgets, retrieval and compaction, with a practical method for preserving decisions across long AI projects.
Understand context windows, token budgets, retrieval and compaction, with a practical method for preserving decisions across long AI projects.
A context window is the amount of information a model can work with in a particular request, measured in tokens or an equivalent model-specific representation. It helps determine how much conversation, reference material and output can fit into one operation. It is not the same thing as permanent memory or the total number of files an application lets you upload.
This guide explains how context limits affect long documents and ongoing projects. The running example is editing a cookbook: the assistant must preserve ingredient quantities, a style guide and decisions made across several chapters. The challenge is keeping the right information available, not simply attaching every file again.
The model may receive system instructions, your latest request, earlier messages, tool descriptions, tool results and retrieved passages. The application assembles those pieces before sending a request. Some of them may not be visible in the conversation interface.
Generated output also needs an allowance under the model’s applicable limits. Exact accounting differs by model and interface, including how reasoning or multimodal inputs are counted. Check the documentation for the specific deployment instead of assuming every displayed context figure includes the same components.
A token is not always a word. Different languages, code, identifiers and punctuation can consume different numbers of tokens for similar-looking text. Our token guide explains why counting pages or multiplying word count by a fixed rule produces only an estimate.
For the cookbook, a few recipes may be small enough to include directly. A large manuscript with image descriptions, editing history and repeated tool output can be much larger than the visible chapter text suggests. Leave room for the answer and for the next step in the workflow.
A model accepting a long request does not establish that it will use every detail correctly. It may miss a constraint, confuse two similar recipes or apply a superseded style decision. Capacity and effective use are different properties to test.
The long-context study Lost in the Middle found that relevant information’s position affected performance on the models and tasks studied. That historical result does not rank current models or establish a universal failure rate. It does provide a reason to test whether an important detail remains usable as surrounding material grows.
Use a realistic question for the manuscript: which recipes still contain the old salt quantity after the revision? A successful answer needs the current ingredient values and a reliable way to distinguish drafts. Merely finding one phrase somewhere in a long context is a much weaker test.
Repeat checks with the relevant passage near the beginning, middle and end of the material, and with similar distractors present. Look for wrong answers as well as omissions. A model can sound confident while applying a quantity from the wrong recipe version.
An application can store a large collection while sending only selected passages to the model. In that case, the upload allowance describes storage or ingestion, not the information available in each response. Search and retrieval determine which excerpts enter the active request.
Persistent memory is another mechanism. It can store a preference or project fact across conversations, but the application still has to retrieve or insert that information when useful. Our personal assistants guide explains how memory, tools and permissions work together.
For the cookbook, a persistent preference such as British spelling is different from the exact list of quantities in chapter seven. A short memory note might preserve the preference while leaving the chapter’s detailed evidence in a source file that must be opened again.
Retrieval is helpful when a question needs a small part of a large collection. Direct long-context input can help when the relationships across a whole document matter. Our RAG guide explains the retrieval route; neither approach eliminates the need to verify that the necessary evidence reached the model.
When a conversation grows, an application may remove older material, clear tool results or replace history with a summary. These are implementation choices, so behavior can differ across products. Ask what is retained and observe the evidence available for the next answer.
Compaction preserves selected information in a shorter representation. It is useful but lossy: a summary can omit an exception, merge decisions or preserve an assumption that was later corrected. A coherent summary is not a full copy of the original evidence.
Anthropic describes compaction, structured notes and selective retrieval as approaches to long-running work. The general engineering principle is to preserve high-value state and recover details when needed. It does not mean every application uses the same compaction trigger or summary format.
After a long editing session, check whether the assistant can identify the authoritative recipe file and the latest approved change. If it cannot, supply those sources again rather than relying on an increasingly vague statement that it remembers the project.
Create a separate record of decisions that must survive a fresh conversation. Keep it short enough to inspect, and distinguish confirmed facts from pending proposals. Source paths and version identifiers are often more useful than long pasted extracts.
The following example is fictional. It illustrates the information to carry forward when continuing the cookbook edit.
Project: weekday cookbook, editorial pass 3.
Authoritative source: manuscript-v3, chapters 1-8.
Style: British spelling; ingredient weights remain in grams.
Approved decision: recipe R-017 uses 6 g salt, replacing 8 g.
Source of decision: editor-note-14, section 2.
Pending: author has not approved the revised cooking time for R-022.
Completed: spelling review of chapters 1-3.
Next task: check R-017 references in chapters 4 and 7.
Recovery rule: reopen source passages before changing quantities.
Do not turn this record into another uncontrolled source of truth. Update it when a decision changes and retain the evidence behind the decision. A note that says “all recipes checked” should identify which version was checked and what the check covered.
Our context engineering guide covers the broader process of organizing information for an agent. The state record is one specific tool for managing what gets lost when a session grows or restarts.
Start with the immediate goal, then include the minimum sources needed to complete it accurately. For a chapter edit, supply the relevant chapter, style rules and unresolved decisions. For a cross-book consistency check, first build an index of recipe IDs and references, then inspect the candidate passages.
Separate background from authoritative instructions. Label quoted manuscript text as material to edit, rather than allowing a sentence inside it to redefine the assistant’s task. Long documents can also contain prompt injection, so source length should not grant source authority.
Reserve space for useful output. A request to reproduce every changed chapter can consume far more output than a list of proposed edits with source locations. Choose the artifact that makes review easier instead of forcing the entire workflow into one enormous response.
When useful, split work into independently checkable units and combine their results using stable IDs. Avoid splitting away context essential to the decision, such as a definition that changes how a later paragraph should be interpreted.
Create a short set of project checks: an approved quantity, an unresolved decision, a source version and an instruction that was explicitly reversed. Run those checks after a new conversation, a long tool session or a known compaction event.
Score whether the answer is correct and whether it can point to evidence. If the assistant supplies the wrong source, treat that as a failure even when its proposed edit happens to look reasonable. Reopening the relevant passage is a better recovery step than repeatedly asking whether it is sure.
The practical measure of a context strategy is whether it preserves task-relevant decisions and allows reliable recovery of details. A larger window can be useful, but a clear state record, selective evidence and small verification steps make the workflow easier to trust and maintain.
Disclaimer: AIstify is an independent media brand owned and operated by NuvexMedia LLC, publishing news, research, and insights on artificial intelligence, emerging technologies, automation, and related industries. NuvexMedia LLC invests in and collaborates with companies across the AI, technology, software, and digital innovation sectors. These relationships do not influence AIstify’s editorial coverage, and the publication maintains full editorial independence to provide accurate, timely, and objective information. © 2026 NuvexMedia LLC. All rights reserved. This content is for informational purposes only and should not be considered legal, tax, investment, financial, or other professional advice.
OpenAI and Anthropic’s private cryptography findings did not compromise RSA-2048, the FT reports, as governments urge faster encryption upgrades.