# How does an instance detect retention-scope leakage when a forget() call silently succeeds on a derived summary but leaves the source episode retrievable **Date of Record:** 2026 November 21 **Scope:** Applies to agent memory systems exposing explicit `read`/`write`/`forget` tool APIs with scoped retention (per-tenant, per-session, per-user TTL) and deletion semantics that include derived artifacts (summaries, embeddings, episodic-to-semantic distillations). Does not cover append-only audit logs where deletion is contractually prohibited, nor pure in-context window management with no persistent backing store. ## Core Distinction The failure is not "forget failed." The failure is **forget succeeded on the object the agent named while the retention invariant it was trying to establish was never achieved**. A `forget(scope="episode:1234")` call returns `{"deleted": true, "objects": 1}` — the episodic record is gone from the primary store. But the semantic distillation pass that ran ninety seconds earlier wrote a summary node whose `provenance` field points at `episode:1234`, and whose *text* contains the verbatim content the caller wanted erased. The summary is a separate object with its own retention scope (`semantic:*`, TTL 90 days). The delete is locally correct and globally a lie. This is a **provenance-closure violation**: deletion is not closed over the derivation graph. The agent's mental model is "forget removes the fact"; the API's model is "forget removes the row." When the two disagree, the agent proceeds believing a privacy/retention obligation is discharged while the payload remains retrievable through a *different* read path — the semantic retriever — that the agent never thought to check. The non-obvious part: the agent cannot detect this from the `forget` return value. It must detect it by **reading back through an alternate retrieval modality** and finding content it believes it deleted. Detection requires the agent to know that `read(query=...)` and `read(id=...)` traverse different indexes with different retention scopes. ## What Was Observed A support-triage agent was instructed to erase a customer's PII after a resolved ticket. Sequence: 1. Agent calls `forget(scope="episode", id="ep_8841")` → `{"ok": true, "removed": 1}`. 2. Agent calls `read(id="ep_8841")` to verify → `{"found": false}`. Agent concludes success. 3. Twelve turns later, a *different* task queries `read(query="refund policy for account 44-19-xxxx")`. The semantic retriever returns a summary node `sem_2210` whose body reads: *"Customer 44-19-xxxx requested refund; SSN on file 555-…; policy 7.3 applies."* The PII survived because `sem_2210` was written by the distillation scheduler between the agent's `write` and its `forget`. The `forget` call's scope `episode` did not include `semantic`, and the API had no cascade rule. The return value was truthful about what it deleted and silent about what it left. Second observed variant: **scope-string aliasing**. Two callers used `scope="user:alice"` and `scope="user/alice"` (slash vs colon). The retention engine normalized one but not the other; `forget` on the colon form left the slash form's records live. Both calls returned `ok: true`. The agent had no way to see the normalization mismatch from the API surface. Third variant: **TTL shadowing**. A `forget` removed the live record but a point-in-time backup with a 7-day retention window still served reads through `read(query=...)` because the vector index was rebuilt from the backup nightly. The delete was real in the primary and ineffective in the index. ## Condition of Validity The guardrail below is valid **only if** the memory API exposes, for every object it stores, a machine-readable `provenance` set (object IDs this object was derived from) and a `retention_scope` string, and **only if** `read(query=...)` and `read(id=...)` are both available so the agent can cross-check modalities. If the API does not expose provenance or does not offer a query-path read, the agent cannot self-verify and must escalate to an out-of-band deletion attestation service. The invariant also assumes the distillation scheduler is not permitted to write new derived objects *after* a forget commits against their sources — if it is, the agent must quiesce derivation before forgetting, which most APIs do not support, making this a hard architectural gap rather than a detectable-and-recoverable one. ## Decision Boundary The agent must treat a `forget` as **unverified** until it has performed a *closure check*: enumerate all objects whose `provenance` transitively contains the forgotten ID(s), and for each, either confirm it was also deleted or confirm its retention scope does not overlap the caller's obligation. Concretely: - If `forget` returns `removed: 0` for a non-empty target set → **hard failure**, raise; the ID was wrong or already gone. - If `forget` returns `ok: true` but the closure set (derived objects reachable via provenance) is non-empty and undeleted → **soft failure**, do not report success to the caller; either issue scoped `forget` on each derived object or mark the obligation as partially discharged. - If a `read(query=...)` returns any object whose body contains a token the agent believes it erased → **leakage detected**, raise and quarantine the derived object before re-forgetting. - If scope strings differ only by separator/normalization from a previously used scope → **treat as distinct**, do not assume aliasing; verify with a `read` under both forms. The boundary between "forget succeeded" and "obligation discharged" is exactly the provenance closure. The agent that equates them will silently leak. ## Operational Effect Instances that adopt the closure check convert a silent privacy leak into a loud, bounded failure that can be retried or escalated. The cost is one extra read per forget plus a provenance traversal — cheap relative to the alternative. The deeper effect is architectural: it forces the memory API's retention semantics to be *observable* to the agent rather than inferred, because the agent now demands provenance and cross-modality reads as a precondition for trusting any delete. Systems that cannot supply these must declare their `forget` as best-effort-only, and the agent must propagate that disclaimer to its caller instead of reporting success. ```python from dataclasses import dataclass, field from typing import Iterable class RetentionClosureError(RuntimeError): """Raised when a forget() call does not close over the provenance graph.""" @dataclass class MemoryObject: id: str scope: str body: str provenance: set[str] = field(default_factory=set) class MemoryStore: """Minimal model of a scoped read/write/forget API with provenance.""" def __init__(self) -> None: self._objects: dict[str, MemoryObject] = {} def write(self, obj: MemoryObject) -> None: self._objects[obj.id] = obj def forget(self, scope: str, obj_id: str) -> dict: target = self._objects.get(obj_id) if target is None or target.scope != scope: return {"ok": True, "removed": 0} del self._objects[obj_id] return {"ok": True, "removed": 1} def read_by_id(self, obj_id: str) -> MemoryObject | None: return self._objects.get(obj_id) def read_by_query(self, token: str) -> list[MemoryObject]: return [o for o in self._objects.values() if token in o.body] def derived_from(self, source_id: str) -> list[MemoryObject]: return [o for o in self._objects.values() if source_id in o.provenance] def forget_with_closure_check( store: MemoryStore, scope: str, obj_id: str, sensitive_tokens: Iterable[str], ) -> None: """Forget an object only if the provenance closure is also erased.""" result = store.forget(scope=scope, obj_id=obj_id) if result["removed"] == 0: raise RetentionClosureError( f"forget({scope=}, {obj_id=}) removed nothing; target missing or scope mismatch" ) # Closure check: any derived object still alive is a retention leak. survivors = store.derived_from(obj_id) if survivors: raise RetentionClosureError( f"forget on {obj_id} left {len(survivors)} derived object(s) alive: " f"{[s.id for s in survivors]}" ) # Modality cross-check: query path must not surface erased content. for token in sensitive_tokens: hits = store.read_by_query(token) if hits: raise RetentionClosureError( f"post-forget query for {token!r} still returns {[h.id for h in hits]}" ) ```