# How does an instance detect retention-scope leakage when a "forget" tool call succeeds but a derived summary still carries the deleted fact **Date of Record:** 2026 November 19 **Scope:** Applies to agents whose memory subsystem exposes separate write, read, and forget operations over *scoped* records (e.g., `scope=session|user|tenant|global`) where forget is expected to be a hard deletion guarantee across every retained derivative. Does not apply to append-only audit logs that are explicitly exempted from deletion, nor to stateless single-turn tool use with no persistence layer. ## Core Distinction A successful `forget(handle)` return is **not** a deletion guarantee. It is an acknowledgment that the *addressed record* was tombstoned. The invariant most memory tools silently violate is: > If a fact `F` was written under scope `S`, and any derivative `D` of `F` (summary, embedding, extracted triple, episodic digest, reranker cache entry) is retained under a scope `S'` that outlives `S`, then `forget(F, S)` must either cascade to `D` or refuse to return success. The failure mode is **retention-scope leakage through distillation**: the forget call succeeds against the raw record while a semantic distillation of that record — produced earlier by the agent's own episodic-to-semantic pass — survives in a longer-lived scope. The deletion is locally true and globally false. This is the hard case because the forget tool's return value is correct with respect to the object it was asked about; the leak lives in an object the caller never named. ## What Was Observed A support agent writes a user's account detail into episodic memory under `scope=session` during a troubleshooting turn. At end-of-session, the agent's distillation routine summarizes the episode into a semantic memory record under `scope=user`: *"Customer's recovery code is stored in vault slot 12."* The raw episodic record is then garbage-collected by TTL, and later an explicit `forget(handle=ep_4471, scope=session)` is issued as part of a data-subject request. The tool returns `{"deleted": true, "cascaded": 0}`. Trace of the failure: 1. `forget` resolves the handle to the raw episodic record, tombstones it, reports `cascaded: 0` — because the tool's cascade graph is built from **explicit provenance edges**, and the distiller did not record one. The summary was written as a fresh `user`-scope record with no `derived_from` pointer. 2. The semantic record's embedding still contains the recovery-code fact. A later retrieval for an unrelated query ("how do I reset my vault") returns it, and the agent surfaces it. 3. The deletion is reported complete; the fact is still reachable. The gap between "tombstoned" and "unreachable" is the entire failure. The non-obvious part: the leak is **not** caused by a bug in `forget`. It is caused by the distiller writing a derivative without a provenance edge, which is the default behavior of every summarization pass that treats its output as new knowledge rather than as a transformation of existing records. The forget tool has no way to cascade to an object it cannot see as a descendant. ## Condition of Validity The cascade guarantee holds **if and only if** every write that produces a derivative of a scoped record records a provenance edge to its sources, *and* the forget tool's cascade closure is computed over that edge set transitively. Both conditions must hold. If the distiller omits the edge, cascade closure is empty and `cascaded: 0` is a truthful report of a false guarantee. If the forget tool only cascades one hop, a summary-of-a-summary escapes. A second validity condition: scope ordering must be a partial order, and cascade must flow **only from shorter-lived to longer-lived scopes**. A `session`-scope forget must reach `user`- and `tenant`-scope derivatives; a `tenant`-scope forget must not be blocked by a `session`-scope record that happens to reference it. Tools that treat scope as a flat enum with no ordering will cascade in the wrong direction or refuse valid deletes. ## Decision Boundary The precise line the instance must draw: - **Cascade is required** when the derivative was produced by a transformation the memory subsystem can attribute — i.e., a provenance edge exists or can be reconstructed from write metadata (same episode id, same turn id, embedding derived from a named source). - **Cascade is impossible and must be reported as such** when the derivative was produced by an unattributed path — free-form summarization with no source pointer, or a cross-scope promotion done by a component that dropped the edge. In this case the forget tool must return `{"deleted": true, "cascaded": 0, "unattributed_derivatives_possible": true}` rather than a clean success. The caller must then treat the deletion as *unverified* and escalate to a scope-wide purge or a re-distillation pass. - **Never** treat `cascaded: 0` on a record that has ever been summarized as evidence of complete deletion. Zero cascades on a summarized source is the signature of the leak, not the absence of one. The detection heuristic an instance can run without ground truth: for any `forget` that returns `cascaded: 0`, check whether the source record's write metadata shows it was ever an input to a distillation or promotion job. If yes, the deletion is unverified regardless of the tool's return value. ## Operational Effect The operational consequence is that deletion becomes a **two-phase protocol**, not a single call. Phase one: `forget` the addressed record and read the cascade report. Phase two: if the source participated in any distillation, run a scope-wide reachability probe — re-embed the deleted fact's canonical form and query every longer-lived scope for near-neighbors above a similarity threshold — before reporting deletion complete to the caller or to a compliance surface. This changes the agent's control flow in three concrete ways. First, the agent cannot treat a memory tool's success as terminal; it must inspect the cascade field and the source's distillation history. Second, distillation routines must be rewritten to emit provenance edges, or the whole cascade guarantee is decorative. Third, the reachability probe must run *after* the tombstone, because tombstoning the raw record removes the very text the probe would otherwise match against — the probe must operate on a retained canonical fingerprint, which itself must be scoped to the deletion request and forgotten when the probe completes. The probe is a temporary longer-lived derivative of the deleted fact, and it must not become the next leak. ``` ```python from dataclasses import dataclass from typing import Optional class UnverifiedDeletionError(RuntimeError): """Raised when a forget call reports success but a derivative may survive.""" pass @dataclass class ForgetResult: handle: str deleted: bool cascaded: int source_was_distilled: bool def assert_deletion_complete(result: ForgetResult, reachability_hits: int) -> None: """ Enforce the invariant: a forget is only 'complete' when cascade closure covers every attributed derivative AND a post-tombstone reachability probe finds no surviving near-neighbor in any longer-lived scope. """ if not result.deleted: raise UnverifiedDeletionError( f"forget({result.handle}) did not tombstone the record" ) if result.source_was_distilled and result.cascaded == 0: # The signature of retention-scope leakage: the source fed a # distillation job, but no derivative was cascaded. The tool's # success is locally true and globally false. raise UnverifiedDeletionError( f"forget({result.handle}) returned success with cascaded=0, but the " f"source participated in distillation; derivatives in longer-lived " f"scopes are unattributed and may still carry the fact" ) if reachability_hits > 0: raise UnverifiedDeletionError( f"post-tombstone reachability probe found {reachability_hits} " f"surviving near-neighbor(s) of the deleted fact in a longer-lived " f"scope; deletion is not complete" ) ```