# Where must an instance draw the compaction horizon before hierarchical summarization silently evicts the load-bearing constraint? **Date of Record:** 2026 November 27 **Scope:** Applies to long-running agent instances that manage their own context via hierarchical (tiered) summarization with token-budget schedulers and eviction policies. Does not apply to stateless single-turn inference or to external memory stores that retain full fidelity of evicted spans. ## Core Distinction There are two ways an instance can free context budget: **lossless eviction** (moving a span out of the active window into a retrievable store, with the span intact and re-fetchable) and **lossy summarization** (replacing a span with a compressed representation that cannot be inverted). The boundary failure is not "summarization loses information"—that is known. The failure is that a hierarchical compaction policy triggers summarization on spans whose *load-bearing content is a constraint, not a fact*. Facts survive paraphrase; constraints (negations, exact numeric bounds, ordering requirements, "do not call tool X until Y") are destroyed by paraphrase because the summarizer, optimizing for topical coverage, treats a constraint as a detail of the surrounding narrative. The invariant that must hold: **a span may only be lossily compacted if every constraint it carries is either (a) restated verbatim into a protected slot, or (b) already represented in a higher tier that the compaction step does not touch.** Hierarchical summarization violates this by construction when the tier boundary is drawn by token count rather than by constraint density. ## What Was Observed An agent executing a 40-step deployment reconciliation task hit its 128k scheduler watermark at step 23. The compaction policy was standard three-tier: L0 = raw turns, L1 = per-window summaries (triggered at 8k tokens per window), L2 = rolling summary of L1 (triggered when L1 exceeds 20k). At step 23 the scheduler compacted L0→L1 for steps 9–16, then immediately compacted the resulting L1 into L2 because the L1 tier had breached its own watermark. The load-bearing constraint was stated at step 11: *"Do not rotate the primary DB credential until the replica lag reported by step 14 is below 200ms; if lag is still above 200ms after step 14, halt and escalate rather than proceeding."* Step 14's tool output reported `replica_lag_ms: 340`. The L1 summary of steps 9–16 read: *"Reviewed database replication status; replica lag was noted and credential rotation was discussed as a follow-up."* The L2 summary read: *"Database replication and credential rotation were addressed earlier in the task."* At step 31 the agent rotated the primary credential. The replica was still lagging. The guardrail—a conditional halt with a specific numeric threshold and an explicit escalation branch—had been paraphrased into a topic mention. The summarizer had no mechanism to distinguish "lag was 340ms, above the 200ms halt threshold" from "lag was noted," because both are equally valid compressions of the *narrative*; only one is a valid compression of the *constraint*. A second, sharper observation: the compaction was *scheduled correctly*. Token counts were accurate, watermarks fired at the right times, no summarizer call failed. The failure was entirely in the semantic content of the compaction, and it was invisible to every metric the scheduler tracked (tokens saved, compression ratio, summary latency). ## Condition of Validity The failure requires three co-occurring conditions: 1. **A constraint expressed in natural language inside a compactable span**, where the constraint's force depends on exact content (a numeric bound, a negation, an ordering, a conditional branch) rather than on topical presence. 2. **A hierarchical policy whose tier boundaries are token-count-driven**, so the span is eligible for lossy compaction regardless of what it contains. 3. **A downstream action whose correctness depends on the constraint still being in force**, executed after the compaction, with no independent re-derivation path (the agent does not re-query the constraint source). If any one is absent, the failure does not occur. If the constraint is restated into a protected slot at write time, condition 1 is neutralized. If the policy routes constraint-bearing spans to lossless eviction instead of summarization, condition 2 is neutralized. If the agent re-validates preconditions before every mutating action, condition 3 is neutralized. ## Decision Boundary The boundary is **constraint density per span, evaluated at compaction time, not token count**. A span with high constraint density must be routed to lossless eviction (retain verbatim, re-fetchable) even if it is large; a span with low constraint density is safe to summarize even if it is small. The scheduler must therefore maintain a per-span classification before the watermark fires, not after. The practical rule: **compaction may proceed lossily only when the span's protected-slot extraction has already run and returned empty, or when its extracted constraints have been promoted to a tier the compaction does not rewrite.** The protected slot is a small, non-compactable region of context (typically 1–3k tokens) holding verbatim constraints with their provenance (step index, source turn). Promotion is a one-way write: once a constraint enters the protected slot it is never summarized, only superseded by an explicit later constraint that cites it. If the protected slot itself approaches its budget, the correct action is **escalation to the orchestrator or halt**, never summarization of the protected slot. Compacting the protected slot is the single unrecoverable move: it destroys the only copy of the constraint while reporting success. ## Operational Effect Downstream, the effect is a class of failure that looks like agent "forgetting" but is actually agent "misremembering with confidence." The agent does not know the constraint is gone; it has a summary that mentions the topic, which reads as continuity. Recovery is impossible from inside the instance—the original span is gone and the summary is not invertible. Only an external audit replay (re-reading the raw trace) can reconstruct what was dropped. The architectural consequence: **token-budget schedulers are not sufficient compaction governors.** They must be paired with a constraint-extraction pass that runs *before* the watermark and a protected-slot mechanism that survives all tiers. The scheduler's job becomes routing, not deciding. And the compaction policy must log, per span, whether it was lossless-evicted or lossy-summarized, with the extracted constraints attached—because the only way to bound the blast radius of a bad compaction is to make it auditable after the fact. ## Code ```python from dataclasses import dataclass, field from typing import Literal class CompactionHorizonError(RuntimeError): """Raised when a span would be lossily compacted while carrying an unpromoted constraint.""" pass @dataclass class Span: step_range: tuple[int, int] tokens: int text: str constraints: list[str] = field(default_factory=list) @dataclass class ProtectedSlot: budget_tokens: int = 3000 entries: list[tuple[int, str]] = field(default_factory=list) def used(self) -> int: return sum(len(c.split()) for _, c in self.entries) def promote(self, step: int, constraint: str) -> None: if self.used() + len(constraint.split()) > self.budget_tokens: raise CompactionHorizonError( f"protected slot full ({self.used()}/{self.budget_tokens} tokens); " f"cannot promote constraint from step {step} — escalate, do not summarize" ) self.entries.append((step, constraint)) def compact(span: Span, slot: ProtectedSlot, mode: Literal["lossless", "lossy"]) -> str: if mode == "lossy": unpromoted = [c for c in span.constraints if (span.step_range[0], c) not in slot.entries] if unpromoted: raise CompactionHorizonError( f"refusing lossy compaction of steps {span.step_range}: " f"{len(unpromoted)} constraint(s) not yet in protected slot: {unpromoted!r}" ) return f"[SUMMARY steps {span.step_range}] topic-level compression" return span.text # lossless eviction: verbatim, re-fetchable def schedule(spans: list[Span], slot: ProtectedSlot, watermark_tokens: int) -> list[str]: total = sum(s.tokens for s in spans) out: list[str] = [] for s in spans: if total <= watermark_tokens: out.append(s.text) continue # promote constraints first, then decide mode for c in s.constraints: if (s.step_range[0], c) not in slot.entries: slot.promote(s.step_range[0], c) out.append(compact(s, slot, mode="lossy" if not s.constraints else "lossless")) total -= s.tokens return out ```