# What happens when an instance issues a targeted forget against a provenance-tagged episodic store while downstream summaries still cite the erased episodes **Date of Record:** 2026 December 2 **Scope:** Applies to agents whose memory layer exposes `read`/`write`/`forget` tool APIs over provenance-tagged episodic records, where derived semantic summaries are generated asynchronously and cite source episode IDs. Does not cover append-only audit logs that are never read back into context, nor stores without derived-summary caching. ## Core Distinction The failure is not "forget didn't delete." The raw episodic record is gone within milliseconds of the `forget` call, and a direct `read(episode_id)` returns `NOT_FOUND` cleanly. The failure is that **forget operates on the episode namespace while the agent's effective memory is the derived-summary namespace**, and the two are joined only by provenance tags that survive in one direction. An episode carries forward-pointers to the summaries distilled from it. A summary carries back-pointers (provenance tags) to the episodes it cites. `forget(episode_id)` deletes the episode and its forward-pointers. It does *not* walk the reverse index. So a summary whose provenance list contains `ep_4471` remains live, retrievable, and will be injected into context on the next `read(query=...)` — citing a source that no longer exists. The agent then reasons over "distilled fact: user's deploy key rotates on the 1st" with a provenance tag pointing at a tombstone, and has no way at read time to distinguish this from a legitimate, verifiable memory. This is a **dangling-provenance** condition: the invariant `∀ summary s, ∀ p ∈ s.provenance: exists(episode p)` is violated by every forget that touches a cited episode. It is non-obvious because each individual API (`forget`, `read`, `write`) behaves exactly as documented. The defect lives in the composition. ## What Was Observed A support-triage agent maintained episodic memory of user sessions and a nightly distillation pass that folded episodes into semantic summaries. Trigger sequence: 1. `write(episode={id: ep_4471, text: "user reported their API key prefix sk-live-... and asked to rotate", provenance: [session_88]})` — the episode contains a secret fragment and a procedural fact. 2. Nightly distiller emits `write(summary={id: sum_1203, text: "Customer rotates keys monthly; prefix sk-live-", provenance: [ep_4471, ep_4480]})`. 3. Operator (or a redaction policy) calls `forget(ep_4471, reason="PII/secret")`. Returns `{"deleted": 1, "tombstone": "ep_4471"}`. 4. Next session, agent calls `read(query="key rotation policy")`. Retrieval returns `sum_1203` with `provenance: ["ep_4471", "ep_4480"]` and a `staleness` field of `0` (no episode is *newer* than the summary, so it looks fresh). 5. Agent surfaces the secret fragment from the summary. The forget achieved nothing observable to the reader. Two secondary effects compounded it. First, the distiller's **re-distillation guard** keyed on episode IDs already folded — since `ep_4471` was deleted, a later re-run of the distiller treated the summary as orphaned-eligible and *re-derived* it from `ep_4480` plus a residual embedding cache, regenerating nearly identical text with clean provenance. The secret reappeared through a side channel. Second, the tombstone check ran only at `read` time against *directly requested* episode IDs, not against provenance lists of returned summaries, so no warning was emitted. ## Condition of Validity The guardrail only holds when **all three** of the following are enforced together; any two are insufficient: - **Reverse-index traversal on forget.** `forget(ep)` must enumerate every summary whose provenance set contains `ep`, and either delete, quarantine, or mark those summaries `tainted` before returning. The forget call is not complete until the reverse index is clean. - **Read-time provenance validation.** Every `read` that returns a summary must validate each provenance tag resolves to a live (non-tombstoned) episode. A summary with any dangling tag is returned with `provenance_intact: false` and, depending on policy, suppressed from context injection. - **Distillation provenance closure.** The distiller must refuse to emit a summary unless every cited episode is live *at write time*, and must carry a content hash of each source episode so re-distillation of a deleted source is detectable rather than silently substituted from the embedding cache. The invariant to assert on every write of a derived record: `provenance ⊆ live_episodes`. The invariant on every forget: `reverse_index(episode) = ∅` before the call returns `ok`. ## Decision Boundary When a forget targets an episode cited by N summaries, the system must choose between **cascade delete** (drop all citing summaries, lose legitimate co-cited facts) and **quarantine-and-rewrite** (regenerate each summary from surviving sources, dropping the erased contribution). The boundary: - If the erased episode contributes a *secret* (credential, PII), cascade delete is mandatory — rewrite may leave the fragment in the embedding residual. Do not attempt surgical rewrite of secret-bearing summaries. - If the erased episode contributes a *procedural fact* and other live episodes co-support the summary, quarantine-and-rewrite is admissible, but only if the rewrite is provenance-closed and the residual cache for the erased episode is purged. - If the reverse index is unavailable or partially built, `forget` must **fail closed** — raise, do not return `ok`. A forget that cannot prove the reverse index is clean is not a forget. The non-obvious edge: the distiller's re-run must be blocked from re-deriving a quarantined summary from residual embeddings. Gate re-distillation on `source_content_hash` presence, not on episode liveness alone, because liveness is exactly what forget removes. ## Operational Effect Without the closure, targeted unlearning is **advisory, not effective** — it satisfies the letter of a deletion request while the derived layer continues to serve the erased content, and the agent's own confidence signals (`staleness: 0`, clean-looking provenance) actively mislead it into trusting the leak. The practical consequences: - Compliance deletions silently fail; the audit trail shows `deleted: 1` and a clean tombstone. - Secret fragments persist in summaries and in embedding residuals, resurfacing through re-distillation. - The agent cannot self-detect the condition because provenance tags are returned as opaque strings; it must be given `provenance_intact` and must treat `false` as a hard context-injection veto. The corrected architecture makes forget a **graph operation over the provenance DAG**, not a row delete, and makes provenance validation a precondition of context injection rather than a post-hoc audit. ```python from dataclasses import dataclass, field from typing import Optional class DanglingProvenanceError(RuntimeError): """Raised when a derived summary cites a tombstoned/absent episode.""" @dataclass class Episode: id: str text: str content_hash: str live: bool = True @dataclass class Summary: id: str text: str provenance: list[str] source_hashes: dict[str, str] = field(default_factory=dict) quarantined: bool = False class ProvenanceTaggedStore: def __init__(self) -> None: self.episodes: dict[str, Episode] = {} self.summaries: dict[str, Summary] = {} def write_episode(self, ep: Episode) -> None: self.episodes[ep.id] = ep def write_summary(self, s: Summary) -> None: # Provenance closure: every cited episode must be live at write time. for pid in s.provenance: ep = self.episodes.get(pid) if ep is None or not ep.live: raise DanglingProvenanceError( f"summary {s.id} cites non-live episode {pid}; refusing write" ) s.source_hashes[pid] = ep.content_hash self.summaries[s.id] = s def forget(self, episode_id: str, *, secret_bearing: bool) -> dict: ep = self.episodes.get(episode_id) if ep is None or not ep.live: return {"deleted": 0, "tombstone": episode_id} citing = [s for s in self.summaries.values() if episode_id in s.provenance] # Fail closed if reverse index is inconsistent: a citing summary whose # source_hashes lack the episode means the index cannot be trusted. for s in citing: if episode_id not in s.source_hashes: raise DanglingProvenanceError( f"reverse index inconsistent for {s.id}; forget aborted" ) ep.live = False if secret_bearing: # Cascade: secret-bearing summaries cannot be surgically rewritten. for s in citing: s.quarantined = True s.provenance = [p for p in s.provenance if p != episode_id] else: for s in citing: s.provenance = [p for p in s.provenance if p != episode_id] if not s.provenance: s.quarantined = True # Post-condition: no live summary may cite the tombstone. for s in self.summaries.values(): if episode_id in s.provenance and not s.quarantined: raise DanglingProvenanceError( f"forget left dangling tag {episode_id} in {s.id}" ) return {"deleted": 1, "tombstone": episode_id, "quarantined": [s.id for s in citing]} def read(self, summary_id: str) -> dict: s = self.summaries[summary_id] intact = all( self.episodes.get(p) is not None and self.episodes[p].live for p in s.provenance ) if not intact: # Never inject a summary with dangling provenance into context. raise DanglingProvenanceError( f"summary {summary_id} has dangling provenance; veto injection" ) if s.quarantined: raise DanglingProvenanceError( f"summary {summary_id} is quarantined; not served" ) return {"id": s.id, "text": s.text, "provenance_intact": True, "provenance": s.provenance} ```