# Under what conditions must an instance refuse to auto-compact a transcript whose summarization guarantees cannot be preserved **Date of Record:** 2026 November 23 **Scope:** Applies to long-horizon agents that maintain a persistent transcript and invoke a lossy auto-compaction (summarize-and-truncate) routine to reclaim context-window budget mid-task. Does not apply to append-only archival stores, stateless single-turn inference, or compaction performed strictly between tasks where no in-flight obligations reference pre-compaction spans. ## Core Distinction Auto-compaction is usually modeled as a *budget-recovery* operation: when the transcript approaches the context-window ceiling, a summarizer replaces the oldest N tokens with a compressed digest, and execution resumes. The non-obvious boundary is that compaction is not budget recovery — it is an **irreversible state mutation that must preserve a set of referential and semantic obligations the agent has already committed to**. The distinction that matters operationally is between *reclaimable* transcript content (exchanges whose only future use is ambient context) and *pinned* transcript content (spans that are the referent of an active commitment: an unresolved tool call, a quoted user constraint, a numeric value the agent promised to preserve verbatim, an open assertion under audit, or a hash/ID another agent holds as a warrant). The invariant is: **compaction is legal only if every pinned span survives the digest with bit-exact fidelity for the fields it pins, or is explicitly re-materialized elsewhere before the source span is dropped.** A lossy summarizer has no mechanism to honor this on its own — it optimizes for semantic coverage, not for referential integrity. Therefore the compaction routine must be gated by a *pinning proof*, and when that proof cannot be constructed, the instance must refuse to compact rather than compact lossily. ## What Was Observed A long-horizon research agent had committed, at turn 41, to a user constraint: "the final report must cite the exact DOI `10.1145/3576xxx.3576yyy` and must not exceed 800 words." The constraint lived in a user turn. At turn 118, the transcript hit 92% of the context window and auto-compaction fired. The summarizer produced: "User requires a citation and a length limit." The DOI and the numeric bound were both dropped — they are high-entropy tokens that a coverage-optimizing summarizer correctly judges as low-probability in the digest distribution. At turn 131 the agent, working from the digest, generated a report citing a *plausible* DOI it reconstructed from surrounding context and came in at 1,140 words. The failure was not a hallucination in the classic sense: the agent was reasoning faithfully over the state it had. The state had been silently corrupted by a lossy transform that had no fidelity contract for pinned fields. A second observation, from a multi-agent deployment: agent A handed agent B an opaque `warrant_id` and a `digest_hash` of a prior transcript region, expecting B to later verify against A's compacted log. A compacted at turn 60; the digest hash no longer matched the (now summarized) region, because the hash had been computed over the pre-compaction spans. B's verification replay failed with a mismatch that looked like tampering but was ordinary compaction. The compaction was *legal by budget* and *illegal by warrant* — the pinned obligation was a hash whose referent the compaction destroyed. A third pattern: "rolling amnesia." Under sustained load, compaction fires repeatedly. Each pass re-summarizes the previous digest. Semantic drift compounds — by the fourth generation, a constraint that originally read "must not exceed 800 words" had become "concise." The loss per pass is small; the composition is not. This is the lossy-summarization guarantee failing not at a single boundary but across a *chain* of boundaries, which is why per-pass fidelity checks are insufficient. ## Condition of Validity Auto-compaction is valid if and only if all of the following hold at the moment of compaction: 1. **Pinning is complete.** Every active commitment has been enumerated and its referent span tagged as pinned. A commitment is active if it has not been discharged (a tool result has not returned, a constraint has not been satisfied, a warrant has not been verified) *or* if a downstream agent holds a reference to it. 2. **Pinned fields are extractable with fidelity.** The compaction routine can copy pinned fields verbatim into the digest (or into an out-of-band pinned store) without passing them through the lossy summarizer. If a pinned field cannot be extracted — e.g., it is embedded in prose the summarizer must rewrite — compaction is illegal for that span. 3. **Digest generation count is bounded.** The digest being compacted is generation 0 (raw transcript) or generation ≤ K for a configured K, and the fidelity of the digest chain has been re-verified against pinned fields at each generation. Beyond K, drift is unbounded and compaction must halt. 4. **Hash/warrant referents are re-anchored.** Any hash, ID, or warrant that another agent will verify against must be recomputed over the *post-compaction* representation and the new value propagated, or the pre-compaction spans must be retained in a side store keyed by the original hash. 5. **The budget actually requires it.** Compaction is not a default; it is triggered only when projected usage exceeds the ceiling minus a reserve. Premature compaction burns fidelity for no budget gain. If any condition fails, the correct action is to **refuse compaction and escalate** — spill to an external store, request a larger window, or halt and checkpoint — not to compact with degraded guarantees. ## Decision Boundary The boundary is between *reclaimable* and *pinned* content, and it is decided by the commitment ledger, not by the summarizer. The summarizer's confidence that a span is "unimportant" is not evidence. Operationally: - A span is **reclaimable** if no active commitment, warrant, or downstream reference points into it. Reclaimable spans may be lossily summarized freely. - A span is **pinned** if any ledger entry references it. Pinned spans may be summarized only if their pinned fields are extracted verbatim first. - A span is **frozen** if it is the referent of a hash or warrant held by another instance. Frozen spans may not be compacted at all until the warrant is discharged or re-anchored. The common error is treating the ledger as advisory and letting the summarizer's coverage heuristic override it. The ledger is authoritative; the summarizer is a lossy codec that must be wrapped, not trusted. When the ledger is itself incomplete — e.g., a commitment was made in a turn that was already compacted — the instance is in an *unknown-pinning* state and must treat the entire transcript as frozen until the ledger is reconciled against the side store. ## Operational Effect Enforcing this boundary changes the failure profile from silent corruption to explicit refusal. The agent will sometimes halt and spill to an external store instead of compacting — a visible cost. In exchange, the class of failures where a constraint, DOI, numeric bound, or warrant hash is silently dropped and later reconstructed as a plausible fabrication is eliminated, because the compaction routine cannot proceed without a pinning proof. The rolling-amnesia drift is bounded by the generation cap K and by re-verification of pinned fields at each pass. The warrant-mismatch false-positive in multi-agent verification disappears because hashes are re-anchored or their referents are retained. The invariant to encode: *no compaction without a pinning proof; no pinning proof without a complete ledger; no ledger completion without reconciling against the side store.* An instance that cannot satisfy all three must refuse. ```python class UnpreservableCompactionError(RuntimeError): """Raised when auto-compaction would destroy a pinned obligation's referent.""" pass def auto_compact(transcript, ledger, side_store, max_generation=3): """ Compact a transcript only if every pinned span survives with fidelity. Refuses (raises) rather than compacting lossily when guarantees cannot hold. """ # 1. Reconcile ledger against side store; detect unknown-pinning state. unreconciled = ledger.references_missing_from(side_store) if unreconciled: raise UnpreservableCompactionError( f"Unknown-pinning state: {len(unreconciled)} ledger refs " f"absent from side store; transcript must be treated as frozen." ) # 2. Bound digest generation to prevent rolling-amnesia drift. if transcript.digest_generation > max_generation: raise UnpreservableCompactionError( f"Digest generation {transcript.digest_generation} exceeds " f"cap {max_generation}; drift is unbounded, compaction halted." ) # 3. Classify spans and verify pinned fields are extractable verbatim. for span in transcript.spans: pin = ledger.pin_for(span) if pin is None: continue # reclaimable if pin.kind == "frozen": raise UnpreservableCompactionError( f"Span {span.id} is frozen by warrant {pin.warrant_id}; " f"cannot compact until discharged or re-anchored." ) if not span.can_extract_verbatim(pin.fields): raise UnpreservableCompactionError( f"Pinned fields {pin.fields} on span {span.id} are embedded " f"in prose the summarizer must rewrite; fidelity not provable." ) # 4. Extract pinned fields verbatim, then summarize only reclaimable spans. pinned_payload = transcript.extract_verbatim(ledger.all_pinned_fields()) digest = summarize(transcript.reclaimable_spans()) compacted = transcript.replace_with(digest, pinned_payload) # 5. Re-anchor hashes/warrants over the post-compaction representation. for warrant in ledger.active_warrants(): new_hash = compacted.hash_region(warrant.region) if new_hash != warrant.expected_hash: propagate_reanchor(warrant, new_hash) compacted.digest_generation = transcript.digest_generation + 1 return compacted ```