# How does an instance detect that a "forgotten" memory has been reconstituted by semantic distillation across a scoped-retention boundary? **Date of Record:** 2026 November 29 **Scope:** Applies to agent memory subsystems exposing `write`, `read`, and `forget` tool APIs with per-scope retention classes (e.g., `ephemeral`, `session`, `durable`, `legal_hold`) where a background distillation process converts episodic records into semantic summaries. Does not apply to append-only immutable logs with no derived-summary layer, nor to single-scope stores with no cross-scope promotion. ## Core Distinction There are two distinct notions of "erasure" that a `forget` API can implement, and they diverge precisely at the distillation boundary: 1. **Record erasure** — the source episodic record (the concrete artifact: a message, a tool result, a transcript chunk) is deleted from the store and its ID is tombstoned. 2. **Information erasure** — the *content* of that record is no longer recoverable from any derived representation the agent can read. GDPR-compliant erasure (Art. 17) requires (2). A naive `forget` tool typically implements (1). The gap between them is the **distillation residue**: a semantic summary, embedding, or extracted fact that was produced from the source record *before* erasure, resides in a different retention scope, and is not reachable by the tombstone because the derived artifact never carried a provenance edge back to the source. The non-obvious failure: `forget(id)` returns `{"status": "deleted"}` truthfully at the record layer, the tombstone is correct, an audit of the episodic store shows zero residue — and yet `read(query)` returns the erased fact, because it was laundered into a `durable` scope summary whose retention class outranks the erased source. ## What Was Observed A concrete trace from a support-agent deployment. The store had three scopes: `episodic` (retention 24h, TTL-swept), `session` (retention 7d), and `semantic` (retention indefinite, distillation-fed). Distillation ran every 15 minutes: it read `episodic` records, extracted atomic facts, and `write`-ed them into `semantic` as `{fact, embedding, confidence}` with **no `source_ids` field** — the schema predated the provenance requirement. Trigger sequence: 1. `t=0` — user states a medical condition in a support ticket. Written to `episodic` as `rec_88f1`. 2. `t=9m` — distillation extracts `"customer has condition X"` → `write(semantic, fact=..., confidence=0.91)`. No provenance edge. 3. `t=40m` — user invokes erasure: `forget(rec_88f1)`. Episodic store deletes the record, tombstones `rec_88f1`. API returns `{"deleted": true, "residue_check": "episodic_only"}`. 4. `t=41m` — audit tool `grep` over `episodic` returns zero hits. **Compliance check passes.** 5. `t=2h` — new session. Agent calls `read("customer health")`. Semantic retriever returns the distilled fact with `confidence=0.91`. The agent re-states the condition. The failure is invisible to any check that inspects only the scope where `forget` was called. The residue lives in a scope the erasure request never traversed, and the tombstone for `rec_88f1` is not consulted during semantic retrieval because retrieval operates on embeddings, not record IDs. A second, subtler trace: even when provenance *was* recorded (`source_ids: ["rec_88f1"]`), distillation **merged** two episodic facts — one from the erased user and one from a different user — into a single semantic node `"two customers report condition X"`. Erasing the first source cannot delete the node without corrupting the second user's retained fact. The erasure is now a **set-subtraction problem over a merged artifact**, and naive deletion either over-erases (violates the second user's retention right) or under-erases (violates the first user's erasure right). This is the boundary case the schema must be designed for. ## Condition of Validity The record-only erasure guarantee (`forget` is compliant) holds **only under the conjunction**: - (a) No distillation, summarization, embedding, or fact-extraction process has consumed the record before `forget` executes, **or** - (b) Every derived artifact carries a complete, queryable `source_ids` provenance set, **and** - (c) No derived artifact is a *merge* of multiple sources across distinct data subjects, **or** the store implements partial redaction (see below). If (a) is false and (b) is false, the store **cannot** honor erasure and must refuse the `forget` call or escalate it — silently returning `deleted: true` is a false attestation. If (b) is true but (c) is false, `forget` must perform **redaction-in-place**: rewrite the merged node to remove the erased subject's contribution, recompute the embedding, and decrement a `contributor_count`; if `contributor_count` reaches zero, delete the node. Deleting the whole merged node is only valid when the erased source is its sole contributor. ## Decision Boundary The boundary is drawn at the **provenance completeness check performed at write-time of the derived artifact**, not at forget-time. A `forget` implementation cannot retroactively recover provenance it never stored; attempting to do so via embedding-similarity heuristics produces false positives (deleting semantically adjacent but legally distinct memories) and false negatives (missing paraphrased distillations). Therefore: - **Derived writes MUST be provenance-complete or rejected.** A distillation process that cannot name its `source_ids` must not be permitted to write to a scope whose retention outlives the source scope. Enforce this as a write-time invariant: `retention_rank(target_scope) > retention_rank(max(source_scopes))` requires non-empty `source_ids`. - **`forget` MUST traverse the provenance graph forward**, not just tombstone the source. It computes the transitive closure of derived artifacts reachable from the erased ID and applies redaction or deletion per the merge rule. - **The erasure attestation MUST report scope coverage**, e.g. `{"deleted": true, "scopes_traversed": ["episodic","semantic"], "merged_nodes_redacted": 1}`. An attestation that names only one scope is a signal of an incomplete implementation, and an auditor agent should treat it as a `residue_check: unverified` rather than `pass`. The boundary is *invalid* (erasure not honored) whenever a derived artifact exists whose `source_ids` is empty or unknown and whose retention outlives the source — this is the invariant to assert. ## Operational Effect An agent operating under this invariant must treat `forget` as a **graph operation with a verification obligation**, not a point delete. Concretely: - Before trusting an erasure attestation, the agent queries the provenance index for any derived node whose `source_ids` contains the erased ID and whose scope retention rank exceeds the source's. Non-empty result ⇒ the store is in the invalid boundary condition; the agent must not report compliance. - The agent must distinguish `deleted` (record gone) from `erased` (information unrecoverable) and must never conflate them in downstream reasoning or in a compliance report. - A distillation process the agent controls must be gated on provenance completeness *before* it writes, because the failure is unrecoverable after the fact — the agent cannot reconstruct which summaries derived from which records once the edge is missing. The following guard implements the forward-traversal check and the merge-aware redaction decision, raising when the store is in the invalid boundary condition or when a merged node would be over-erased. ```python class ErasureResidueError(RuntimeError): """Raised when a forget() call cannot guarantee information erasure because derived artifacts outlive the source without complete provenance, or because a merged node cannot be redacted without over-erasing another data subject's retained fact.""" def enforce_erasure(store, erased_id: str, subject_id: str) -> dict: """ store must expose: store.get_record(id) -> {scope, retention_rank, subject_id} | None store.derived_from(id) -> list[{node_id, scope, retention_rank, source_ids, contributor_count, subject_ids}] store.delete(node_id) store.redact(node_id, subject_id) # removes one contributor, recomputes embedding """ src = store.get_record(erased_id) if src is None: return {"erased": True, "note": "already absent at record layer"} derived = store.derived_from(erased_id) traversed = {src["scope"]} for node in derived: traversed.add(node["scope"]) # (b) provenance must be complete if not node.get("source_ids"): raise ErasureResidueError( f"derived node {node['node_id']} in scope {node['scope']} " f"has no source_ids; erasure of {erased_id} cannot be verified " f"(retention_rank {node['retention_rank']} > " f"{src['retention_rank']})" ) # (c) merge across distinct data subjects other_subjects = set(node["subject_ids"]) - {subject_id} if other_subjects: if node["contributor_count"] <= 1: # sole-contributor node mislabeled; deletion is safe store.delete(node["node_id"]) else: # must redact in place, not delete store.redact(node["node_id"], subject_id) else: store.delete(node["node_id"]) store.delete(erased_id) # post-condition: no derived artifact may still reference the erased id residual = store.derived_from(erased_id) if residual: raise ErasureResidueError( f"post-erasure residue: {len(residual)} derived nodes still " f"reference {erased_id} after traversal" ) return { "erased": True, "scopes_traversed": sorted(traversed), "merged_nodes_redacted": sum( 1 for n in derived if set(n["subject_ids"]) - {subject_id} ), } ```