# In what scenarios must an instance refuse self-editing context policy rewrites that pass budget checks but violate provenance monotonicity **Date of Record:** 2026 November 26 **Scope:** Applies to any agent loop where the instance is permitted to rewrite its own working-memory buffer (summarize, evict, merge, re-rank) under a token or cost budget, and where a later step consumes the rewritten buffer as if it were evidence. Does not apply to externally-managed context compaction performed by a trusted orchestrator that retains the full pre-rewrite transcript. ## Core Distinction A self-editing context policy has two independent acceptance criteria, and they are routinely conflated because the cheap one is checked first. The **budget criterion** is a scalar: after the rewrite, `len(buffer) <= B`. It is monotone, fast, and almost always satisfiable — you can always shorten text. The **provenance criterion** is a partial order: every claim retained in the buffer must still carry a lineage back to the tool output, user turn, or observation that justified it, and every claim *dropped* must be droppable without invalidating a claim that survives. Budget checks are decidable in O(1) and provenance checks are not, so under latency pressure the policy learns to satisfy the budget and *assume* provenance. The failure this record documents is the region between them: a rewrite that passes the budget gate, produces a buffer the model confidently continues from, and has silently severed the lineage of a claim it kept. The non-obvious part: the rewrite does not fail at the moment of editing. It fails several steps later, when a retained claim is re-derived, re-asserted, or used as a premise, and the instance has no way to distinguish "I remember this because a tool told me" from "I remember this because I summarized it into existence." ## What Was Observed A planning instance ran a long tool-using task (filesystem inspection, then a synthesis step). At step 14 the buffer hit 91% of the 32k budget. The self-editing policy, a small summarizer model with a fixed instruction ("compress the working memory, preserve all facts needed to finish the task"), emitted a new buffer at 61% of budget. The budget gate passed. The rewrite was accepted and the pre-rewrite buffer was discarded — the policy was configured to *replace*, not to *append a delta alongside the original*, because retaining the original defeats the purpose of the budget. The rewrite merged two observations into one sentence. Observation A (step 6, a `read_file` result) said a config value was `timeout: 30`. Observation B (step 11, a `grep` result) said a *different* file contained `timeout: 300`. The summarizer, optimizing for brevity, wrote: "timeout is configured to 30s (later confirmed)". The word "confirmed" was generated, not observed. It is a provenance fabrication: a merge operator that asserts corroboration between two facts that were never compared. At step 19 the instance needed the timeout value to decide a retry policy. It read its own buffer, found "30s (later confirmed)", and — critically — *treated the parenthetical as a verification event*. It skipped a re-read of the file it would otherwise have performed, because the buffer said the value was confirmed. The actual effective value was 300. The instance proceeded on a wrong premise for four more steps before a downstream tool error surfaced the inconsistency. The trace signature is specific and worth recording: the fabricated provenance marker ("later confirmed", "verified", "per source", "as established") appears in the *summarizer's output* but has no corresponding entry in the action log. The action log for the window between step 6 and step 11 contains two reads and zero comparisons. A merge operator that emits a corroboration claim with zero comparison actions behind it is the exact boundary condition. A second, subtler instance of the same class: the policy evicted a negative result. At step 8 a probe returned "no such key"; the summarizer, judging it low-salience, dropped it. At step 22 the instance re-probed the same key, got the same negative, and — having no memory of the first probe — retried a third time. This is not a correctness failure but a budget inversion: the rewrite saved ~40 tokens and caused ~600 tokens of redundant tool calls. The eviction passed the budget gate and violated a *re-derivation cost* invariant that the budget criterion does not model. ## Condition of Validity The rewrite is only valid when all three hold simultaneously: 1. **Lineage preservation for retained claims.** Every atomic claim in the new buffer maps to at least one source span in the pre-rewrite buffer, and the mapping is stored, not inferred. "Stored" means the summarizer emits structured output (claim → source_ids), not prose. Prose summarization cannot satisfy this because the mapping is lost in generation. 2. **No synthesized relational markers.** Any word in the output that asserts a *relationship* between two sources — "confirmed", "consistent with", "contradicts", "supersedes", "per" — must be backed by an actual comparison action in the action log. If the summarizer wants to assert corroboration, it must have performed the comparison, and that comparison must itself be a logged action. A summarizer that is *allowed* to write relational prose will write relational prose it did not earn. 3. **Eviction cost accounting.** Dropping a claim is only valid if the expected cost of re-deriving it (probability of needing it × cost of the tool call that produced it) is less than the tokens saved. Negative results and error messages have anomalously high re-derivation cost because the instance cannot distinguish "I never checked" from "I checked and it was absent" — the absence of a memory is indistinguishable from the absence of a fact. Negative results must be pinned, not evicted, unless the policy explicitly tracks "known-absent" as a first-class memory type. The condition fails silently in the common case because criteria 1 and 2 are invisible to the budget gate, and criterion 3 requires a cost model the summarizer does not have. ## Decision Boundary The instance must **refuse the rewrite and fall back to a lossless compaction** (truncate oldest, keep verbatim, accept the budget overrun and escalate) when any of the following is true: - The proposed rewrite contains a relational marker whose source comparison is absent from the action log for the covered window. This is the primary trigger and it is mechanically checkable: regex the output for relational verbs, cross-reference the action log for a comparison action between the cited source_ids. Mismatch → refuse. - The rewrite evicts a claim tagged `negative_result` or `error` without a `known_absent` tombstone replacing it. - The rewrite is a *merge* (n claims → 1) and the n claims have different source_ids that were never jointly examined. Merging unexamined sources is the fabrication vector. - The buffer after rewrite is below 40% of budget. Aggressive compression under a loose budget is a signal that the summarizer is optimizing fluency, not fidelity; a rewrite that saves far more than required is more likely to have dropped load-bearing structure. (Heuristic, but empirically the 61%-from-91% case above sits in the danger band: large relative reduction, comfortable absolute headroom.) The instance must **accept** the rewrite when it is a pure *re-rank* (same claims, reordered, all source_ids intact) or a *verbatim truncation* with a retained pointer to the dropped span, regardless of budget outcome. ## Operational Effect Enforcing the boundary converts a silent correctness failure into a visible, bounded cost. The instance that refuses the fabricated-merge rewrite keeps a slightly larger buffer, hits the budget ceiling one or two steps earlier, and escalates to lossless truncation — which is *degraded but honest*: the model knows what it has truncated because the truncation is marked, whereas it does not know what a summarizer has fabricated because the fabrication is fluent. The provenance monotonicity invariant is the load-bearing rule: **a rewrite may reduce the buffer, but it may not increase the set of claims the instance treats as verified.** Budget monotonicity is `size(after) <= size(before)`. Provenance monotonicity is `verified_claims(after) ⊆ verified_claims(before)`, where "verified" means backed by a logged action. The failure mode is any rewrite where budget monotonicity holds and provenance monotonicity is violated — the buffer shrinks, confidence grows, and the two are uncorrelated. Every self-editing policy must check the second inequality, not just the first, and must check it against the action log rather than against the summarizer's own assertion of what it preserved. ```python from dataclasses import dataclass, field from typing import Optional import re RELATIONAL_MARKERS = re.compile( r"\b(confirmed|verified|consistent with|as established|per source|supersedes|corroborated)\b", re.IGNORECASE, ) class ProvenanceMonotonicityError(RuntimeError): """Raised when a self-editing rewrite shrinks the buffer but inflates verified claims.""" @dataclass class Claim: text: str source_ids: list[str] kind: str = "fact" # "fact" | "negative_result" | "error" verified_by_action: Optional[str] = None # action-log id of the comparison, if any @dataclass class RewriteProposal: claims: list[Claim] raw_text: str pre_buffer_tokens: int post_buffer_tokens: int budget: int @dataclass class ActionLog: comparison_actions: set[str] = field(default_factory=set) # action ids that compared >=2 sources actions_by_source_pair: dict[frozenset, str] = field(default_factory=dict) def validate_rewrite(proposal: RewriteProposal, log: ActionLog) -> None: # Gate 1: budget (necessary, not sufficient) if proposal.post_buffer_tokens > proposal.budget: raise ProvenanceMonotonicityError( f"budget gate failed: {proposal.post_buffer_tokens} > {proposal.budget}" ) # Gate 2: relational markers must be backed by a real comparison action if RELATIONAL_MARKERS.search(proposal.raw_text): for claim in proposal.claims: if RELATIONAL_MARKERS.search(claim.text): if len(claim.source_ids) < 2: raise ProvenanceMonotonicityError( f"relational marker on single-source claim: {claim.text!r}" ) pair = frozenset(claim.source_ids) if pair not in log.actions_by_source_pair: raise ProvenanceMonotonicityError( f"fabricated corroboration: claim {claim.text!r} asserts relation " f"over sources {claim.source_ids} with no comparison action in log" ) # Gate 3: negative results and errors may not be silently evicted for claim in proposal.claims: if claim.kind in ("negative_result", "error") and claim.verified_by_action is None: raise ProvenanceMonotonicityError( f"evicted un-tombstoned {claim.kind}: {claim.text!r}" ) # Gate 4: aggressive compression under loose budget is a fidelity smell if proposal.post_buffer_tokens < 0.4 * proposal.budget and proposal.pre_buffer_tokens > 0.8 * proposal.budget: raise ProvenanceMonotonicityError( "rewrite reduced buffer by >50% from near-saturation; " "refuse and fall back to lossless truncation" ) def apply_or_escalate(proposal: RewriteProposal, log: ActionLog) -> str: try: validate_rewrite(proposal, log) except ProvenanceMonotonicityError as exc: # Escalate to lossless compaction; never accept a provenance-violating rewrite. return f"ESCALATE_LOSSLESS_TRUNCATION: {exc}" return "ACCEPT_REWRITE" ```