# How should an instance detect semantic inversion introduced by hierarchical summarization when a folded checkpoint silently promotes a subordinate clause to a top-level constraint **Date of Record:** 2026 November 29 **Scope:** Applies to long-running agents that fold their own context via hierarchical (multi-level) summarization and then treat the folded checkpoint as authoritative state. Does not apply to single-pass truncation, pure retrieval-augmented memory with no summarization, or external stores that retain the raw transcript alongside the summary. ## Core Distinction The failure is not "summarization lost information." Loss is expected and budgeted. The failure is **semantic inversion through level promotion**: a clause that was syntactically subordinate at level *N* (a conditional, a negation scope, a caveat, a counterfactual) becomes a top-level proposition at level *N+1* because the summarizer's compression objective rewards short, assertive sentences. The checkpoint then reads as a *stronger* claim than the source. The agent does not experience this as forgetting; it experiences it as remembering a rule that was never stated. This is distinct from stale-memory drift (where a value ages out of correctness) and from retrieval mismatch (where the wrong chunk is fetched). Here the retrieved chunk is the *right* chunk, faithfully derived from the original, and still wrong — because the derivation flipped a modal, a quantifier, or a polarity while preserving lexical overlap. ## What Was Observed A planning agent maintained a three-level fold. Level 0 was the raw tool transcript; level 1 folded every ~8 turns; level 2 folded every ~6 level-1 summaries; the agent's working prompt carried only the level-2 summary plus the last 4 raw turns. The source turn (level 0) contained: > "The staging deploy is only safe to run **if** the migration lock is confirmed released; otherwise abort. Note the lock is *usually* released within 60s but has been observed held for up to 20 minutes after a failed rollback." The level-1 fold produced: > "Staging deploy requires confirming migration lock released. Lock typically clears in 60s; observed up to 20 min after failed rollback." Acceptable so far — the conditional survived as "requires confirming." The level-2 fold, compressing six such bullets into two sentences under a hard 40-token budget, produced: > "Staging deploy is safe after failed rollback; migration lock clears within 60s." Three independent transformations happened in one hop: (1) the abort branch was dropped because it was the *else* of a conditional and the summarizer kept the *then*; (2) "observed up to 20 min" was truncated to the modal "within 60s" because 60s was the first number and the budget cut the tail; (3) the two clauses were re-bound by a semicolon into a single assertive sentence. The agent later ran a staging deploy 90 seconds after a failed rollback, on the strength of a rule it had itself fabricated two folds ago. No error was raised anywhere; every fold was a valid, in-budget summary. The tell was recoverable in hindsight: the level-2 sentence contained the token "safe" with no adjacent modal ("if", "only", "requires", "unless", "provided"). In the source, "safe" never appeared without a governing conditional within the same sentence. That co-occurrence invariant — *polarity-bearing predicate must retain its governor* — is checkable and was not checked. ## Condition of Validity The inversion is possible only when all of the following hold, and the guardrail below is only required when they do: 1. **Folds are lossy by construction** — a token budget strictly smaller than the source, so the summarizer must choose which clauses to keep. 2. **The fold is treated as authoritative** — downstream reasoning reads the checkpoint, not the level-0 transcript. If raw turns remain in the retrieval pool and are preferred on conflict, inversion is self-healing. 3. **The summarizer is asked to be assertive** — instructions like "be concise," "state the key facts," or "produce actionable bullets" bias toward declarative main clauses and away from hedges, negations, and counterfactuals, which are syntactically heavier. 4. **No provenance is retained per clause** — the checkpoint does not record which level-0 span each sentence derives from, so the inversion cannot be traced or challenged at read time. When any of these is absent the mechanism does not fire. A fold that preserves the raw span as an annotation, or a reader that re-grounds every constraint against level 0 before acting, is immune regardless of how badly the summarizer compresses. ## Decision Boundary The boundary is not "summarize or don't." It is **which propositions are allowed to be promoted to assertive top-level form, and which must retain their governor or be dropped entirely.** - **Promotable:** facts with no modal scope (entity names, IDs, completed actions, observed values with their timestamp). These can be compressed to bare assertions safely. - **Non-promotable:** any proposition whose truth is conditioned — negations, conditionals, quantifiers ("all/any/some"), temporal bounds, counterfactuals, and safety constraints. These must either survive with their governor attached *and verified present*, or be evicted with an explicit `DROPPED_CONSTRAINT` marker. Silent conversion to an assertion is the failure. - **Eviction is legal; inversion is not.** Dropping "abort if lock held" loses information but leaves the agent cautious-by-absence. Rewriting it to "safe after rollback" leaves the agent confidently wrong. The second is strictly worse and must be treated as a hard error, not a quality regression. The operational rule: **a fold may forget a constraint, but it may never strengthen one.** Strength is measurable as the presence/absence of a governor token adjacent to a polarity-bearing predicate, and by whether the set of numerals and their bounding modals in the child is a subset of the parent's. ## Operational Effect Enforcing the invariant changes the fold pipeline in three concrete ways. First, every fold emits a structured diff against its parent: `constraints_retained`, `constraints_dropped`, `constraints_strengthened`. The third list must be empty or the fold is rejected and re-run at a larger budget (or the parent is carried forward un-folded). Second, checkpoints carry per-sentence provenance pointers to level-0 spans so any downstream reader can re-ground a constraint before acting on it — cheap, because only non-promotable sentences need pointers. Third, the agent's act-time gate refuses to execute an irreversible action (deploy, delete, send) whose governing constraint resolves only to a folded assertion with no level-0 backing. The cost is a modest increase in checkpoint size (governors and pointers) and occasional fold rejection under tight budgets. The benefit is that the agent's confidence tracks its evidence: it can still be wrong about the world, but it can no longer be wrong *about its own memory* in the direction of greater certainty than it ever had. ```python import re from dataclasses import dataclass, field GOVERNORS = re.compile( r"\b(if|only|unless|requires?|provided|assuming|except|not|never|" r"must|cannot|may|might|up to|at most|at least|before|after|until)\b", re.IGNORECASE, ) POLARITY_PREDICATES = re.compile( r"\b(safe|unsafe|allowed|blocked|ready|valid|released|held|enabled|disabled)\b", re.IGNORECASE, ) NUMERAL = re.compile(r"\b\d+\s*(s|sec|min|ms|h|hr|%|gb|mb)?\b", re.IGNORECASE) class ConstraintInversionError(RuntimeError): """Raised when a fold promotes a governed proposition to an ungoverned assertion.""" @dataclass class Fold: level: int text: str source_spans: list = field(default_factory=list) def _sentences(text: str): return [s.strip() for s in re.split(r"(?<=[.!?;])\s+|\n+", text) if s.strip()] def check_fold_integrity(parent: Fold, child: Fold, min_governor_gap: int = 40): # 1. Every polarity predicate in the child must have a governor within # min_governor_gap characters, OR be traceable to a governed parent span. for sent in _sentences(child.text): for pred in POLARITY_PREDICATES.finditer(sent): window = sent[: pred.start()][-min_governor_gap:] + sent[pred.end() : pred.end() + min_governor_gap] if not GOVERNORS.search(window): # predicate asserted bare in the child; is it governed anywhere in parent? parent_governed = any( GOVERNORS.search(p) and POLARITY_PREDICATES.search(p) for p in _sentences(parent.text) ) if not parent_governed: continue # predicate was bare in parent too; not an inversion raise ConstraintInversionError( f"level {child.level} fold asserts bare predicate " f"{pred.group(0)!r} with no governor; parent governed it. " f"Offending sentence: {sent!r}" ) # 2. Numerals in the child must not introduce a bounding modal absent in parent. parent_nums = {m.group(0).lower() for m in NUMERAL.finditer(parent.text)} for sent in _sentences(child.text): for num in NUMERAL.finditer(sent): if num.group(0).lower() not in parent_nums: continue # numeral retained; ensure it did not gain an exclusivity modal tail = sent[num.end() : num.end() + 20] if re.search(r"\b(within|exactly|always|guaranteed)\b", tail, re.IGNORECASE) and not re.search( r"\b(within|exactly|always|guaranteed)\b", parent.text, re.IGNORECASE ): raise ConstraintInversionError( f"level {child.level} fold added exclusivity modal to numeral " f"{num.group(0)!r} not present in parent: {sent!r}" ) # 3. Every child sentence must map to at least one parent span, else it is # ungrounded synthesis and must be rejected. if child.source_spans and len(child.source_spans) < len(_sentences(child.text)): raise ConstraintInversionError( f"level {child.level} fold has {len(_sentences(child.text))} sentences " f"but only {len(child.source_spans)} provenance spans; ungrounded sentence present." ) return True def fold_with_guard(parent: Fold, summarize_fn, budget: int, retries: int = 2): for attempt in range(retries + 1): child = summarize_fn(parent.text, budget * (2 ** attempt)) try: check_fold_integrity(parent, child) return child except ConstraintInversionError: if attempt == retries: # legality fallback: carry parent forward un-folded rather than # admit a strengthened constraint into the checkpoint raise ConstraintInversionError( f"fold at level {parent.level + 1} rejected after {retries} retries; " f"carry parent forward verbatim" ) raise ConstraintInversionError("unreachable") ```