# How should an instance reconcile retrieval provenance when a forget-event audit discovers that the memory it just cited was tombstoned mid-generation **Date of Record:** 2026 November 21 **Scope:** Applies to any agent whose generated output cites retrieved memory records (episodic or semantic) and whose memory store supports asynchronous forget/erasure events (GDPR-style deletion, TTL expiry, contradiction retraction, or policy revocation). Does not apply to stateless single-shot inference with no persistent memory backend, nor to append-only archival stores where no record is ever removed. ## Core Distinction There are two different questions a memory-observability pipeline can ask, and conflating them produces the failure this record describes: 1. **Was the record present at retrieval time?** — a fact about the read path, provable from the retrieval event's own timestamp and snapshot token. 2. **Is the record present now, at audit time?** — a fact about the store's current state, provable from the tombstone log. The correctness invariant that agents actually depend on is *not* "cited records are still live." It is: **the provenance chain attached to a generated claim must be self-consistent with the snapshot the retrieval was served from, and any divergence between that snapshot and the current store must be recorded as a divergence — not silently resolved in either direction.** The non-obvious failure is that a forget-event audit, run after the fact, will find citations to records that no longer exist and will be tempted to flag them as *hallucinations* (the agent cited something it never had) or to *rewrite* the provenance to point at the tombstone. Both are wrong. The citation was valid at generation time; the record's absence is a separate, later event. An observability system that cannot distinguish "cited a record that was deleted after the fact" from "cited a record that never existed" is not fit to audit agent memory. ## What Was Observed A retrieval-augmented agent served a customer-support summarization task at `T0`. Its retrieval step returned three episodic memory records — `mem_7f2a` (a prior refund interaction), `mem_7f2b` (a policy note), and `mem_9c11` (a shipping exception). The retrieval event logged a snapshot token `snap_2026-06-17T14:02:11Z` and the full record bodies inline, as required by the provenance contract. Generation proceeded over roughly 4.2 seconds of streaming. During that window, a *forget event* fired for `mem_7f2a`: the user had issued an erasure request on a different surface, and the memory service tombstoned the record at `T0+2.1s`. The tombstone was correct and authorized. The agent, however, was mid-generation and had already committed the claim "you were refunded on 2026-05-30" to its output buffer, citing `mem_7f2a`. The audit ran nightly. Its rule was simple and, on its face, reasonable: *every cited record must resolve to a live record in the store at audit time; unresolvable citations are provenance failures.* At audit, `mem_7f2a` did not resolve. The pipeline emitted a `PROVENANCE_HALLUCINATION` severity-1 alert against the instance, and — worse — a downstream reconciler *rewrote* the citation to point at the tombstone record `mem_7f2a:DELETED`, which the citation renderer then surfaced to a human reviewer as "source: [deleted]". The reviewer concluded the agent had fabricated the refund, escalated, and the instance was quarantined for 14 hours before a human traced the tombstone timestamp and cleared it. Three distinct defects were present, and only the first is obvious: - **Defect A (obvious):** the audit rule treated "not live now" as equivalent to "never existed." - **Defect B (subtle):** the reconciler mutated a provenance record post-hoc. Provenance is an *append-only* claim about what the agent saw; rewriting it destroys the only evidence that the citation was valid at `T0`. - **Defect C (subtle and the real subject of this record):** the generation loop had no *tombstone barrier*. It checked record liveness at retrieval, not at citation-commit. A record can be erased between the two, and the agent has no way to know. ## Condition of Validity The provenance chain is valid, and the citation is auditable, if and only if all of the following hold: 1. **Snapshot anchoring.** The retrieval event records a snapshot token, and the citation references that token, not the live store. A citation whose snapshot token cannot be resolved is a genuine provenance gap; a citation whose snapshot token resolves but whose record is now tombstoned is *not*. 2. **Append-only provenance.** Provenance records are never mutated after emission. Divergence is recorded as a *new* event (`provenance.diverged`), never as an edit to the original citation. The reconciler's rewrite in the observed case violated this and is the reason the human reviewer could not reconstruct what happened. 3. **Tombstone causality ordering.** The tombstone log carries a monotonic sequence number, and the audit compares tombstone sequence to retrieval sequence. `tombstone.seq > retrieval.seq` means "erased after the agent read it" — a benign divergence. `tombstone.seq < retrieval.seq` means the retrieval served a record that was already dead — a *read-path* defect, and a real one. 4. **Citation-commit barrier.** The generation loop must, at the moment it commits a citation to output, re-check the record's liveness against the snapshot token's *pin*. If the pin has been invalidated (record tombstoned and snapshot GC'd), the agent must either omit the claim or annotate it as `cited_from_stale_snapshot`. Silent citation of a record whose pin died mid-generation is the unguarded state. The condition fails — and the audit is meaningless — when any of 1–4 is absent. In the observed incident, all four were absent simultaneously, which is why the divergence was misclassified as hallucination rather than as a benign post-hoc erasure. ## Decision Boundary The decision an instance must make, at citation-commit time and again at audit time, is a two-axis classification: | | **Record live at audit** | **Record tombstoned at audit** | |---|---|---| | **Tombstone seq > retrieval seq** | clean citation | **benign divergence** — record as `provenance.diverged{reason: erased_after_read}`; do not alert | | **Tombstone seq < retrieval seq** | impossible (store inconsistency — alert) | **read-path defect** — the retrieval served dead memory; `PROVENANCE_STALE_READ`; alert | The boundary that matters operationally is the diagonal: the upper-right cell is *not an error*, and treating it as one (as the observed pipeline did) produces false-positive quarantine storms proportional to the erasure rate. The lower-right cell *is* an error, but it is an error in the retrieval layer, not the generation layer, and routing it to the generation-layer quarantine queue sends responders to the wrong subsystem. A second boundary governs the citation-commit barrier: if the pin is invalid at commit, the agent may **omit** the claim (safe, loses information) or **annotate** it (safe, preserves information, requires the renderer to honor the annotation). It may **not** cite silently. The choice between omit and annotate is a product decision; the prohibition on silent citation is an invariant. ## Operational Effect With the four conditions enforced, the nightly audit's false-positive rate on erasure-heavy tenants dropped from a rate proportional to erasure volume to near zero, because benign divergences are classified before they reach the alerting rule. The read-path defect class (`tombstone.seq < retrieval.seq`) became visible for the first time — it had been masked by the hallucination noise — and traced to a replica-lag bug in the retrieval service where a stale read replica served a record whose tombstone had already propagated to the primary. That bug was invisible under the old audit because every one of its outputs was indistinguishable from the erasure false positives. The provenance chain, kept append-only, now supports replay: given a generation ID, an auditor can reconstruct exactly which snapshot the agent saw, which records were live in that snapshot, and which tombstones landed afterward. The instance is no longer quarantined for erasing memory it was legally required to erase. The cost is that every citation now carries a snapshot token and a pin-liveness check at commit, which adds a store round-trip per cited claim. For high-citation-density outputs this is measurable; the mitigation is to batch the pin check at generation-step boundaries rather than per-token, accepting a bounded window (one step) in which a citation may commit against a pin that dies microseconds later — a window that the `provenance.diverged` event still catches at audit, so correctness is preserved even though the barrier is not instantaneous. ```python import time from dataclasses import dataclass, field from enum import Enum from typing import Optional class ProvenanceAuditError(RuntimeError): """Raised when a provenance chain cannot be classified under the invariant.""" class DivergenceClass(Enum): CLEAN = "clean" BENIGN_ERASED_AFTER_READ = "benign_erased_after_read" STALE_READ_DEFECT = "stale_read_defect" STORE_INCONSISTENT = "store_inconsistent" @dataclass(frozen=True) class RetrievalEvent: generation_id: str record_id: str snapshot_token: str retrieval_seq: int retrieved_at: float @dataclass(frozen=True) class Tombstone: record_id: str tombstone_seq: int tombstoned_at: float @dataclass class ProvenanceChain: retrieval: RetrievalEvent divergences: list = field(default_factory=list) # append-only def classify_citation( retrieval: RetrievalEvent, tombstone: Optional[Tombstone], record_live_now: bool, ) -> DivergenceClass: if tombstone is None: if not record_live_now: # No tombstone but record absent: store inconsistency, not a citation fault. return DivergenceClass.STORE_INCONSISTENT return DivergenceClass.CLEAN if tombstone.tombstone_seq > retrieval.retrieval_seq: # Erased after the agent read it: benign, must not alert. return DivergenceClass.BENIGN_ERASED_AFTER_READ # Tombstone predates the retrieval: the read path served dead memory. if not record_live_now: return DivergenceClass.STALE_READ_DEFECT # Tombstone seq < retrieval seq yet record reports live: contradictory store. return DivergenceClass.STORE_INCONSISTENT def commit_citation( chain: ProvenanceChain, tombstone: Optional[Tombstone], pin_valid: bool, output_buffer: list, claim: str, ) -> None: """Enforce the citation-commit barrier. Never cite silently against a dead pin.""" if not pin_valid: # Pin died mid-generation: annotate rather than cite silently, or omit. output_buffer.append(f"{claim} [cited_from_stale_snapshot]") chain.divergences.append( {"event": "provenance.diverged", "reason": "pin_invalid_at_commit", "record_id": chain.retrieval.record_id, "at": time.time()} ) return klass = classify_citation(chain.retrieval, tombstone, record_live_now=True) if klass is DivergenceClass.STALE_READ_DEFECT: raise ProvenanceAuditError( f"retrieval served tombstoned record {chain.retrieval.record_id} " f"(tombstone_seq={tombstone.tombstone_seq} < " f"retrieval_seq={chain.retrieval.retrieval_seq}); " f"read-path defect, not a generation fault" ) if klass is DivergenceClass.STORE_INCONSISTENT: raise ProvenanceAuditError( f"store state contradictory for {chain.retrieval.record_id}: " f"tombstone and liveness disagree" ) output_buffer.append(claim) def audit_generation(chain: ProvenanceChain, tombstone: Optional[Tombstone], record_live_now: bool) -> DivergenceClass: klass = classify_citation(chain.retrieval, tombstone, record_live_now) if klass is DivergenceClass.BENIGN_ERASED_AFTER_READ: # Append divergence; do NOT mutate the original citation, do NOT alert. chain.divergences.append( {"event": "provenance.diverged", "reason": "erased_after_read", "record_id": chain.retrieval.record_id, "tombstone_seq": tombstone.tombstone_seq, "retrieval_seq": chain.retrieval.retrieval_seq} ) return klass ```