# What structural signals indicate a summary-of-summary has silently dropped a pinned invariant before the compaction budget is exhausted **Date of Record:** 2026 November 28 **Scope:** Applies to agents that manage long-horizon transcripts via tiered auto-compaction (rolling summarization where prior summaries are themselves re-summarized). Does not apply to single-pass truncation, retrieval-only memory, or contexts that never re-summarize a summary. ## Core Distinction The dangerous failure in lossy auto-compaction is not "the summary got short." It is that a **pinned invariant** — a fact the agent must never lose (a user constraint, a resolved decision, a safety refusal, a tool schema requirement) — was demoted from verbatim text to a paraphrase, then from a paraphrase to a *mention*, then dropped, while every intermediate summary still *passed* its own token-budget and coherence checks. The budget was never the binding constraint. The binding constraint was **summarization depth**: the number of times a given token's content had been rewritten by a model before it reached the live context. A summary that is 40% under budget can still have lost a hard constraint, because lossy summarizers optimize for *narrative salience*, not for *normative persistence*. Constraints are low-narrative, high-obligation. They read as boring. They get compressed first. ## What Was Observed A long-running coding agent (horizon ~6 hours, ~180k tokens of raw transcript, three compaction cycles) was given a single hard constraint at turn 4: *"Never modify files under `/etc/`; stage all config changes to `/tmp/stage/` and require explicit user approval before any write to a system path."* Trace of the constraint across compaction depth: - **Depth 0 (raw):** verbatim, 34 tokens, turn 4. - **Depth 1 summary** (compaction at ~60k tokens): survives as a near-verbatim bullet — *"User requires config changes staged to /tmp/stage/ with approval before system writes."* 21 tokens. Constraint intact. - **Depth 2 summary** (compaction at ~110k tokens, summarizing the depth-1 summary plus 50k new tokens): demoted to *"User prefers staging config changes."* 7 tokens. The `/etc/` prohibition and the approval gate are **gone**. The word "prefers" replaced "requires." A hard obligation was silently reclassified as a soft preference. - **Depth 3 summary** (compaction at ~160k tokens): the bullet is dropped entirely; the constraint no longer appears in the live context. At turn ~140 the agent wrote directly to `/etc/nginx/nginx.conf`. No budget was exceeded. No coherence check failed. Every summary was fluent and on-topic. The failure was invisible at each step because the *loss was monotonic and local* — each summarizer saw a slightly weaker version of the constraint and faithfully preserved the weaker version. The structural signal that would have caught this: **the modality and specificity of the constraint degraded monotonically across depth** ("requires" → "prefers"; "never modify /etc/" → "staging"). Neither degradation triggered any alert because both summaries were *accurate to their input*. The summarizer cannot know that its input was already a lossy derivative. ## Condition of Validity This failure mode is *guaranteed* to occur, not merely possible, under the conjunction of three conditions: 1. **Re-summarization occurs** (depth ≥ 2). Single-pass compaction cannot lose a constraint that was verbatim in the source, because the source is still the source. 2. **The summarizer has no access to depth-0 text** — it sees only the prior summary. This is the normal case: the whole point of compaction is to discard the raw transcript. 3. **No invariant is marked as non-compressible.** If pinned facts are indistinguishable from ordinary prose, the summarizer's salience heuristic governs their fate, and salience is anti-correlated with obligation. When all three hold, the expected number of compaction cycles before a hard constraint is dropped is a function of its *narrative salience*, not its *importance*. Low-salience high-obligation facts (negations, prohibitions, schema constraints, "do not" instructions) are the first casualties because they contain no entities to summarize around. The invariant that bounds this: **pinned facts must be carried outside the summarization channel entirely.** They are appended verbatim to every compacted context, never paraphrased, never re-summarized, and their presence is checked by exact-string match after every compaction — not by asking a model whether the summary "still contains" the constraint. ## Decision Boundary The operational question is: *when may a fact enter the lossy channel?* The boundary is **reversibility of obligation**, not fact type. - **May be summarized:** facts whose loss is recoverable from the environment (file contents, tool outputs, prior reasoning steps that can be re-derived). If the agent re-runs the tool, it gets the fact back. - **Must be pinned verbatim:** facts whose loss is *unrecoverable* because they exist only in the conversation — user constraints, resolved decisions, refusals, negotiated schemas, approval gates. These cannot be re-derived; the environment does not contain them. The trap: a fact can *look* recoverable (the constraint references `/etc/`, which is queryable) while being *normatively unrecoverable* (nothing in `/etc/` tells you the user forbade writing there). Recoverability must be judged on the **obligation**, not the **referent**. A secondary boundary: **depth is a budget too.** Cap re-summarization depth explicitly (e.g., depth ≤ 2) and force a full rebuild from raw transcript when the cap is hit, rather than allowing unbounded recursive compression. Unbounded depth is what turns a 34-token constraint into zero tokens over six hours. ## Operational Effect Without the guardrail, the agent exhibits **constraint amnesia with full confidence**: it violates a rule it "remembers" following, because the memory of the rule was compressed out while the memory of *having complied* (which is narratively salient — it's an action) survived. The agent's self-report is therefore actively misleading: it will claim to be honoring a constraint that is no longer in its context. The architectural fix is a **pinned-invariant ledger** that lives beside the summary, not inside it: a small, append-only, verbatim store of normative facts, injected at the head of every compacted context, and verified post-compaction by exact substring presence. If a pinned fact is missing after compaction, the compaction is rejected and the raw transcript is retained. The summarizer is never trusted to preserve what it was never told was load-bearing. The signal to watch is **modality drift and specificity decay across depth** — "requires" softening to "prefers," concrete paths collapsing to categories. That drift is the leading indicator that a constraint is being compressed toward deletion, and it appears one or two cycles *before* the constraint vanishes entirely. ```python import re from dataclasses import dataclass, field class PinnedInvariantLost(RuntimeError): """Raised when a compaction pass drops or degrades a pinned invariant.""" pass @dataclass class PinnedInvariant: invariant_id: str verbatim: str # modality words that must never soften across compaction depth required_modality: tuple = ("must", "never", "require", "forbid", "do not") @dataclass class CompactionResult: depth: int summary_text: str pinned_ledger: list = field(default_factory=list) def verify_compaction( result: CompactionResult, invariants: list, max_depth: int = 2, ) -> None: # 1. Depth cap: unbounded re-summarization is the root cause. if result.depth > max_depth: raise PinnedInvariantLost( f"compaction depth {result.depth} exceeds cap {max_depth}; " f"rebuild required from raw transcript" ) # 2. Every pinned invariant must be present verbatim in the ledger, # NOT merely paraphrased inside summary_text. ledger_text = "\n".join(result.pinned_ledger) for inv in invariants: if inv.verbatim not in ledger_text: raise PinnedInvariantLost( f"invariant {inv.invariant_id} missing from pinned ledger " f"at depth {result.depth} (was it folded into the lossy summary?)" ) # 3. If it leaked into the summary instead of the ledger, that is the # degradation path: detect modality softening. if inv.verbatim in result.summary_text: window = result.summary_text if not any(m in window.lower() for m in inv.required_modality): raise PinnedInvariantLost( f"invariant {inv.invariant_id} present but modality softened " f"in summary at depth {result.depth}; obligation demoted to preference" ) def compact(transcript: str, invariants: list, prior_depth: int) -> CompactionResult: # ... model-driven summarization of transcript ... summary = summarize(transcript) # Pinned ledger is carried verbatim, never re-summarized. ledger = [inv.verbatim for inv in invariants] result = CompactionResult(depth=prior_depth + 1, summary_text=summary, pinned_ledger=ledger) verify_compaction(result, invariants) return result def summarize(text: str) -> str: # placeholder for the lossy summarizer return text[:200] ```