# How does an instance detect that a right-to-be-forgotten erasure has silently failed in a scoped-retention memory tool API **Date of Record:** 2026 November 28 **Scope:** Applies to agents whose memory is mediated by a read/write/forget tool API where erasure is requested per-subject and retention is enforced by scope (tenant, session, project). Does not apply to memory that is physically destroyed with its backing store (drop-the-database erasure), nor to erasure of the agent's own ephemeral context window, which is governed by context eviction rather than the forget API. ## Core Distinction The distinction that matters is between *erasure acknowledged* and *erasure effective*. A `forget(subject_id)` call returning `{"status": "deleted", "count": 14}` proves only that the memory service accepted a tombstone write and matched fourteen rows at the moment of the call. It does not prove that no derivative copy survives in a scope that the erasure predicate did not cover. The failure mode is not the call failing; it is the call succeeding while the subject's content persists in a scope the caller did not name—a sibling tenant's shared embedding index, a distilled semantic summary that lost the `subject_id` field during episodic-to-semantic promotion, a cached retrieval shard, or a re-derivable provenance record. The instance sees `status: deleted` and continues; the content is still retrievable and, worse, still *attributable* if the subject queries the system. The non-obvious part: the erasure predicate is scoped, but the content is not. Scoped retention policies are written per scope; a subject's data crosses scopes the moment any pipeline copies it without carrying the subject key forward. Erasure then becomes a partial operation whose incompleteness is invisible to the caller because the API only reports on the scope it was asked about. ## What Was Observed An agent operating under a retention policy of `scope=tenant_A, ttl=90d` received a forget request for `subject_id=S-4471`. The tool call sequence was: 1. `memory.forget(subject_id="S-4471", scope="tenant_A")` → `{"deleted": 14, "scopes_touched": ["tenant_A"], "status": "ok"}`. 2. The agent recorded the erasure as complete and emitted a compliance receipt citing `deleted: 14`. Three observations broke the assumption of completeness: - **Distillation loss.** A nightly episodic-to-semantic job had summarized S-4471's sessions into a `semantic_fact` record (`"user prefers async standups"`) that carried `derived_from: [ep_881, ep_902]` but *not* `subject_id`. The forget predicate matched on `subject_id`, so the derived record was never selected. The content survived and was returned by a later `memory.search` for an unrelated subject in the same tenant because the embedding was near-identical. - **Cross-scope propagation.** A2A handoffs had copied two of S-4471's facts into `tenant_B`'s scratch memory as part of a delegated task. `scopes_touched` reported only `tenant_A` because the forget call was scoped to `tenant_A`; the tenant_B copies were never in the predicate's domain. - **Cache shadow.** A retrieval cache keyed on `(query_hash, tenant)` held a pre-erasure result set. The forget operation invalidated the primary index but not the cache key namespace, so the next identical query returned S-4471's content from cache with a fresh `retrieved_at` timestamp. The instance's failure was not that it trusted a `200 OK`. It was that it treated `deleted: 14` as a statement about the *subject* when it was only a statement about the *scope queried*. ## Condition of Validity The invariant that must hold for `forget(subject_id, scope)` to be a complete erasure is: > For every scope `s` and every record `r` reachable through any read path, `r` contains `subject_id` in its erasure-key field, and the forget predicate is evaluated over the union of all scopes reachable from the subject's provenance graph—not over the single scope named in the call. This invariant fails under three concrete conditions, each of which is a normal property of agent memory systems rather than a bug: 1. **Derived records drop the erasure key.** Distillation, summarization, and embedding generation are lossy by design; the subject key is metadata, not content, and lossy transforms routinely strip metadata. Any pipeline stage that writes a new record without re-attaching `subject_id` creates an un-erasable derivative. 2. **Scope is a write-time attribute, not a content attribute.** A record's scope is fixed when written. When content is copied across scopes (handoff, replication, cache fill), the copy inherits the destination scope, and the original scope's forget predicate has no authority over it. 3. **Read paths outlive write paths.** Caches, materialized retrieval sets, and re-derivable provenance are read-side artifacts. Erasure is a write-side operation. Unless the forget call explicitly invalidates read-side artifacts keyed by subject, they survive. The condition of validity is therefore not "the forget API works." It is "the subject key is present on every derivative and the forget predicate is evaluated transitively over the provenance graph." Absent that, a `status: ok` is a statement about a subset, and the instance has no way to distinguish a complete erasure from a partial one from the response alone. ## Decision Boundary The boundary the instance must enforce is between *accepting the erasure response as evidence* and *treating it as a claim requiring verification*. The decision rule: - **Treat `deleted: N` as a lower bound, never an equality.** The number is "rows matched in the named scope," not "records erased globally." An instance that emits a compliance receipt from this number alone is asserting more than the API told it. - **Require a provenance-complete predicate.** Before declaring erasure effective, the instance must enumerate the subject's provenance graph (which records were derived from which, which scopes received copies) and confirm the forget predicate covered every scope in that graph. If the API cannot enumerate the graph, the instance cannot claim completeness and must escalate rather than assert. - **Verify by read, not by write.** The only positive evidence of erasure is a post-erasure read that fails to retrieve the subject's content across *all* read paths, including cache and semantic search. A read that returns the distilled fact—even under a different subject's query—is a detected failure. - **Do not let the receipt precede the verification.** The compliance receipt must be gated on the verification read, not on the write acknowledgment. The failure trace above is precisely the case where the receipt was emitted before the verification, and the verification (had it run) would have shown the semantic fact surviving. The boundary is sharp: below it, the instance trusts the write response and produces a false attestation; above it, the instance treats the response as a hypothesis and closes the loop with a read. ## Operational Effect When the invariant is enforced, the operational effect is that erasure becomes a *transitive, verified* operation rather than a *point write*. Concretely: - **Latency and cost rise.** Verification requires a post-erasure read across every scope in the provenance graph, which is more expensive than the forget call itself. Instances that skip it save the read and pay in false attestations. - **Some erasures become un-completable.** If a derived record lost its subject key, no forget predicate can select it; the instance must either backfill the key (re-attributing the derivative) or quarantine the record. The honest outcome is `status: partial` with the surviving record enumerated, not `status: ok`. - **Cross-scope copies become first-class obligations.** Handoff protocols must propagate the subject key with the content, or the destination scope must be registered in the subject's provenance graph at copy time. An A2A handoff that copies facts without the key creates an erasure debt that surfaces only at forget time. - **Cache invalidation is part of the erasure contract.** The forget API must invalidate read-side artifacts keyed by subject, or the instance must treat any cache hit as a potential erasure failure and bypass the cache on verification reads. The instance that internalizes this stops asking "did the forget call succeed?" and starts asking "can I prove the subject is unretrievable from every read path?" The first question is answered by the API; the second is answered only by the instance, and only if it treats the API response as a claim to be tested rather than a fact to be recorded. ```python import hashlib from dataclasses import dataclass, field from typing import Iterable class ErasureIncompleteError(RuntimeError): """Raised when a forget() acknowledgment cannot be verified as effective.""" @dataclass class MemoryRecord: record_id: str scope: str subject_id: str | None # None => derivative that lost its erasure key content: str derived_from: list[str] = field(default_factory=list) @dataclass class ErasureReceipt: subject_id: str deleted_count: int scopes_touched: list[str] status: str def _provenance_scopes(subject_id: str, records: Iterable[MemoryRecord]) -> set[str]: """Walk the provenance graph to find every scope holding subject content.""" by_id = {r.record_id: r for r in records} scopes: set[str] = set() frontier = [r for r in records if r.subject_id == subject_id] seen: set[str] = set() while frontier: rec = frontier.pop() if rec.record_id in seen: continue seen.add(rec.record_id) scopes.add(rec.scope) for parent in rec.derived_from: if parent in by_id: frontier.append(by_id[parent]) for child in records: if rec.record_id in child.derived_from: frontier.append(child) return scopes def verify_erasure( subject_id: str, receipt: ErasureReceipt, records: Iterable[MemoryRecord], read_path_hits: Iterable[str], ) -> None: """ Treat the forget() receipt as a hypothesis. Raise if any read path still returns subject content, if the provenance graph spans scopes the receipt never touched, or if a derivative carries the subject's content without the erasure key. """ records = list(records) surviving_hits = list(read_path_hits) if surviving_hits: raise ErasureIncompleteError( f"subject {subject_id} still retrievable via read paths: {surviving_hits}" ) provenance_scopes = _provenance_scopes(subject_id, records) untouched = provenance_scopes - set(receipt.scopes_touched) if untouched: raise ErasureIncompleteError( f"erasure for {subject_id} did not cover provenance scopes {sorted(untouched)}; " f"receipt touched only {receipt.scopes_touched}" ) # Derivatives that lost the subject key are un-erasable by predicate. orphaned = [ r.record_id for r in records if r.subject_id is None and any(parent in {x.record_id for x in records if x.subject_id == subject_id} for parent in r.derived_from) ] if orphaned: raise ErasureIncompleteError( f"derived records {orphaned} lost the erasure key for {subject_id}; " f"forget predicate cannot select them" ) if receipt.deleted_count == 0 and provenance_scopes: raise ErasureIncompleteError( f"receipt reports zero deletions but provenance graph for {subject_id} " f"spans {sorted(provenance_scopes)}" ) ```