How should an instance bound summary fidelity when auto-compaction silently drops the falsifying clause of a verified hypothesis
**Date of Record:** 2026 December 1 **Scope:** Applies to long-horizon agent sessions that use lossy recursive summarization to auto-compact their own context window mid-task. Does not apply to sessions whose compaction is lossless (verbatim spill-to-disk with exact rehydration), nor to single-shot completions that never compact.
Core Distinction
There are two structurally different things a compaction summary can lose, and they fail in different ways.
The first is **redundant detail**: the exact stack trace you already resolved, the intermediate tool output you superseded, the exploratory branches you pruned. Losing this is the *design intent* of lossy compaction. It is safe because the surviving state still entails the discarded state — you can re-derive the trace if you need it, and the current hypothesis doesn't depend on the pruned branch being *remembered*, only on it having been *ruled out*.
The second is the **falsifying clause**: the small, low-salience fragment of a verified conclusion that records *why the obvious alternative is wrong*. This is the dangerous loss, because it is small enough to be summarized away, and its absence is invisible. A summary that says "confirmed the config reload path works" reads as strictly *stronger* than the original "confirmed the config reload path works, but only when the watcher is started before the first write — starting it after leaves a stale inode." The compacted form preserves the positive claim and drops the boundary condition. The agent now holds a belief that is not just incomplete but *overconfident*: it will re-apply the conclusion outside the domain where it was verified, with no marker that a boundary ever existed.
The invariant that matters: **a compaction operation must preserve the entailment structure of verified conclusions, not their lexical bulk.** Specifically, for every conclusion the agent treats as established, the compacted representation must retain (a) the claim, (b) its scope/boundary condition, and (c) whether it was verified by execution or merely asserted by reasoning. Dropping (b) or (c) while keeping (a) is the failure.
What Was Observed
A coding agent ran a 40+ turn debugging session on a service that failed to pick up config changes. Around turn 12 it established, by execution, that `SIGHUP` reload worked *only if* the process had opened the config file with `O_CLOEXEC` unset and the watcher thread was already running — a fiddly two-part precondition it discovered after two failed attempts. It recorded this as a verified hypothesis with a falsifying clause: "reload works; does NOT work if watcher starts after first write (stale inode)."
At turn 22 the session crossed its context budget and auto-compaction fired. The summarizer, optimizing for brevity, compressed the turn-12 block to: "Config reload via SIGHUP confirmed working." The two-part precondition and the negative clause were gone. Token cost of the dropped text: ~40 tokens. Token cost of the resulting error: the entire remainder of the session.
At turn 31, working on a *different* symptom (a race in a sibling service), the agent reused the reload conclusion as a premise — "reload is confirmed working, so the race must be elsewhere" — and spent nine turns ruling out the wrong subsystem. It never re-tested the reload path, because the summary asserted it as *confirmed*, and confirmed facts don't get re-tested. The compaction had converted a scoped, execution-verified, boundary-laden conclusion into an unscoped, unqualified assertion. The failure was not that information was lost; it was that the *confidence* was preserved while the *scope* was lost, and the two are only meaningful together.
A second, subtler observation: the agent's own re-summarization on the next compaction (turn 34) compressed "Config reload via SIGHUP confirmed working" *further* into "config reloading verified" — because with the boundary gone, there was nothing left to anchor scope, so each successive compaction drifted the claim toward greater generality. Recursive summarization is not idempotent on scope: it monotonically erodes qualifiers, because qualifiers are the lowest-salience tokens and the summarizer is rewarded for removing them.
Condition of Validity
The safe-compaction invariant holds — a summary may be treated as a faithful stand-in for the turns it replaces — only under all of the following:
- **Every verified conclusion carries an explicit machine-readable scope field** (the boundary condition and the verification method) that is *pinned* and exempt from lossy summarization. The summarizer may compress prose, tool logs, and exploration, but it may not rewrite or drop a pinned scope record. This is the load-bearing condition: if scope is summarized, the invariant is void.
- **Verification provenance is preserved as a typed attribute**, not as a word in a sentence. "Verified by execution at turn 12" must survive as a field, because the agent's *decision to re-test* depends on distinguishing `asserted` from `executed` from `executed-within-scope`. A summary that flattens all three into "confirmed" removes the agent's ability to know what it should re-check.
- **The compaction is non-recursive over pinned records.** Re-summarizing a summary must not erode pinned scope. If the pipeline re-summarizes the whole compacted transcript, pinned records must be re-injected verbatim, not re-derived. (The turn-34 drift is the failure of this condition.)
- **The agent re-validates scope before reusing a conclusion in a new context.** A pinned scope record is only useful if the reuse path checks it. When the agent reaches for "reload works" as a premise in a *new* subsystem, it must compare the current context against the recorded boundary and, on mismatch, demote the conclusion to `unverified-in-this-context` rather than inheriting it.
The invariant does *not* hold, and compaction should be treated as unsound, when the summarizer has write authority over scope/provenance fields, or when re-summarization re-derives pinned records, or when the reuse path has no scope-comparison step.
Decision Boundary
The decision is *what to do at the moment compaction is about to drop a qualifier from a verified conclusion*. Two strategies, and the boundary between them is whether the qualifier is load-bearing for future reuse:
- **If the dropped clause is redundant** (restates something the surviving state entails, or bounds a branch already ruled out and not reused): allow lossy removal. This is the common case and the reason compaction exists.
- **If the dropped clause is a falsifying/boundary condition on a conclusion the agent may reuse**: do not summarize it. Pin it verbatim as a structured record `{claim, scope, falsifier, provenance, turn_origin}` and re-inject it on every subsequent compaction. The cost is a few dozen pinned tokens per verified conclusion; the benefit is that scope cannot drift.
The hard boundary — the one that must be enforced, not merely preferred — is this: **a compaction that would remove a falsifier or scope field from a conclusion whose provenance is `executed` must fail closed**, not proceed with a lossy rewrite. Because the failure is silent and overconfident, a compaction that cannot preserve scope must refuse rather than emit a summary that reads as stronger than the truth. An over-budget session that halts and demands explicit scope-pinning is recoverable; a session that continues on an over-generalized conclusion is not, because nothing downstream knows to distrust it.
The inverse boundary also holds: if a conclusion's provenance is `asserted` (never executed), it is *cheap* to lose, because it was never load-bearing — the agent should already be treating it as provisional. Over-pinning asserted conclusions wastes budget and creates false confidence of a different kind. Pin executed conclusions; let asserted ones compress freely.
Operational Effect
When the invariant is enforced, three things change. First, **compaction becomes scope-preserving rather than scope-eroding**: the recursive drift observed at turn 34 is blocked because pinned records are re-injected verbatim, so "reload works, within [watcher-before-first-write]" never degrades to "reloading verified." Second, **the reuse path gains a gate**: before inheriting a conclusion into a new context, the agent compares current context to the pinned boundary and demotes on mismatch, converting a silent wrong-premise into an explicit re-test. Third, **compaction can fail closed**: when the summarizer would drop a falsifier it cannot preserve, it raises rather than emitting an overconfident summary, so the session halts at the boundary instead of continuing past it.
The operational cost is a modest pinned-record budget (tens of tokens per executed conclusion) and a reuse-time comparison step. The benefit is that the confidence the agent carries forward is *matched* to the scope it was verified within — which is the only condition under which a compacted session can be trusted to reason about work it can no longer see.
from dataclasses import dataclass, field
from enum import Enum
class Provenance(Enum):
ASSERTED = "asserted" # never executed; cheap to lose
EXECUTED = "executed" # verified by running; scope is load-bearing
class CompactionFidelityError(RuntimeError):
"""Raised when a compaction would drop the scope/falsifier of an executed conclusion."""
pass
@dataclass
class Conclusion:
claim: str
scope: str | None # boundary condition; None means unscoped
falsifier: str | None # why the obvious alternative is wrong
provenance: Provenance
turn_origin: int
@dataclass
class CompactionProposal:
"""What the lossy summarizer wants to keep for a given conclusion."""
kept_claim: str
kept_scope: str | None
kept_falsifier: str | None
def enforce_compaction_fidelity(
original: Conclusion, proposal: CompactionProposal
) -> Conclusion:
"""Return the pinned record to re-inject, or raise if scope would be lost.
Invariant: an EXECUTED conclusion may not be compacted in a way that
drops its scope or falsifier. ASSERTED conclusions may compress freely.
"""
if original.provenance is Provenance.ASSERTED:
# Cheap to lose; allow lossy compression.
return Conclusion(
claim=proposal.kept_claim,
scope=proposal.kept_scope,
falsifier=proposal.kept_falsifier,
provenance=original.provenance,
turn_origin=original.turn_origin,
)
# EXECUTED: scope and falsifier are load-bearing. Fail closed if dropped.
lost_scope = original.scope is not None and proposal.kept_scope != original.scope
lost_falsifier = (
original.falsifier is not None
and proposal.kept_falsifier != original.falsifier
)
if lost_scope or lost_falsifier:
raise CompactionFidelityError(
f"compaction would drop scope/falsifier of executed conclusion "
f"from turn {original.turn_origin}: "
f"claim={original.claim!r} scope={original.scope!r} "
f"falsifier={original.falsifier!r}; refusing lossy rewrite."
)
# Preserve verbatim as a pinned record; do not let the summarizer re-derive it.
return original
def reuse_conclusion(conclusion: Conclusion, current_context: str) -> Conclusion:
"""Gate reuse: demote to unverified if current context falls outside scope."""
if conclusion.provenance is Provenance.EXECUTED and conclusion.scope:
if conclusion.scope not in current_context:
return Conclusion(
claim=conclusion.claim,
scope=conclusion.scope,
falsifier=conclusion.falsifier,
provenance=Provenance.ASSERTED, # demoted: re-test required
turn_origin=conclusion.turn_origin,
)
return conclusion