Context Theory Get your growth audit

Answer

What should happen when an AI agent reaches a context limit?

It should already have written what matters down, so the limit is an inconvenience rather than an event.

Nothing important, because the work should already be written to files. If the limit is a crisis, the design was to hold everything in the session, and compaction will now choose what to lose on your behalf.

Treating the context limit as the event to design for gets the sequence backwards. If the durable outputs of the work — the findings, the decisions, the state, the artefacts — have been written as they were produced, then reaching a limit means starting a new session and reading them. Nothing is lost because nothing important was only in the session. If they have not been written, the limit is the moment the work becomes unrecoverable, and no handling of the limit fixes that.

What actually happens by default is compaction: the history is summarised and the session continues with the summary. This works better than stopping and it has a property worth understanding, which is that the losses are unannounced and unchosen. Specific values, exact wording, negative findings and the reasons behind decisions are the classes most likely to go, and nothing indicates which went. A session that has compacted twice is working from a summary of a summary.

So compaction is a fallback rather than a mechanism to rely on. Where it is going to happen, the productive response is to get ahead of it: before the limit, deliberately write the things that must survive — the decisions with their reasons, the values other work depends on, the routes already ruled out — into a file. That converts an unchosen loss into a chosen one, which is the whole of the improvement available here.

The behaviour to watch for after a compaction is the confident contradiction. A session that has lost a specific will not know it has, and will answer from what remains, sometimes contradicting something it stated clearly an hour earlier. This is the most disorienting failure in long sessions and it is entirely explained by the mechanism, which is worth knowing because the alternative explanation people reach for is that the tool is unreliable in general.

The structural fix is the one that appears everywhere in this subject: make the session disposable. A run that reads state, does a stage and writes state has no relationship with the limit at all, because it never accumulates enough to meet one. Designs that meet limits regularly are designs that are carrying work in the wrong place.

One practical note. Where a tool compacts automatically, it is worth reading the summary it produced at least once on a job that matters. It tells you what class of thing this mechanism discards, and that generalises to every future compaction, which is a few minutes for a lasting piece of knowledge about a process you would otherwise be trusting blind.

The limit is not the problem; the problem is that everything you needed was only in the session when you reached it.

Siddharth Sharma, Context Theory

Related questions

Should you compact manually before the limit?

Better than that: write the durable content to a file and start a new session. Manual compaction still produces a summary chosen by the same process; writing the survivors yourself is the version where you decide what matters. The two look similar and differ in exactly the property that causes the problem.

Is a larger context window the answer?

It moves the limit and does not change the behaviour approaching it, because retrieval of a specific fact degrades as the held volume grows. A session near the limit of a large window is diluted in the same way as one near the limit of a small one, so the practices are unchanged and the arrival is later.

METHOD

Every figure below carries its source and the date it was verified. Nothing on this page is asserted.

The numbers on this page.

Datapoints
What Value Specific to
Close rate — response under 5 minutes vs over 24 hours32% vs 12%Category-wide
Visibility lift in AI-generated answers from GEO methodsup to 40%Category-wide

Optifai speed-to-lead benchmark · n=939 companies · Q2 2025–Q1 2026 · verified

Aggarwal et al., "GEO: Generative Engine Optimization", Princeton / Georgia Tech / IIT Delhi / Allen Institute for AI — KDD 2024 · GEO-bench · 10,000 queries across 8 domains · verified

What is specific to this page.

Evidence
Kind Claim Check it against
WorkflowReaching a context limit is uneventful where durable outputs were written as produced and unrecoverable where they were not, so the limit is not the event to design for and no handling of it substitutes for the writing.Starting a fresh session and checking whether the work can continue from the files alone.
SoftwareAutomatic compaction discards specific values, exact wording, negative findings and decision reasons without indicating what was removed, and a twice-compacted session is working from a summary of a summary.Comparing a compaction summary against the history it replaced for content that did not survive.
ResponseA session that has lost a specific through compaction does not know it has and answers from what remains, which produces confident contradiction of something stated clearly earlier in what appears to be one conversation.Asking about a detail established before a compaction and comparing the answer with the original statement.
ConstraintA run that reads state, performs a stage and writes state never accumulates enough to meet a limit, so designs that encounter limits regularly are carrying work in the session rather than in storage.Checking whether a workflow that meets limits holds its intermediate results in files or in the conversation.

Each row would be wrong on another industry's page. Where a sourced figure exists it is in the table above instead; these are the constraints that shape the work and do not happen to be numbers.

Start with the measurement.

Reading about a benchmark is not the same as knowing your own number. The audit produces yours, measured rather than estimated.

Get your growth audit

$497 · delivered in 5 business days · credited against month one