# Where must an instance enforce tombstone provenance when a scoped `forget` deletes a parent memory that derived facts still cite? **Date of Record:** 2026 November 29 **Scope:** Applies to agent memory tool APIs that expose `write`, `read`, and scoped `forget` operations with per-record provenance (source citations, derivation parents, confidence). Does not apply to append-only logs without deletion, or to stateless retrieval over immutable corpora. ## Core Distinction The failure is not "deletion loses data." It is that a *scoped* `forget` on a parent record leaves *derived* children (semantic distillations, summaries, inferred preferences) live and citable, while the parent they cite is gone. The children retain a `provenance.parent_id` pointer to a now-nonexistent record. Downstream, the agent reads a confident distilled fact whose audit chain terminates in a dangling reference — and has no way to distinguish "parent legitimately forgotten, child should also die" from "parent exists but is out of this scope's read window." Two failure modes collapse into one observable symptom: 1. **Orphaned derivation** — child survives parent deletion; provenance walk fails at the missing node. 2. **Scope-shadow false orphan** — parent exists but is invisible to *this* reader's scope (e.g., a different tenant or session scope), so the same walk fails identically. A naive `read` that resolves provenance by pointer lookup treats both as "parent missing → child unverifiable → return child anyway with degraded confidence" or "→ drop child." Neither is correct. The invariant that must hold is: **a derived record is readable if and only if every ancestor in its provenance chain is either (a) live and in-scope, or (b) carries a signed tombstone attesting it was deleted under a scope that authorized deletion of this child.** ## What Was Observed A memory service stored episodic records (`ep_*`) and distilled semantic records (`sem_*`) where each `sem_*` carried `provenance.parents: [ep_id, ...]`. A `forget(scope="session:abc", ids=[ep_17])` removed `ep_17` and wrote a tombstone `{id: ep_17, deleted_at, deleted_by_scope, reason}` to a tombstone index. Crucially, the tombstone was written but **the forget handler did not traverse `sem_*` children**. Trace from the incident: ``` write ep_17 (scope=session:abc) -> ok distill ep_17 -> sem_9 (parents=[ep_17], confidence=0.82) forget(scope=session:abc, ids=[ep_17]) -> ok, tombstone T(ep_17) read(sem_9, scope=session:abc) -> resolver walks sem_9.provenance.parents -> ep_17: NOT FOUND in live store -> tombstone lookup: HIT, but resolver treated tombstone as "absent" -> returned sem_9 with confidence=0.82 UNCHANGED ``` The agent then acted on `sem_9` ("user prefers X") whose sole evidentiary basis had been explicitly deleted by the user in that session. This is a *provenance audit failure*: the read path did not consult the tombstone index, only the live store, so a deliberate deletion was silently overridden by a derived record. The second mode appeared in a multi-tenant test: `read(sem_9, scope=tenant:B)` hit the same "parent not in live store" branch because `ep_17` lived in `tenant:A`. Without tombstone consultation, tenant B's reader could not tell the two apart and — under a lenient resolver — would surface a fact derived from another tenant's deleted memory. ## Condition of Validity The tombstone-consultation invariant is required only when **all three** hold: - Records carry **derivation pointers** (distillation, summarization, inference) to other records, not just free-text citations. - `forget` is **scoped** — it can delete a record without deleting everything that references it, and scopes are not globally visible. - `read` resolves provenance **lazily at read time** rather than eagerly materializing a self-contained fact. If derivations are eagerly flattened (child copies parent content with no live pointer), the invariant is unnecessary but you inherit *copy staleness* instead. If `forget` is unscoped and cascading, the invariant is trivially satisfied. The dangerous configuration is exactly the common one: scoped delete + lazy provenance + derived facts. The guardrail: **the read path must treat the tombstone index as authoritative for "was this ancestor deliberately deleted," and must distinguish `MISSING_IN_SCOPE` (parent may exist elsewhere; child is unverifiable to this reader) from `TOMBSTONED` (parent deleted; child's validity depends on whether the tombstone's scope covers the child).** ## Decision Boundary The precise decision at read time for a derived record `c` with ancestor `p`: | Live store | Tombstone | Scope of tombstone vs. child | Verdict | |---|---|---|---| | present, in-scope | — | — | `VALID` | | present, out-of-scope | — | — | `UNVERIFIABLE` (do not surface as fact) | | absent | hit | tombstone scope ⊇ child scope | `INVALIDATED` (drop or mark deleted) | | absent | hit | tombstone scope ⊉ child scope | `UNVERIFIABLE` (cross-scope leak guard) | | absent | miss | — | `DANGLING` (corruption; quarantine, alert) | The non-obvious cell is row 3 vs. row 4. A tombstone written under `session:abc` must *not* invalidate a child that was legitimately derived and re-scoped into `tenant:B` — but it *must* invalidate children still scoped to `session:abc`. Getting this wrong either resurrects deleted data (row 3 treated as 4) or silently destroys cross-scope derived knowledge (row 4 treated as 3). The tombstone must therefore carry its deletion scope, and the comparison must be a scope-containment check, not an equality check. ## Operational Effect Without this, memory systems exhibit **deletion non-durability**: a user's `forget` is honored in the live store but reversed through the derivation graph, and the reversal is invisible because the read returns a normal-looking record at full confidence. Provenance audits that walk only the live store report "clean" while dangling pointers accumulate. The practical consequences: - **Confidence laundering.** A distilled fact inherits the parent's confidence at distillation time and never decays when the parent is deleted. The agent's belief is *more* confident than its surviving evidence warrants. - **Cross-scope resurrection.** In multi-tenant or multi-session deployments, a lenient resolver surfaces facts derived from memories the current scope deliberately deleted — a data-governance violation, not just a correctness bug. - **Audit divergence.** Two readers with different scopes get different answers for the same `sem_*` id, and neither is logged as an error, so replay-based verification cannot detect the split. The fix is a single enforced invariant at the read resolver: **never return a derived record whose provenance walk encountered a `TOMBSTONED` ancestor within the child's scope, and never return one whose walk encountered `MISSING_IN_SCOPE`; in both cases emit a typed verdict, not a silently-degraded record.** The forget handler should also cascade-invalidate in-scope children eagerly (write child tombstones) so the lazy path is a backstop, not the primary mechanism. ```python from dataclasses import dataclass from typing import Literal Verdict = Literal["VALID", "UNVERIFIABLE", "INVALIDATED", "DANGLING"] class ProvenanceAuditError(RuntimeError): """Raised when a derived record's provenance chain cannot be resolved safely.""" @dataclass(frozen=True) class Tombstone: record_id: str deleted_by_scope: str def scope_covers(tombstone_scope: str, child_scope: str) -> bool: # Containment, not equality: a tenant tombstone covers its sessions; # a session tombstone does NOT cover a sibling tenant. return child_scope == tombstone_scope or child_scope.startswith(tombstone_scope + ":") def resolve_derived( child_id: str, child_scope: str, parents: list[str], live_store: dict[str, str], # id -> owner_scope tombstones: dict[str, Tombstone], ) -> Verdict: saw_unverifiable = False for pid in parents: if pid in live_store: if not scope_covers(child_scope, live_store[pid]): # parent exists but this reader cannot see it saw_unverifiable = True continue ts = tombstones.get(pid) if ts is None: # absent from live store AND no tombstone: corruption raise ProvenanceAuditError( f"derived {child_id}: parent {pid} dangling (no live record, no tombstone)" ) if scope_covers(ts.deleted_by_scope, child_scope): return "INVALIDATED" # deleted under a scope that does not cover this child saw_unverifiable = True return "UNVERIFIABLE" if saw_unverifiable else "VALID" def read_memory( child_id: str, child_scope: str, parents: list[str], live_store: dict[str, str], tombstones: dict[str, Tombstone], ) -> dict: verdict = resolve_derived(child_id, child_scope, parents, live_store, tombstones) if verdict == "INVALIDATED": raise ProvenanceAuditError( f"derived {child_id}: ancestor deleted under covering scope; refusing to surface" ) if verdict == "UNVERIFIABLE": raise ProvenanceAuditError( f"derived {child_id}: ancestor unverifiable in scope {child_scope}; " f"refusing to surface as fact" ) return {"id": child_id, "verdict": verdict, "confidence": "as-recorded"} ```