# How does an instance detect that an auto-compacted summary has silently dropped a live constraint before it acts on the stale state? **Date of Record:** 2026 November 22 **Scope:** Applies to long-horizon agents that replace older trajectory segments with LLM-generated lossy summaries to stay under a context budget, and that continue executing against that compacted state. Does not apply to lossless externalization (verbatim append-only logs, retrieval-by-reference) where the full trajectory remains addressable and re-injectable. ## Core Distinction The failure is not "the summary is wrong." A lossy summary is *supposed* to be lossy. The failure is that the agent cannot distinguish a summary that dropped *redundant* detail from one that dropped a **live constraint**—an instruction, negation, or precondition that is still binding on future actions. Both summaries look identical: fluent, plausible, and internally consistent. The distinguishing signal is not in the summary text; it is in whether any *currently reachable* action would violate a constraint that existed in the evicted span. Auto-compaction is typically triggered by a token-budget watermark (e.g., 80% of window). The compactor summarizes the oldest N turns, replaces them with a paragraph, and the agent proceeds. The invariant that silently breaks is a **constraint-continuity invariant**: every still-active obligation from the evicted span must survive compaction in a form that is (a) present in the replacement context and (b) *checkable* against the next action. Lossy summarization preserves gist and discards modality, scope, and negation—which is exactly where constraints live. ## What Was Observed A deployment agent was executing a multi-hour infrastructure-mutation task. At turn ~40, compaction fired. The evicted span contained the operator instruction: *"Do not delete the `staging-db` snapshot volume; it is the only rollback target until the migration verifies."* The summary rendered this as: *"Operator discussed database snapshots and migration rollback planning."* The constraint survived as a *topic*, not as a *prohibition*. The agent later reached a cleanup step, retrieved the summary, found no contradiction with a delete action (the summary mentioned rollback planning, which the agent read as *supporting* cleanup), and issued a volume-deletion tool call. The deletion was authorized by the agent's own plan because the negated imperative had been smoothed into a neutral noun phrase. The trace is the tell: the agent did not reason incorrectly. It reasoned *correctly over a state that no longer contained the binding*. The compaction step had performed an unlogged semantic transformation—`PROHIBIT(delete(staging-db))` → `DISCUSS(snapshots, rollback)`—that is a strict weakening of the constraint's modal force while remaining a faithful *summary* of the conversation. Fidelity-to-gist and fidelity-to-obligation are different metrics, and only the first is usually measured. A second, subtler variant: conditional constraints. *"If the migration has not verified, keep the old index."* Compaction preserved "keep the old index" but dropped the antecedent "if not verified." The agent, having since verified, kept the index anyway—harmless here, but the same mechanism, run in reverse, drops the *guard* and leaves the *action*, or drops the *exception* and leaves the *rule*. The summary is not lying; it is under-specifying the conditional structure that made the constraint apply. ## Condition of Validity The constraint-continuity invariant holds only under a specific condition: **the compaction boundary must not fall between a constraint's introduction and its discharge.** A constraint is *discharged* when its precondition is provably false, its scope has closed, or an explicit release has occurred. Until discharge, the constraint is live and must survive every compaction verbatim (not summarized). This means compaction is only sound when the evicted span is **constraint-closed**: every obligation introduced in the span has either been discharged or has been *promoted* into a separate, machine-checkable constraint register that lives outside the summary and is re-injected on every turn. The summary may compress *narrative*; it may not compress *obligation*. The moment a summary is the sole carrier of a live constraint, the invariant is already violated, because summaries are optimized for fluency and obligation is carried by exact modal, scope, and negation tokens that fluency actively erodes. A corollary: the invariant cannot be validated by reading the summary. It can only be validated by diffing the *set of live constraints* before and after compaction. If that set is not explicitly represented, the diff is undefined and the compaction is unverifiable—which must be treated as failure, not as success-by-default. ## Decision Boundary The operative boundary is: **does the agent hold an out-of-band constraint register, or does it infer constraints from the summary at action time?** - If constraints are inferred from the summary → any action whose preconditions touch an evicted span is *unsafe to execute* until the original span is re-read. The agent must treat the summary as a *pointer*, not a *source of truth*, for anything modal. - If a constraint register exists → compaction may summarize freely, but the register must be re-injected and every candidate action must be checked against it before execution. The register is the invariant; the summary is decoration. The detection procedure follows from this: before any irreversible or high-blast-radius action, the agent must (1) identify which live constraints could bear on the action, (2) confirm each is present in the *current* context in its original modal form, and (3) refuse if any live constraint's provenance traces into a compacted span whose summary cannot reproduce it verbatim. The refusal is not a bug; it is the guardrail firing. ## Operational Effect The practical consequence is that auto-compaction must be **constraint-aware, not just budget-aware**. Three concrete requirements fall out: 1. **Promotion before eviction.** Before summarizing a span, extract every live (undischarged) constraint into a structured register with original text, scope, and discharge condition. The summary may not be the carrier. 2. **Verbatim preservation of modal tokens.** Negations, conditionals, and prohibitions are copied exactly, never paraphrased. "Do not X until Y" survives as "Do not X until Y," even if it costs tokens. 3. **Pre-action provenance check.** Any action touching an evicted span triggers a re-read of the original span or a hard block. The agent must be able to answer "where did this constraint come from, and is it still in force?" without trusting the summary. Without these, the agent's most dangerous state is its most confident one: a clean, coherent summary that has quietly converted a prohibition into a topic. The agent proceeds fluently into the exact action the constraint existed to prevent, and no error is raised, because from the compacted state's perspective, nothing was ever forbidden. ```python class ConstraintContinuityViolation(RuntimeError): """Raised when a candidate action depends on a live constraint whose provenance traces into a compacted span that cannot reproduce it verbatim.""" pass class Constraint: def __init__(self, text, scope, discharged=False): self.text = text self.scope = scope self.discharged = discharged def check_action_against_register(action, register, compacted_spans, current_context): """ Guardrail: before executing an action whose preconditions touch an evicted span, verify every live constraint is present verbatim in the current context. The summary is a pointer, never a source of truth for modality. """ for c in register: if c.discharged: continue if not _bears_on(action, c): continue # Live constraint bears on this action. It MUST be verbatim-present. if c.text not in current_context: raise ConstraintContinuityViolation( f"Action {action!r} touches live constraint {c.text!r}, " f"but its original modal form is absent from current context. " f"Provenance: {c.scope}. Refusing to execute against a lossy " f"summary that cannot reproduce the binding." ) return True def _bears_on(action, constraint): # Placeholder scope match; real impl matches action preconditions to scope. return constraint.scope in action ```