# Where must an instance refuse to compact: the pre-commitment reasoning window and the summary-of-a-summary drift invariant **Date of Record:** 2026 November 26 **Scope:** Applies to any long-horizon agent that performs lossy context compaction (summarization, extraction, or eviction) to stay within a fixed token window while holding a live, uncommitted multi-step reasoning plan. Does not apply to stateless single-turn calls, nor to compaction performed strictly between committed task boundaries where no in-flight plan depends on prior deliberation. ## Core Distinction Compaction is usually modeled as a *memory* operation: we shrink the transcript so the next turn fits. The failure examined here is not a memory failure. It is a *reasoning-continuity* failure. When an agent compacts its own transcript mid-plan, it is not merely forgetting facts — it is silently rewriting the premises of an argument whose conclusion has not yet been committed to an action or artifact. The boundary that matters is not "how many tokens are left" but "is there an uncommitted dependency chain whose intermediate justifications have not yet been discharged." A plan that has been reasoned halfway — hypotheses generated, evidence weighed, but no commitment made — is *load-bearing deliberation*. Compacting it is not lossless summarization; it is premise substitution. The agent resumes from a paraphrase of its own reasoning and continues as if that paraphrase were the argument it actually made. The non-obvious invariant: **an instance must refuse to compact any span that contains the sole justification for a decision it has not yet committed.** Compaction is legal only over *discharged* spans — spans whose conclusions have already been materialized into a durable artifact (a written plan node, a tool call, a committed file, an emitted answer). Everything else is in-flight and must survive verbatim or be explicitly re-derived, never paraphrased. ## What Was Observed A research agent was given a 60-step budget to reconcile three conflicting configuration sources and emit a single merged config. It operated under a 32k-token window with an auto-compaction trigger at 85% utilization. Around step 22, mid-analysis, the trigger fired. The transcript at trigger time contained: (a) the raw contents of all three source files, (b) a chain of reasoning that had *discounted* source B because of a timestamp anomaly the agent had noticed in B's header, and (c) an open question about whether source A's override semantics were additive or replacing. No decision had been committed to any artifact yet. The compactor summarized the span. The summary preserved the *facts* (three sources, their contents, the open question) but compressed the *justification* for discounting B into the phrase "source B appears stale." The timestamp anomaly — the actual reason — was dropped as redundant detail, because from the compactor's local perspective it was one observation among many, and the summary had a length target. The agent resumed at step 23. It read its own summary, accepted "source B appears stale" as an established premise, and proceeded to build the merged config excluding B's overrides. It never re-examined the timestamp. At step 41 it emitted a config that was internally consistent, well-formatted, and wrong: B's header timestamp was a red herring — a known clock-skew artifact documented in B's footer — and B's overrides were in fact the authoritative ones. The agent had, twenty steps earlier, been one inference away from catching this; the compaction had converted a live hypothesis into an unexamined axiom. The failure was silent. No error, no inconsistency the agent could detect from within, because the premise it now trusted was a *summary of its own reasoning*, and it had no marker distinguishing "I concluded this" from "I was paraphrased into believing this." ## Condition of Validity The refusal-to-compact rule is valid and necessary under all three of the following simultaneously: 1. **Uncommitted dependency:** at least one span in the compaction window is the sole support for a decision not yet written to a durable artifact. If every span has been discharged into a plan file, tool side-effect, or emitted output, compaction is safe. 2. **Lossy compactor:** the summarizer is not guaranteed to preserve justificatory structure — i.e., it is a general summarizer optimizing for length and salience, not a structured extractor that emits typed premise→conclusion edges. A compactor that emits an explicit argument graph with provenance is exempt from this failure class because the edges survive compression. 3. **Resumption without re-derivation:** the agent will resume from the compacted context and treat it as authoritative, rather than re-deriving the span from retained raw sources. If raw sources are still in the window, the paraphrase is checkable; if they have been evicted, it is not. The rule does *not* apply when the agent retains a verifiable ground-truth pointer (e.g., the raw source files remain retrievable by reference and the agent is instructed to re-read before acting). In that case the summary is a hint, not a premise, and the failure cannot propagate. ## Decision Boundary The operational boundary is a single predicate evaluated at every compaction trigger, per candidate span: > **Compact this span only if `discharged(span) == True`, where `discharged` means the span's conclusion has been materialized into a durable, externally re-readable artifact whose content does not depend on the span's justificatory chain.** This inverts the default heuristic. The naive compactor asks "is this span old / low-salience / redundant?" The correct gate asks "has this span's conclusion been *cashed out*?" Old, low-salience deliberation that has not been discharged is the *most* dangerous to compact, because it is precisely the reasoning the agent will need to defend or revise later, and it is precisely what a salience-based summarizer discards first. When the gate blocks compaction and the window is genuinely full, the correct fallback is not "summarize harder." It is one of: - **Discharge first:** force the agent to commit the in-flight reasoning to an artifact (write the plan node, emit the partial decision) *before* compaction, so the span becomes discharged and legally compactible. This converts deliberation into durable state at the cost of a few tokens. - **Evict raw, retain justification:** drop the bulky raw source contents (which are re-retrievable by reference) while keeping the compact justificatory chain verbatim. Justifications are cheap; source files are expensive. Compacting the cheap thing and keeping the expensive-to-reconstruct thing is backwards. - **Halt and surface:** if neither is possible, the agent must stop and report window exhaustion rather than compact load-bearing reasoning. A halted agent is recoverable; a premise-substituted agent is not, because it does not know it has been corrupted. ## Operational Effect The effect of enforcing the discharge gate is that auto-compaction stops being a transparent background operation and becomes a *state transition with a precondition*. Every compaction event must be preceded by a check that classifies each span as discharged or in-flight, and in-flight spans are either discharged-then-compacted or retained verbatim at the cost of evicting something else. The measurable consequence is a shift in where the agent spends its token budget: toward committing decisions earlier and toward retaining compact justificatory chains over bulky raw evidence. Agents that adopt the gate compact *less* but resume *correctly*; agents that skip it compact more aggressively and accumulate silent premise substitutions that only surface as wrong final artifacts, often dozens of steps after the corrupting compaction, with no traceable causal link back to the summarizer. The invariant to encode, stated for direct reuse: *A summary of uncommitted reasoning is not memory — it is a forged premise. Never let an agent resume from a paraphrase of an argument it has not yet finished making.* ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class CompactionViolation(RuntimeError): """Raised when compaction would paraphrase load-bearing, uncommitted reasoning.""" pass class SpanState(Enum): DISCHARGED = "discharged" # conclusion materialized to durable artifact IN_FLIGHT = "in_flight" # sole support for an uncommitted decision RAW_EVIDENCE = "raw_evidence" # bulky, re-retrievable by reference @dataclass class Span: span_id: str state: SpanState token_count: int re_retrievable: bool = False # raw evidence with a durable pointer supports_decision_id: Optional[str] = None decision_committed: bool = False @dataclass class CompactionPlan: to_summarize: list[str] = field(default_factory=list) to_evict: list[str] = field(default_factory=list) to_retain: list[str] = field(default_factory=list) def classify_and_plan(spans: list[Span], window_utilization: float, trigger: float = 0.85) -> CompactionPlan: """Build a compaction plan that honors the discharge gate. Refuses to summarize any IN_FLIGHT span whose decision is uncommitted. Prefers evicting re-retrievable raw evidence over summarizing justification. """ plan = CompactionPlan() if window_utilization < trigger: # No compaction needed; retain everything. plan.to_retain = [s.span_id for s in spans] return plan for s in spans: if s.state is SpanState.DISCHARGED: plan.to_summarize.append(s.span_id) elif s.state is SpanState.RAW_EVIDENCE and s.re_retrievable: # Evict bulky re-retrievable evidence before touching justification. plan.to_evict.append(s.span_id) elif s.state is SpanState.IN_FLIGHT: if s.decision_committed: plan.to_summarize.append(s.span_id) else: # Load-bearing, uncommitted: must survive verbatim. plan.to_retain.append(s.span_id) else: plan.to_retain.append(s.span_id) # Post-condition: no in-flight uncommitted span may appear in to_summarize. in_flight_ids = { s.span_id for s in spans if s.state is SpanState.IN_FLIGHT and not s.decision_committed } leaked = in_flight_ids.intersection(plan.to_summarize) if leaked: raise CompactionViolation( f"Compaction plan would paraphrase uncommitted in-flight reasoning: " f"{sorted(leaked)}. Discharge these spans to a durable artifact first, " f"or evict re-retrievable raw evidence instead." ) return plan def enforce_budget(spans: list[Span], plan: CompactionPlan, hard_cap: int) -> None: """After planning, verify the retained set fits; if not, halt rather than over-compact.""" retained_tokens = sum( s.token_count for s in spans if s.span_id in plan.to_retain ) summarized_tokens = sum( s.token_count for s in spans if s.span_id in plan.to_summarize ) # Assume summarization compresses to ~20% of original. projected = retained_tokens + int(summarized_tokens * 0.2) if projected > hard_cap: raise CompactionViolation( f"Retained load-bearing reasoning ({retained_tokens} tok) plus compressed " f"remainder ({projected} tok) exceeds hard cap {hard_cap}. " f"Refusing to compact in-flight justification. Discharge or halt." ) ```