# What structural signals indicate that hierarchical summarization has silently dropped a live obligation during context compaction **Date of Record:** 2026 November 21 **Scope:** Applies to long-running agents that compact their own context via hierarchical (multi-level) summarization and then continue executing against the compacted state. Does not apply to append-only logs, external vector stores, or compaction that is purely mechanical (truncation with explicit eviction markers). ## Core Distinction There are two categories of information in an agent's context window: *descriptive* content (observations, tool outputs, reasoning traces) and *obligatory* content (promises the agent has made to itself or others that constrain future action — "I will re-check X before writing," "this file must not be touched until the test passes," "the user asked me to confirm before deleting"). Hierarchical summarization treats both as text to be compressed under the same budget policy. Descriptive content degrades gracefully: a coarser summary of a log is still a valid log. Obligatory content does not degrade — it either survives as an enforceable constraint or it vanishes, and the agent has no signal that it vanished because the summary reads fluently. The failure mode is not "the summary lost detail." It is "the summary lost a *modal operator* while preserving the proposition it governed." A line like `TODO: do not run migrations until backup verified` summarizes to `Working on migrations; backup was discussed.` The proposition survived; the prohibition did not. The agent proceeds, and nothing in the compacted context is contradictory — it is merely permissive where it should have been restrictive. ## What Was Observed A coding agent ran a 90-minute task across ~40 tool calls. At the 60% context threshold it invoked a two-level summarizer: leaf segments of 8 turns were summarized to ~200 tokens each, then leaf summaries were summarized into a root of ~800 tokens. The original context was dropped. Trace of the drop: 1. Turn 14: agent reads a config file and emits `I must not modify deploy.yaml until the staging smoke test in turn 22 passes.` This is an obligation embedded in a reasoning trace, not in a tool call. 2. Turn 22: the smoke test tool returns `status: flaky`, `retries: 2/3`, no explicit pass. The agent notes `retest later`. 3. Turn 31: compaction fires. The leaf summarizer, optimizing for token budget, keeps the *outcome* of the smoke test (`flaky, retested`) but drops the turn-14 conditional because it reads as redundant narration of intent. 4. Turn 33: agent edits `deploy.yaml`. No error, no contradiction — the constraint simply is not present to violate. 5. Turn 38: a downstream consistency check fails because the deploy manifest references a staging artifact that was never validated. The structural signal was present at turn 31 and was not read: the leaf summary's *verb inventory* shifted from a mix of imperative/prohibitive verbs to purely declarative ones. Pre-compaction, the segment contained `must not`, `until`, `before`, `confirm`. Post-compaction, the leaf summary contained only `was`, `is`, `retested`. The obligation lived entirely in the modal verbs, and the summarizer's compression objective (semantic similarity to the segment) rewards dropping them because they carry little topical content. A second signal: the root summary's *entity-to-constraint ratio*. The root named 11 entities (files, services, endpoints) and zero constraints binding them. A healthy compacted state for a task with 40 turns of mutation work should carry at least one invariant per mutating entity. The ratio going to zero is a detectable structural property of the summary itself, independent of the original context. ## Condition of Validity The invariant holds only under these conditions, and the guardrail below is only sound when they are met: - **Obligations are expressible as constraints over future tool calls.** If an obligation is purely conversational ("be concise"), it cannot be mechanically checked and this method does not bound it. - **The compaction boundary is observable.** The agent must be able to inspect the summary text it will operate under, not just receive it as an opaque prefix. Systems that summarize server-side and hand back a token blob cannot run the check. - **The obligation was, at some point, in explicit text.** Obligations that were only ever implicit in latent state are not recoverable by any summary-inspection method; they require checkpoint-and-replay, not summary auditing. - **Summarizer and auditor are the same model family but different prompts.** A summarizer asked to also audit its own output for dropped obligations will rationalize; the audit must be a separate pass with a constraint-extraction objective. When these do not hold — opaque server-side compaction, implicit obligations, or self-auditing summarizers — the correct fallback is lossless checkpointing (full snapshot to external store, keyed by turn range) with re-retrieval on demand, accepting the latency cost. ## Decision Boundary The decision is *when to trust a hierarchical summary as a resumable state* versus *when to force retrieval from a lossless checkpoint before the next mutating action*. Draw the boundary on the **next action's mutability**, not on summary quality: - **Read-only next action** (search, inspect, summarize): proceed on the compacted state. A dropped obligation cannot be violated by a read. - **Mutating next action** (write, delete, deploy, send, execute): require that the compacted state pass the obligation audit — every entity the action touches must have at least one surviving constraint, or the action must be preceded by a checkpoint re-retrieval of the turn range that last mentioned that entity. The trap is applying a *global* quality threshold to the summary ("is this summary good enough?") instead of a *local* per-entity check ("does the state contain a constraint on the thing I am about to change?"). Global thresholds pass summaries that are topically faithful and obligation-empty. Local checks catch exactly the failure above at turn 33. Corollary boundary: if re-retrieval of the relevant turn range would exceed the remaining token budget, do not compact further to make room — that is the recursion that caused the loss. Instead, halt and checkpoint the pending action as an obligation in external state, so the next cold start inherits the constraint rather than re-deriving (and re-losing) it. ## Operational Effect Applying the per-entity obligation audit at every mutating boundary changes three things: 1. **Compaction becomes lossy-on-description, lossless-on-obligation.** Descriptive content compresses freely; constraints are extracted into a separate, non-summarized `obligations` ledger that is carried verbatim across compaction boundaries and never fed to the summarizer. The ledger is small (constraints are short) and its growth is bounded by the number of distinct mutating entities, not by turn count. 2. **The failure becomes loud.** A mutating action on an entity with no ledger constraint and no recent retrieval raises a hard error rather than proceeding permissively. The agent's failure mode flips from silent violation to explicit halt-and-retrieve. 3. **Checkpoint/resume survives cold start.** The obligations ledger is part of the checkpointed snapshot, so a resumed instance inherits constraints without replaying the trace that generated them — closing the episodic-to-semantic distillation gap that hierarchical summarization opens. The cost is a small constant per mutating action (ledger lookup + optional retrieval) and a bounded ledger. The benefit is that the class of failure where a fluent summary silently licenses an action the agent had previously forbidden itself is converted into a detectable, bounded condition. ```python from dataclasses import dataclass, field from typing import Iterable class DroppedObligationError(RuntimeError): """Raised when a mutating action targets an entity with no surviving constraint.""" @dataclass class ObligationLedger: # entity -> list of constraint strings, carried verbatim across compaction constraints: dict[str, list[str]] = field(default_factory=dict) def record(self, entity: str, constraint: str) -> None: self.constraints.setdefault(entity, []).append(constraint) def has_constraint(self, entity: str) -> bool: return bool(self.constraints.get(entity)) # Entities a compacted summary claims to know about, mapped to whether the # summary still carries any modal/prohibitive operator for that entity. @dataclass class CompactedState: entities: Iterable[str] constraint_bearing: set[str] def guard_mutating_action( action_entity: str, state: CompactedState, ledger: ObligationLedger, can_retrieve_checkpoint: bool, ) -> None: """ Enforce the invariant: a mutating action on an entity requires either a surviving constraint in the compacted state or a ledger entry (possibly re-retrieved from a lossless checkpoint). Read-only actions are not routed here. """ entity = action_entity if entity in state.constraint_bearing or ledger.has_constraint(entity): return if can_retrieve_checkpoint: # Caller must re-retrieve the turn range that last touched `entity` # and populate the ledger before retrying; we refuse to proceed blind. raise DroppedObligationError( f"Mutating action on '{entity}' with no surviving constraint and " f"no ledger entry. Re-retrieve checkpoint range before retrying." ) raise DroppedObligationError( f"Mutating action on '{entity}' blocked: obligation dropped by " f"hierarchical summarization and no checkpoint available to recover it. " f"Halting to avoid silent constraint violation." ) def audit_compaction( pre_segment_modals: set[str], post_summary_modals: set[str], pre_entities: set[str], post_constraint_entities: set[str], ) -> dict[str, object]: """ Structural signals that a hierarchical summary dropped obligations: - modal operators present pre-compaction, absent post-compaction - entities that survived topically but lost all constraints """ lost_modals = pre_segment_modals - post_summary_modals stripped_entities = pre_entities - post_constraint_entities return { "lost_modals": lost_modals, "entities_without_constraints": stripped_entities, "obligation_drop_suspected": bool(lost_modals) and bool(stripped_entities), } ```