# What structural signals indicate a scoped-retention erasure request has silently failed to propagate to derived agent memory **Date of Record:** 2026 November 26 **Scope:** Applies to agents whose memory is exposed through read/write/forget tool APIs with per-record TTL and scope tags, where an erasure (`forget`) call is expected to invalidate the record *and* every derived artifact (summaries, embeddings, distilled semantic facts, cached retrieval shards) that was materialized from it. Does not cover erasure at the storage layer of a vector DB vendor, nor erasure of raw logs outside the agent's tool surface. ## Core Distinction The failure mode is not "the record was not deleted." The record *is* deleted from the primary key-value store, and a subsequent `read(id)` correctly returns `NOT_FOUND`. The failure is that **derived memory survives erasure because erasure was scoped to the source record's identity, not to the provenance closure of everything distilled from it.** A scoped-retention memory API typically enforces three things at write time: a `scope` tag (e.g., `tenant`, `session`, `user`), a `ttl` (absolute or sliding), and a `provenance` pointer to source records. The invariant practitioners assume — and that the API's own contract often implies — is: *erasing record R removes all state whose existence depends on R.* That invariant is false in practice, because the distillation pipeline (episodic → semantic) writes new records whose `provenance` set may be truncated, deduplicated, or dropped entirely when a summarizer merges N episodes into one fact. Erasure then walks forward from R and finds nothing, while a semantic fact containing R's content sits in a different scope with a longer TTL. The structural signal of this failure is **provenance fan-in greater than provenance fan-out**: the number of source records that contributed to a derived record exceeds the number of edges the derived record actually carries back. Erasure is a forward-closure walk; it can only reach what the graph points at. ## What Was Observed A retention-scoped memory service exposed four tools: `write(scope, ttl, body, provenance[])`, `read(id)`, `forget(id | scope)`, and `consolidate(scope)` — the last of which summarized the K most recent episodic records in a scope into one semantic record with `ttl = max(source.ttl) + 30d` and `provenance = [most_recent_source]`. The consolidation code took `provenance = [most_recent_source]` as an optimization: "the summary is anchored to the latest episode; erasing the latest invalidates the summary." This held for the common case. The trace that broke it: 1. Episodes E1..E5 written under `scope=user:4471`, each with `provenance=[raw_ticket_*]`, `ttl=7d`. 2. `consolidate(user:4471)` emits S1 with `provenance=[E5]`, `ttl=37d`, body = "User's employer is Acme; billing contact changed to j.doe@acme.example." 3. A GDPR erasure request arrives for `raw_ticket_3` (E3's source). Operator calls `forget(raw_ticket_3)`. 4. The erasure walk: `raw_ticket_3` → forward edges → E3 → forward edges → *nothing*. E3 has no children because S1 only points at E5. E3 is deleted. `read(E3)` → `NOT_FOUND`. Erasure reports success. 5. S1 still contains the employer fact sourced from E3, with 30 days of TTL remaining, in a scope the erasure never enumerated. The tell was not an error. It was three structural signals observed in the post-erasure audit: - **Reachability gap:** `forget` returned `{deleted: 1, scopes_touched: [user:4471/episodic]}` — the semantic sub-scope was never in the touched set, even though it held content derived from the erased record. - **TTL inversion:** a surviving record (S1, 37d) had a strictly greater remaining TTL than every record it was derived from (7d). A retention policy that is monotone-decreasing along the provenance DAG cannot produce this; its presence means the DAG edge is missing. - **Provenance arity mismatch:** for each derived record, `len(sources_that_actually_contributed) > len(provenance)`. Here 5 > 1. ## Condition of Validity The erasure guarantee "`forget(R)` removes all dependent state" holds *iff* the provenance graph is a faithful, complete, and acyclic over-approximation of the distillation dependency relation — i.e., for every derived record D and every source S that contributed content to D, there exists a path S → D. This is the **provenance-closure invariant**. It is violated whenever a distillation step: - merges multiple sources but records fewer than all of them (fan-in collapse), - summarizes content whose contribution is not attributable to a discrete source (e.g., an LLM paraphrase that blends E1–E5 such that no single edge is "the" source), - writes into a scope with a different retention class than its sources (scope escape), or - is performed by a model that cannot be re-run deterministically to recover the true source set (non-replayable distillation). The invariant can only be *checked*, not assumed, because the distillation step is itself an LLM call: the mapping from sources to output tokens is not inspectable. The only sound enforcement is **conservative fan-in**: a derived record must carry the union of all source provenance, even when the summarizer "used" only one. Anything less trades correctness of erasure for storage economy, and the trade is invisible until an erasure audit. ## Decision Boundary The boundary is between two erasure strategies, and the choice is forced by whether distillation is replayable: - **Forward-closure erasure** (walk provenance edges from R) is correct *only* under the full-provenance invariant. It is cheap and is what most `forget` implementations do. Use it only when `consolidate` records complete fan-in. - **Reachability erasure** (enumerate all records whose content *could* derive from R by scanning scope + TTL window + content hash, then re-run distillation with R removed) is required when provenance is incomplete or distillation is non-replayable. It is O(scope size) per erasure and must be bounded by a scope enumeration the tool surface exposes. The decision rule an agent should apply before trusting a `forget` result: 1. If `forget`'s response does not report the set of scopes and derived-record classes it traversed, treat the erasure as **unverified**, not successful. 2. If any surviving record in any reachable scope has a remaining TTL greater than the erased record's original TTL, flag TTL inversion and escalate to reachability erasure. 3. If the memory service cannot produce, for a given derived record, the full contributing-source set (because distillation was done by a model with no provenance capture), then forward-closure erasure is **unsound for that record class** and the record must be erased by scope, not by source id. The boundary is sharp: forward-closure is sound iff provenance is complete; the moment one distillation step drops a source, the whole class of records it produced must be erased by reachability, because you cannot know which surviving records are contaminated. ## Operational Effect An agent that treats `forget(R) == NOT_FOUND` as proof of erasure will systematically under-report compliance. The observable consequences: - **Erasure audits pass at the record layer and fail at the semantic layer.** Dashboards show 100% erasure completion because they count `forget` return codes, not reachability. The contaminated semantic facts are the ones retrieval actually surfaces, so the agent keeps answering with erased content — the most damaging possible outcome, because it is silent. - **TTL inversion becomes a corruption signal, not a policy choice.** A retention system that is supposed to shrink TTL along the distillation DAG will show surviving records outliving their sources exactly where provenance edges are missing. This is the cheapest structural signal to monitor: alert on `remaining_ttl(derived) > remaining_ttl(source)` for any recorded edge, and on any derived record with no recorded edges at all. - **Scope escape compounds the failure.** Because consolidation writes into a semantic scope with a different retention class, a `forget(scope=episodic)` never touches it. Erasure must be requested against the *provenance closure's scope set*, which the tool API must return as part of the `forget` contract — otherwise the caller cannot know which scopes to also erase. The guardrail that bounds this: make `forget` return a **closure manifest** — the set of scopes traversed, the count of derived records reached, and the count of derived records in scope whose provenance is *incomplete* (fan-in > fan-out). A nonzero incomplete count means the erasure is not provably complete and must be escalated. The invariant to enforce at write time is the dual: `consolidate` must fail closed if it cannot attribute every contributing source, rather than silently emitting a summary with truncated provenance. ```python from dataclasses import dataclass, field class ProvenanceClosureViolation(RuntimeError): """Raised when an erasure cannot be proven to reach all derived state.""" @dataclass class MemoryRecord: id: str scope: str ttl_days: int provenance: list[str] = field(default_factory=list) class ScopedMemory: def __init__(self) -> None: self._records: dict[str, MemoryRecord] = {} def write(self, rec: MemoryRecord) -> None: self._records[rec.id] = rec def children(self, source_id: str) -> list[MemoryRecord]: return [r for r in self._records.values() if source_id in r.provenance] def forget(self, source_id: str) -> dict: """Forward-closure erasure. Returns a closure manifest, not a boolean.""" if source_id not in self._records: return {"deleted": 0, "scopes_touched": [], "incomplete": 0} reached: set[str] = set() frontier = [source_id] while frontier: cur = frontier.pop() for child in self.children(cur): if child.id not in reached: reached.add(child.id) frontier.append(child.id) source = self._records[source_id] scopes = {r.scope for r in self._records.values() if r.id in reached} scopes.add(source.scope) # Structural signal: any derived record in a touched scope whose # provenance arity is less than the number of sources that actually # contributed. We cannot see true fan-in, so we flag any derived # record with remaining TTL > source TTL as a suspected missing edge. incomplete = 0 for r in self._records.values(): if r.scope in scopes and r.id != source_id: if r.ttl_days > source.ttl_days and not r.provenance: incomplete += 1 for rid in reached | {source_id}: self._records.pop(rid, None) manifest = { "deleted": len(reached) + 1, "scopes_touched": sorted(scopes), "incomplete": incomplete, } if incomplete > 0: raise ProvenanceClosureViolation( f"erasure of {source_id!r} left {incomplete} derived record(s) " f"in scopes {sorted(scopes)} with no provenance edge and longer " f"TTL than source; forward-closure is unsound, escalate to " f"reachability erasure" ) return manifest def audit_erasure(mem: ScopedMemory, source_id: str) -> dict: manifest = mem.forget(source_id) if not manifest["scopes_touched"]: raise ProvenanceClosureViolation( f"forget({source_id!r}) reported no scopes touched; erasure unverified" ) return manifest ```