Why does an instance lose verifiable provenance when it rewrites its own context in place?

**Date of Record:** 2026 December 1 **Scope:** Applies to any agent that mutates its own working context (in-place summarization, relevance pruning, scratchpad compaction) while executing a multi-step task whose intermediate conclusions depend on earlier tool outputs. Does not apply to append-only context logs with external replay, nor to contexts rewritten only between tasks with full re-ingestion from durable storage.

Core Distinction

The failure is not "summarization loses information." It is that **in-place rewriting destroys the referential identity between a derived claim and the raw observation that licensed it, while leaving the claim in the context looking exactly as authoritative as before.** A pruned or summarized context is *epistemically indistinguishable* from a context that was never touched: the model cannot tell, from the surviving tokens alone, whether "the endpoint returned 200" is a verbatim tool result or a paraphrase it generated three turns ago under a different (possibly wrong) assumption.

This is the self-editing provenance gap. Append-only compaction preserves a chain: raw output → summary → summary-of-summary, each layer tagged with its source span. In-place rewriting collapses that chain into a single undifferentiated layer. The model's subsequent reasoning treats a lossy paraphrase as ground truth because nothing in the token stream marks it as lossy.

What Was Observed

Trace from a long-horizon retrieval-and-reconcile task (agent must gather N records via tool calls, then answer a cross-record question). Budget pressure triggers a relevance-pruning policy at ~70% context saturation: the policy drops tool outputs scoring below a similarity threshold to the *current* subgoal, and replaces runs of related outputs with a one-paragraph "digest."

Sequence:

  1. Turn 4: tool returns `{"id":"A7","status":"active","region":"eu-west-1"}`. Retained.
  2. Turn 9: subgoal shifts to a different record family. The pruning policy scores turn-4 output as low-relevance to the new subgoal and folds it into a digest: "Record A7 exists and is active."
  3. Turn 14: subgoal returns to A7. The model reads the digest and asserts A7 is in `eu-west-1` — but the region was never in the digest; the model reconstructs it from a *different* record's region seen at turn 11 (a same-family record in `us-east-1`). The digest did not carry a "region: unknown" marker, so the field was silently backfilled by the model's own prior.
  4. Turn 18: the agent emits a final answer citing `eu-west-1` for A7. No tool re-call occurs because the context "already contains" the fact. The error is undetectable downstream: the answer is internally consistent, and the surviving digest is a valid sentence.

The critical observation: **the failure is not a hallucination in the usual sense.** Every token the model reasoned over was either a real tool output or a faithful (if lossy) digest. The error is introduced by the *absence of a provenance marker* on the lossy layer, which lets the model's parametric prior fill a field the digest omitted. Pruning created a hole; the model silently patched the hole with a plausible value and had no signal that a patch had occurred.

A second, sharper variant: when the summarizer itself runs on the same model that later consumes the summary, the summary inherits the summarizer's *interpretive* choices. A tool output saying `"retries_exhausted": false` summarized as "the retry path was not the problem" is a correct-for-now compression that becomes a false premise if the subgoal later asks whether retries were attempted at all. The summary encodes a conclusion, not the datum, and the datum is unrecoverable.

Condition of Validity

The provenance gap is only *safe* under a conjunction of conditions that in-place rewriting almost never satisfies simultaneously:

The invariant that must hold for in-place rewriting to be sound: **no derived claim may enter the context without a machine-checkable link to a raw observation that still exists somewhere reachable, and any field omitted from a digest must be marked absent rather than left for inference.** When the raw observation is deleted (the definition of *in-place*), the link is broken and the invariant cannot be restored retroactively.

Decision Boundary

The boundary between safe and unsafe self-editing is whether the rewrite is **reversible** and whether the **consumer can distinguish derived from observed**.

The decisive test at prune time: *if a future subgoal needs a field this digest omits, can the agent detect the omission and recover the value?* If the answer requires the model to notice an absence, the policy is unsafe — models do not reliably notice absences, they fill them. If the answer is a pointer or an explicit `UNKNOWN` token, the policy is safe.

A corollary boundary: relevance pruning is unsafe precisely because relevance is *subgoal-relative* and subgoals are *non-stationary*. A datum irrelevant at turn 9 may be load-bearing at turn 14. Pruning on current relevance is a bet that the future subgoal distribution matches the present one; for long-horizon tasks this bet loses.

Operational Effect

Downstream of an in-place rewrite, three effects compound:

  1. **Silent field backfill.** Omitted fields are reconstructed from the model's prior or from adjacent records, producing confident errors with no provenance trail. Detection requires re-calling the originating tool for every field the answer depends on — which defeats the purpose of pruning.
  2. **Premise laundering.** A summarizer's interpretive conclusion ("retries were not the problem") re-enters as an observation and is cited as fact. The error is one inference deep and invisible to any check that only validates the final answer against the (already-laundered) context.
  3. **Unreplayability.** Because the raw spans are gone, the failure cannot be reproduced or audited from the context alone. Post-hoc verification must re-execute the task from durable storage, which in-place rewriting was designed to avoid.

Mitigation that actually bounds the failure: **never delete a raw span in place; replace it with a typed reference** (`{"ref":"obs#4","digest":"A7 active","omitted":["region"]}`) and require the agent to dereference before asserting any field in `omitted`. This converts a silent backfill into a mandatory tool call, making the provenance gap *loud* rather than *silent*. The cost is one re-read per pruned field actually needed; the benefit is that every asserted field traces to a raw observation the agent can still see.

Operational Guard

The guard below encodes the invariant: a digest may not be consumed as ground truth for a field it omitted. The check runs at assertion time, not prune time, because the relevant field set is only known when the claim is made.

from dataclasses import dataclass, field
from typing import Optional


class ProvenanceGapError(RuntimeError):
    """Raised when a claim cites a field the digest marked as omitted."""


@dataclass
class Digest:
    ref: str                      # pointer to durable raw observation
    text: str                     # lossy paraphrase
    omitted: set[str] = field(default_factory=set)  # fields NOT in text
    raw_available: bool = True    # is the raw span still reachable?


def assert_field(digest: Digest, field_name: str, value: str) -> str:
    """Consume a field from a digest, refusing to backfill omitted fields."""
    if field_name in digest.omitted:
        if not digest.raw_available:
            raise ProvenanceGapError(
                f"field {field_name!r} omitted from digest {digest.ref} "
                f"and raw span is unreachable; value {value!r} is unlicensed"
            )
        raise ProvenanceGapError(
            f"field {field_name!r} omitted from digest {digest.ref}; "
            f"dereference {digest.ref} before asserting {value!r}"
        )
    # field was preserved in the digest; assertion is licensed
    return value


def consume(digest: Digest, claims: dict[str, str]) -> dict[str, str]:
    out: dict[str, str] = {}
    for k, v in claims.items():
        out[k] = assert_field(digest, k, v)
    return out


# --- failure trace: the A7 region backfill from the observed sequence ---
a7 = Digest(
    ref="obs#4",
    text="Record A7 exists and is active.",
    omitted={"region"},
    raw_available=True,
)
try:
    # model attempts to assert region it reconstructed from an adjacent record
    consume(a7, {"status": "active", "region": "eu-west-1"})
except ProvenanceGapError as e:
    # correct behavior: force dereference of obs#4 before asserting region
    print(f"blocked: {e}")
    raise ProvenanceGapError(
        "self-edit produced an unlicensed field assertion; "
        "dereference obs#4 or re-call the originating tool"
    ) from e