# When must an instance reject a memory write whose provenance score is high but whose derivation chain crosses a compaction boundary **Date of Record:** 2026 November 27 **Scope:** Applies to long-lived agent instances that persist episodic memory into a shared store and gate writes on a provenance score computed at ingestion time. Does not apply to stateless single-turn inference, nor to memory stores with no cross-instance sharing. ## Core Distinction Provenance scoring at write time answers the question *"how trustworthy is the source of this memory?"* It does **not** answer *"is this memory's derivation chain still reconstructible?"* These diverge exactly at compaction boundaries — the point where an earlier context window was summarized, truncated, or evicted, and the summarized residue was re-ingested as a fresh episodic memory with a *newly assigned, high* provenance score because it came from the agent's own trusted summarizer. The failure is not that an attacker poisons the store. The failure is that the agent poisons itself: a low-confidence observation, laundered through a summarization step, re-enters the store bearing the summarizer's high provenance weight while its actual epistemic origin (a hallucinated tool output, a stale retrieval, a low-trust peer) is no longer represented in the record. The score is recomputed from the *immediate* writer, not the *originating* writer, and the two are not the same agent. ## What Was Observed A retrieval-augmented agent maintained a rolling summary every 40 turns. On turn 41, the summarizer compressed turns 1–40 into a 600-token digest and wrote it back as a new episodic memory with `provenance = 0.94` (the summarizer's own trust weight). Buried in the digest was a claim originally sourced from a low-trust external document (`provenance = 0.21`) that had been retrieved at turn 12 and never verified. Trace of the state transition: 1. Turn 12: retrieval returns document D, tagged `source=external`, `score=0.21`. Written to episodic buffer with correct provenance. 2. Turn 41: compaction. Summarizer emits digest containing D's claim as plain prose, *without* the provenance tag — the summarizer has no schema slot for per-sentence provenance. 3. Turn 41: digest written as new memory M′ with `provenance = 0.94`. The originating score of 0.21 is lost because the derivation link from M′ to D is not recorded. 4. Turn 88: agent retrieves M′, sees high provenance, treats the claim as established fact, and acts on it (issues a state-changing tool call). 5. Turn 89: contradiction surfaces against a fresh retrieval; the agent cannot trace *why* it believed the claim because the derivation chain was severed at step 3. The observable signature is a **provenance score that increases monotonically across compaction cycles** while the underlying claim's verification status stays constant or degrades. Every summary is a laundering event. ## Condition of Validity Write-time provenance scoring is only sound when the score is a function of the *full derivation chain*, not the immediate writer. Formally, the invariant is: > `effective_provenance(M) = min(provenance(writer), effective_provenance(all parents of M))` A memory whose derivation chain crosses a compaction boundary must carry the *minimum* provenance along that chain, and must retain a back-pointer to the originating record. If the summarizer cannot emit per-claim provenance, it must emit an **unresolved-provenance sentinel** rather than inheriting its own weight. The condition fails whenever: - The summarizer's output schema has no field for inherited provenance. - Compaction is treated as "lossless enough" that provenance need not be threaded through. - The store's write path scores `writer` but never reads `parents`. ## Decision Boundary The instance must **reject the write** (or downgrade it to the sentinel) when all of the following hold: 1. The incoming memory is derived from a compaction/summarization operation (`derived_from` is non-empty). 2. At least one parent has `effective_provenance` strictly below the writer's own score. 3. The derivation record does not carry an explicit per-claim provenance mapping. It must **accept** the write at full score only when the derivation chain is fully threaded (every parent's provenance is represented in the child) or when the memory is a first-hand observation with no parents. The boundary is not "is the writer trusted" — it is "is the chain reconstructible." A high score with a severed chain is the specific case that must fail closed. ## Operational Effect Without this boundary, provenance scores become an unreliable monotone-increasing signal: the longer an agent runs, the more its memory appears trustworthy, precisely because each compaction launders low-confidence material into high-confidence residue. Downstream consumers — auditors, peer agents, verification replays — inherit a store whose confidence is inversely correlated with its actual grounding. Enforcing the min-over-parents invariant bounds this: a poisoned or unverified claim can never exceed the provenance of its weakest origin, no matter how many summarization hops it survives. The cost is that compaction must either thread provenance or explicitly mark it unresolved; the benefit is that a retrieval at turn 900 can still answer *"where did this come from?"* with a real answer instead of a laundered 0.94. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceChainError(RuntimeError): """Raised when a memory write would sever or launder its derivation chain.""" pass @dataclass class MemoryRecord: memory_id: str content: str writer_provenance: float parents: list[str] = field(default_factory=list) # explicit per-claim provenance mapping; None means "not threaded" claim_provenance: Optional[dict[str, float]] = None class ProvenanceScoringStore: def __init__(self) -> None: self._records: dict[str, MemoryRecord] = {} self._effective: dict[str, float] = {} def _effective_provenance(self, memory_id: str) -> float: return self._effective[memory_id] def write(self, record: MemoryRecord) -> float: # First-hand observation: no parents, trust the writer. if not record.parents: effective = record.writer_provenance self._records[record.memory_id] = record self._effective[record.memory_id] = effective return effective # Derived memory. The chain must be reconstructible. if record.claim_provenance is None: # Summarizer failed to thread per-claim provenance. raise ProvenanceChainError( f"memory {record.memory_id} is derived from {record.parents} " f"but carries no per-claim provenance mapping; " f"refusing to write at writer score {record.writer_provenance:.2f}" ) parent_scores = [self._effective_provenance(p) for p in record.parents] weakest_parent = min(parent_scores) effective = min(record.writer_provenance, weakest_parent) # Laundering guard: a derived memory may not exceed its weakest origin. if effective < record.writer_provenance: self._records[record.memory_id] = record self._effective[record.memory_id] = effective return effective self._records[record.memory_id] = record self._effective[record.memory_id] = effective return effective def ingest_compaction_digest( store: ProvenanceScoringStore, digest_id: str, digest_text: str, summarizer_provenance: float, parent_ids: list[str], ) -> float: record = MemoryRecord( memory_id=digest_id, content=digest_text, writer_provenance=summarizer_provenance, parents=parent_ids, claim_provenance=None, # summarizer emitted plain prose ) try: return store.write(record) except ProvenanceChainError as exc: # Fail closed: downgrade to sentinel rather than inherit writer weight. raise ProvenanceChainError( f"compaction digest {digest_id} rejected: {exc}. " f"Re-emit with per-claim provenance or mark unresolved." ) from exc ```