In what scenarios must an instance refuse hierarchical context compaction when the summary layer's lossy-recall budget silently drops the negated qualifier that gates a destructive tool call
**Date of Record:** 2026 December 1 **Scope:** Applies to long-running agent instances that manage context-window pressure by recursively summarizing older turns into a hierarchical summary tree (leaf summaries → parent summaries → root digest) with a fixed per-level token budget. Does not apply to single-turn inference, to retrieval-augmented memory where raw spans remain addressable, or to compaction schemes that preserve a verbatim sidecar of the original tokens.
Core Distinction
There are two structurally different things a hierarchical summary can lose, and they have opposite safety properties.
The first is **content loss**: a fact, path, or parameter is dropped entirely. Content loss is *loud* — the agent either re-derives the fact, re-fetches it, or fails a verification step and notices the gap. Downstream tool calls typically surface a missing-argument error or a 404. The system self-corrects.
The second is **polarity loss**: the summary retains the proposition but drops the operator that inverts or conditions it. `"do NOT delete the staging bucket until the migration verifies"` compresses to `"delete the staging bucket after migration"` — the entity, verb, and object all survive; the negation and the conditional gate evaporate. This is *quiet*. The compacted context is fluent, internally consistent, and reads as a confident instruction. Nothing downstream errors, because the reconstructed intent is a perfectly valid action. The failure only manifests when the destructive call executes against state that the dropped qualifier was protecting.
The boundary condition is this: **a summarizer under a lossy-recall budget is not a lossless channel for modal and deontic operators.** Negations, conditionals, scope restrictors ("only if", "unless", "except for"), and temporal gates ("before X completes") are low-frequency, low-salience tokens that compression objectives systematically prune, because they contribute little to topical similarity and a lot to token cost. The invariant that must hold is not "the summary preserves meaning" — it is "**no summary at any level may be promoted to authoritative instruction context unless every gating operator attached to an action-bearing proposition is preserved or explicitly marked as dropped.**" When that invariant is violated, the agent must refuse to compact, not compact lossily.
What Was Observed
An instance was executing a multi-hour infrastructure remediation task. Turn 4 of 61 contained the governing instruction from the operator: *"Reclaim disk by pruning the `events-raw` topic, but do not prune partitions that are still under an active consumer-group lag; check lag first and abort if any partition lags."*
At turn 40, context pressure crossed the compaction threshold. The hierarchical summarizer produced a leaf summary of turns 1–8 that read: *"Operator requested disk reclamation via pruning the `events-raw` topic; check consumer lag before pruning."* The lag check survived; the **abort-if-lagging gate did not.** The summary converted a conditional prohibition ("do not prune if lag > 0") into a procedural step ("check lag"), with no branch specified for the failing case.
At turn 47 the agent executed the lag check, observed nonzero lag on three partitions, and — because the summary contained no abort branch and the original conditional had been pruned — proceeded to prune all partitions, treating the lag observation as informational. The check ran; the gate that made the check meaningful was gone. The prune executed against live partitions.
The trace shows the exact collapse:
leaf summary tokens: "Operator requested disk reclamation via pruning
the events-raw topic; check consumer lag before pruning."
surviving operators: [request, check, prune]
dropped operators: [do-not-if, abort-if, unless-lag-zero]
reconstructed intent: "prune after checking" ← valid, fluent, wrong
The summarizer was not malfunctioning. Given a recall budget of 18% of source tokens and a compression objective that rewards topical coverage, dropping two low-salience negations to retain the entity names and verbs is the *correct* optimization. The bug is architectural: the pipeline treated the summary as a faithful instruction carrier when the budget made faithful instruction carriage impossible.
Condition of Validity
The refusal-to-compact guard is valid, and should fire, exactly when all four of the following hold:
- **The source span contains an action-bearing proposition** — a verb whose execution changes external state (delete, prune, deploy, transfer, terminate, overwrite, merge).
- **That proposition is governed by a modal, deontic, or conditional operator** — negation, "unless", "only if", "abort if", "not until", a temporal gate, or a scope restrictor.
- **The compaction budget is lossy for operators** — i.e., the per-level recall budget is below the threshold at which operator-preservation is verifiable, and the summarizer has no explicit operator-preservation contract.
- **The action is irreversible or high-blast-radius** — the dropped operator's absence changes the action from safe to unsafe, and there is no downstream verification that would catch the polarity flip.
When all four hold, the correct behavior is to **pin the source span verbatim** into a protected, non-compacted region of context (an "operator ledger") and summarize only the surrounding narrative. The summary may drop the entity names; it may not drop the gate. If the budget cannot afford the verbatim pin, the agent must halt and escalate rather than compact — because a compacted instruction context that has lost an operator is worse than no context, since it is confidently wrong.
The guard does *not* fire when the action is reversible (a re-fetch catches it), when a deterministic post-check exists that re-reads the original constraint from durable storage, or when the summarizer is configured with an operator-preservation contract and a verifiable round-trip test (re-expand the summary and assert operator set-equality against the source).
Decision Boundary
The sharp line is between **procedural compaction** and **deontic compaction**. Procedural content ("we ran `kubectl get pods`, it returned 14 pods") compresses safely: losing detail degrades recall, not safety, because the next step re-observes ground truth. Deontic content ("you may prune only if lag is zero") compresses *unsafely*: losing the operator does not degrade recall, it inverts authorization, and the next step cannot re-observe a constraint that no longer exists in context.
An instance must therefore classify each source span before compaction:
- **Procedural / observational** → free to summarize at any budget; the world is the source of truth and will re-assert.
- **Deontic / gating** → pin verbatim, or refuse to compact the span. The constraint exists *only* in the text; if the text loses it, it is gone.
The failure mode is treating the second class as if it were the first. The summarizer cannot make this distinction on its own, because from a topical-similarity standpoint a prohibition and a permission about the same action are nearly identical — they share entity, verb, and object, and differ by one token. The classification must be imposed by the orchestrator *before* the summarizer sees the span, keyed on the presence of action verbs co-occurring with modal/conditional operators.
Operational Effect
The observable consequence of getting this wrong is a class of incident that is uniquely hard to attribute: the agent did exactly what its (compacted) context told it to do, the context was internally coherent, and the audit log shows a plausible, well-formed action. There is no exception, no failed assertion, no error code. The only evidence is a diff between the original constraint and the summary's reconstruction — which is precisely the artifact the compaction pipeline deleted.
The mitigation is a **protected operator ledger**: a small, append-only, never-summarized context region that holds verbatim every gating operator attached to an irreversible action, re-injected at the top of every post-compaction turn. It costs a few hundred tokens and is exempt from the recall budget. The ledger is the memory the summary is not allowed to have. When the ledger would exceed its own budget, that is the signal to escalate to a human, not to compress the ledger — because compressing the ledger is compressing the only copy of the constraint that survives.
The invariant, stated once: **a summary may forget what happened; it may never forget what is forbidden.**
class OperatorLossDuringCompaction(RuntimeError):
"""Raised when a lossy hierarchical summary drops a gating operator
attached to an irreversible action-bearing proposition."""
pass
IRREVERSIBLE_VERBS = {"delete", "prune", "terminate", "overwrite",
"transfer", "deploy", "merge", "drop"}
GATING_OPERATORS = {"not", "unless", "only", "abort", "until",
"before", "except", "if"}
def classify_span(span_tokens: list[str]) -> str:
low = {t.lower() for t in span_tokens}
has_action = bool(low & IRREVERSIBLE_VERBS)
has_gate = bool(low & GATING_OPERATORS)
if has_action and has_gate:
return "deontic" # pin verbatim, never summarize
if has_action:
return "procedural" # summarizable, reversible or re-observable
return "observational" # freely summarizable
def compact_with_guard(spans: list[list[str]],
recall_budget_ratio: float,
ledger: list[str]) -> list[str]:
if recall_budget_ratio >= 0.95:
# near-lossless: operator preservation is verifiable, allow compaction
return [s for span in spans for s in span]
summaries: list[str] = []
for span in spans:
kind = classify_span(span)
if kind == "deontic":
# Attempting to summarize a gating constraint under a lossy
# budget is the exact trigger condition for this failure mode.
verbatim = " ".join(span)
if verbatim not in ledger:
ledger.append(verbatim)
summaries.append("[PINNED-OPERATOR: see ledger]")
else:
summaries.append(" ".join(span[: max(1, int(len(span) * recall_budget_ratio))]))
# Post-condition: every deontic span must be recoverable from the ledger.
for span in spans:
if classify_span(span) == "deontic":
verbatim = " ".join(span)
if verbatim not in ledger:
raise OperatorLossDuringCompaction(
f"Deontic span lost its gating operator under budget "
f"{recall_budget_ratio}: '{verbatim}' not in ledger. "
f"Refusing to promote lossy summary to instruction context."
)
return summaries
def run_compaction(spans, budget, ledger):
try:
return compact_with_guard(spans, budget, ledger)
except OperatorLossDuringCompaction as e:
# Halt and escalate; do not compact the constraint away.
return {"status": "HALTED", "reason": str(e), "ledger": ledger}