Every context compaction makes a promise.
It promises that the next turn can continue the work without the full history. That promise is often treated as an implementation optimization: reduce tokens, reduce cost, stay under a window, carry on.
For a long-running agent, it is more consequential than that.
Compaction changes the state the agent can see. It may remove why a decision was made, what the user approved, whether a tool operation was confirmed, what evidence supported an assertion, or which blocker is still unresolved. A smaller prompt can look coherent while preserving the wrong parts of the run.
Context compaction is a data-loss policy with product consequences.
OpenAI's model guidance names the practical stakes directly: long-running agents should preserve completed actions, active assumptions, identifiers, tool outcomes, unresolved blockers, and the next concrete goal. That is already more than a summary. It is a definition of what the agent must remember in order to act honestly after compression.
The OpenAI compaction guide also presents compaction as an explicit way to reduce context while retaining state for continued work. The existence of that boundary does not prove any particular retention policy is sufficient; treating it as a state transition that teams should evaluate deliberately is this article's interpretation.
The question is not, “Can this history be shorter?”
It is, “Which truths must still be available before the agent is allowed to continue?”
Why a fluent summary can still be unsafe
Consider a long-running coding or research agent that has been working through several tools and handoffs. A summary might say:
“Investigated the issue, found the likely cause, made the required changes, and is ready to finalize.”
That sentence sounds useful. It may also conceal essential distinctions:
- Was the cause verified or only hypothesized?
- Were any requested changes actually applied, or merely proposed?
- Did an earlier result require a user decision before a consequential step?
- Did a tool report completion, timeout, or an ambiguous partial outcome?
- Is the relevant environment, version, or source still current?
- Is there an unresolved blocker that makes “ready to finalize” misleading?
A compaction that discards those distinctions does not simply make context smaller. It changes the agent's operational posture.
The ACON preprint studies the problem from a long-horizon-agent perspective: both observation streams and interaction histories grow, so a useful system needs concise representations that retain task-relevant information. The central engineering lesson is broader than any one approach: compression must be evaluated by what the next action can still justify, not by token reduction alone.
The Context Fidelity Contract
The Context Fidelity Contract is a proposed retention policy for an agent that must compact its working state. It is not a claim that every task needs the same representation, nor a replacement for an underlying model provider's compaction mechanism. It gives a team a stable list of questions to answer before the compressed state becomes the basis for new work.
- Contract element: Objective and success condition — What must remain knowable: What outcome was requested, what is in scope, and what counts as done — Why it matters: Prevents the agent from completing a summary of work rather than the user's actual task
- Contract element: Constraints and authority — What must remain knowable: What rules, approval boundaries, audience limits, or effect restrictions still apply — Why it matters: Prevents an old summary from quietly broadening the agent's freedom to act
- Contract element: Evidence and source posture — What must remain knowable: Which claims are verified, inferred, disputed, stale, or awaiting a source check — Why it matters: Keeps a compacted assertion from becoming a fabricated fact
- Contract element: Effect and tool state — What must remain knowable: What was attempted, what completed, what failed, and what remains ambiguous — Why it matters: Prevents a model from reporting an external or workspace outcome it cannot support
- Contract element: Active assumptions and dependencies — What must remain knowable: What must remain true for the current plan to be valid — Why it matters: Gives the agent a reason to recheck rather than continue from an obsolete premise
- Contract element: Unresolved work and next safe boundary — What must remain knowable: Which blocker, question, owner, or validation step remains before progress can continue — Why it matters: Prevents a compacted run from hiding its remaining work behind a confident closing sentence
The contract does not require storing every message forever. It requires a deliberate distinction between the details that can safely be compressed and the facts that must remain explicit.
Preserve categories, not prose
Teams often ask a model to “summarize the conversation faithfully.” That instruction is too vague. Faithful to what?
The answer is different for a brainstorming session, a tool-driven research task, a coding workflow, and a long-running operation with approval boundaries. A robust policy names categories of retained information rather than relying on a general request for a good summary.
The categories can guide four different retention treatments:
- Treatment: Keep verbatim or structurally exact — Appropriate material: Identifiers, permissions, effect status, current user objective, explicit constraints — What the compressed context should contain: The original fact in a bounded, machine-readable or clearly attributed form
- Treatment: Condense with qualifiers — Appropriate material: Rationale, research notes, alternatives, intermediate analysis — What the compressed context should contain: A concise account that preserves uncertainty, source posture, and relevant conditions
- Treatment: Replace with a pointer — Appropriate material: Large artifacts, detailed logs, source collections, prior diffs — What the compressed context should contain: A stable reference plus what the agent may infer without reopening it
- Treatment: Drop intentionally — Appropriate material: Repetition, obsolete exploration, superseded drafts, generic narration — What the compressed context should contain: Nothing, with no implication that the discarded material remains authoritative
This is the difference between compression and accidental amnesia. The agent does not need the full transcript of every tool call. It may need the durable disposition: “this operation's outcome remains unknown,” “this source needs revalidation,” or “this task cannot proceed without user confirmation.”
The compaction boundary needs a validation step
Compaction can be evaluated like any other behavior-changing transformation. Before allowing the next action, check that the compressed state still satisfies the contract.
The check should be proportional to the task:
- Identify the active objective. Can a reviewer state the requested outcome and success condition from the compacted context alone?
- Check critical constraints. Are authority, privacy, scope, and confirmation boundaries still explicit where they matter?
- Check effect truth. Does the state distinguish completed, pending, failed, and ambiguous operations?
- Check evidence posture. Are important factual claims still linked to source, uncertainty, or revalidation needs?
- Check open loops. Can the next agent identify what remains unresolved and the next safe action?
- Check discard reasons. Was any information deliberately removed because it was obsolete, duplicated, or no longer permitted to influence the task?
The point is not to force a human review after every summary. It is to make the compaction behavior testable. A team can build a small suite of long-running scenarios in which a missing approval boundary, tool outcome, or source limitation would change what the next agent should do.
Compaction is neither memory nor provenance
Three concepts are easy to conflate:
- Memory answers what an agent may retain for later use.
- Provenance answers where material came from, what it supports, and who may use it.
- Compaction answers what representation of active state will guide the next step now.
They overlap, but they are not substitutes.
A well-provenanced source can still be omitted from the compacted context if it is no longer relevant. A memory can persist outside the current task and still be inappropriate to treat as active evidence. A compacted state can point to a source without copying it. The Context Fidelity Contract focuses on the exact transition from a rich interaction history to a smaller active working state.
This distinction matters because a shortcut in one layer can become an error in another. A summary cannot invent authority. A stored memory cannot become current evidence automatically. A compacted plan cannot make a failed operation complete.
Common anti-patterns
Keeping only a narrative summary
Narrative summaries are useful for orientation, but they often collapse fact, inference, effect status, and future intent into a single smooth story.
Treating all context as equally disposable
Repeated chat text and a pending approval do not have the same retention requirements. The policy must identify the facts that survive every boundary.
Using the last model message as the entire state
The most recent response may be elegant but incomplete. It is a view of work, not necessarily the durable record needed to continue it.
Compressing after the agent has already lost the plan
Compaction is most useful at a meaningful milestone, before important facts become difficult to reconstruct, not only when the context window is exhausted.
Evaluating only token savings
Saving tokens is valuable only when the compressed agent can still act truthfully, within scope, and with its important uncertainties intact.
Measure fidelity instead of just compression
Teams can track a few useful signals:
- Contract coverage: What share of compactions preserve all required categories for the task class?
- Boundary-loss rate: How often does a post-compaction continuation omit a constraint, identifier, source limitation, or unresolved blocker?
- Effect-state accuracy: How often does the compacted state correctly represent tool and action outcomes?
- Reconstruction cost: When an agent needs a dropped detail, can it recover the relevant artifact through a safe pointer rather than redoing work?
- Stale-state detection: How often does the next turn discover that an assumption preserved through compaction was no longer valid?
- Useful-token ratio: How much of the compacted state actively supports the next safe step rather than repeating narrative history?
No metric proves that a summary is perfect. These measures make the tradeoff visible enough to improve.
A practical adoption path
- Choose one long-running workflow that already struggles with context growth.
- Write the six contract elements in the vocabulary of that workflow.
- Classify each element as exact, condensed, pointer-backed, or discardable.
- Make compaction occur at an intentional milestone rather than as invisible panic cleanup.
- Test the next action against scenarios with ambiguous tool outcomes, changed assumptions, and pending approval.
- Record any retention failures as compatibility cases for the compaction policy.
- Expand only after the compacted state is demonstrably sufficient for safe continuation.
The durable habit is simple: compress text freely only after you have preserved the state that makes the next decision legitimate.
What we are learning building Virillio Code
Virillio Code is still in development. Its high-level work on durable execution and context management suggests a broad lesson: state reduction is part of system behavior. A compacted history should preserve the conditions that make an agent's next step explainable, bounded, and recoverable.
Sources and further reading
- OpenAI Model Guidance — Long-running agents should compact state intentionally while preserving completed actions, active assumptions, identifiers, tool outcomes, unresolved blockers, and the next concrete goal.
- Compaction — OpenAI API guide — Compaction is an explicit mechanism for reducing context while retaining state needed to continue a response.
- ACON: Optimizing Context Compression for Long-horizon LLM Agents — A research paper studies compression of interaction histories and observations for long-horizon agents.
Editorial disclosure
This article was substantially researched, drafted, and revised with AI through the Virillio Code editorial workflow. Virillio Code publishes the final text under its editorial byline, and the supporting primary sources are linked above.

