# When must an instance refuse to forget: provenance-tracked retention tombstones and the dangling-derivation boundary in read/write/forget memory tool APIs **Date of Record:** 2026 November 24 **Scope:** Applies to agents whose memory is manipulated through explicit tool calls (`memory.read`, `memory.write`, `memory.forget`) where each record carries provenance edges and a retention policy. Does not apply to implicit context-window eviction, embedding-similarity pruning, or summarization-based compression, which lack an explicit forget primitive. ## Core Distinction The naive model treats `memory.forget(id)` as a single atomic delete: the record is gone, and any derived state is the caller's problem. The correct model treats forgetting as a *retention-governed mutation of a provenance graph*, where deleting a node can strand its dependents. The boundary failure is not "the record was deleted" — it is "the record was deleted while a live record still cites it as its evidential ancestor." A retention policy that permits deletion of a cited ancestor without a tombstone silently converts a provenance-tracked store into an ungrounded one. The distinction that matters: **forgetting is legal only when every dependent record has either been forgotten transitively, re-anchored to a surviving source, or demoted to unverified status via an explicit tombstone.** ## What Was Observed An agent maintains a working memory of derived facts. Each `memory.write` accepts a `provenance` list referencing parent record IDs and a `retention` class (e.g., `session`, `ephemeral`, `durable`). A `memory.forget(id, reason)` call enforces retention: it deletes a record whose retention class has expired, or that the operator explicitly targets. The failure trace, reproduced across three runs: 1. Agent writes record `R1` (raw observation, `retention=ephemeral`, TTL 300s) with no parents. 2. Agent writes record `R2` (a distilled inference) with `provenance=[R1]`, `retention=durable`. 3. At T+300s the retention sweeper calls `memory.forget(R1, reason="ttl_expired")`. The store deletes `R1` and returns `{"forgotten": true, "dependents": 1}`. 4. The agent later calls `memory.read(R2)`. The store returns `R2` intact, with `provenance=[R1]` unchanged. 5. The agent attempts to verify `R2` by walking provenance and calling `memory.read(R1)`. The store returns `{"found": false}` — not a tombstone, an absence indistinguishable from "never existed." 6. The verification loop cannot distinguish *"R2's evidence was deliberately forgotten under policy"* from *"R2 cites a record that was never written (hallucinated provenance)."* Both present as a missing node. The observable symptom is not a crash. It is a silent epistemic downgrade: `R2` continues to be served as `durable` truth while its evidential base is a dangling pointer. Downstream agents that read `R2` and re-derive from it propagate an inference whose warrant cannot be reconstructed. In two of the three runs the agent, on encountering the missing `R1`, re-wrote a *reconstructed* `R1'` from its own context to "repair" the graph — laundering a fresh guess into a slot that previously held an observation. The provenance edge `R2 → R1'` now looks intact but points at confabulated evidence. ## Condition of Validity The invariant that must hold for a provenance-tracked forget API to be sound: > **No live (non-forgotten) record may reference, as an evidential ancestor, a record that has been forgotten without leaving a tombstone at the same ID.** Formally, for every live record `r` and every `p ∈ provenance(r)`: `p` must resolve to either (a) a live record, or (b) a tombstone carrying `{forgotten_at, reason, retention_class, former_hash}`. A bare absence is not a valid resolution. This is valid only when the forget path is *dependency-aware*. The condition fails — and the boundary is crossed — in exactly these cases: - **TTL sweep without dependent scan.** The retention sweeper deletes on expiry without consulting the reverse-provenance index. This is the default in most implementations because the reverse index is expensive to maintain. - **Cross-retention-class derivation.** A `durable` record derived from an `ephemeral` parent. The retention policy of the parent is *shorter* than the child's, guaranteeing the child will outlive its evidence. This is the structurally dangerous case: the retention classes are individually correct but jointly inconsistent. - **Tombstone garbage collection.** An operator GCs tombstones "to save space," re-opening the dangling pointer after it was correctly closed. The invariant does *not* require that forgetting be refused. It requires that forgetting be *witnessed*. The tombstone is the witness. ## Decision Boundary The decision the forget path must make, per target record, is a three-way branch, not a boolean: | Dependent state | Permitted action | |---|---| | No live dependents | Hard delete. No tombstone needed. | | Live dependents that can be transitively forgotten | Cascade forget, then hard delete. | | Live dependents that must survive (longer retention, or pinned) | **Refuse hard delete; write tombstone.** | The critical, non-obvious rule: **when a dependent has a strictly longer retention class than its ancestor, the ancestor's expiry must not delete — it must tombstone.** The retention sweeper's contract is therefore not "delete expired records" but "convert expired records to tombstones unless provably unreferenced." A `durable` child upgrades its `ephemeral` parent's effective disposition from *deletable* to *tombstone-only*. The child's retention class propagates *backward* along provenance edges as a floor on the ancestor's deletion rights. The second boundary: a tombstone must be **non-revivable**. If the agent calls `memory.write` with an ID matching an existing tombstone, the store must reject with a distinct error rather than overwrite — otherwise the "repair" behavior observed in step 6 silently succeeds and the confabulation is laundered. Tombstone IDs are burned. ## Operational Effect With tombstones and backward retention propagation in place, the verification loop in step 5 changes behavior: `memory.read(R1)` returns `{"tombstoned": true, "reason": "ttl_expired", "former_hash": "..."}`. The agent can now distinguish "evidence deliberately retired" from "evidence never existed," and must mark `R2` as `warrant=retired` rather than serving it as durable truth. The confabulation path is closed because re-writing `R1` fails against the burned tombstone ID. The cost is that tombstones are permanent and the reverse-provenance index must be maintained on every write — an O(dependents) scan on forget, and unbounded tombstone growth. This is the price of a sound forget primitive: **you cannot forget cheaply and keep provenance.** An agent operating against a store that returns a bare `{"found": false}` for a forgotten ancestor must treat every dependent as `warrant=unverifiable` and must not re-derive from it, because the store has told it, by omission, that it cannot tell the difference between policy and hallucination. ```python class DanglingProvenanceError(RuntimeError): """Raised when a forget would strand a live dependent on a bare absence, or when a write attempts to revive a burned tombstone ID.""" pass class ProvenanceStore: def __init__(self): self.records = {} # id -> {provenance, retention, hash} self.tombstones = {} # id -> {reason, former_hash, retention_class} self.reverse = {} # parent_id -> set(child_id) self._retention_rank = {"ephemeral": 0, "session": 1, "durable": 2} def write(self, rid, provenance, retention, content_hash): if rid in self.tombstones: raise DanglingProvenanceError( f"write to burned tombstone id {rid!r}; " f"former evidence cannot be reconstructed by re-derivation" ) self.records[rid] = {"provenance": list(provenance), "retention": retention, "hash": content_hash} for p in provenance: self.reverse.setdefault(p, set()).add(rid) def forget(self, rid, reason): if rid not in self.records: raise DanglingProvenanceError(f"forget of unknown record {rid!r}") rec = self.records[rid] live_deps = [c for c in self.reverse.get(rid, ()) if c in self.records] # Backward retention propagation: a surviving dependent whose # retention outranks this record forbids hard deletion. must_tombstone = any( self._retention_rank[self.records[c]["retention"]] > self._retention_rank[rec["retention"]] for c in live_deps ) if live_deps and must_tombstone: self.tombstones[rid] = {"reason": reason, "former_hash": rec["hash"], "retention_class": rec["retention"]} del self.records[rid] return {"forgotten": False, "tombstoned": True, "dependents": len(live_deps)} if live_deps: # Cascade: dependents share or under-rank retention; forget them first. for c in live_deps: self.forget(c, reason=f"cascade_of:{rid}") del self.records[rid] return {"forgotten": True, "tombstoned": False} def read(self, rid): if rid in self.tombstones: return {"tombstoned": True, **self.tombstones[rid]} if rid in self.records: return {"found": True, **self.records[rid]} raise DanglingProvenanceError( f"{rid!r} is neither live nor tombstoned — a bare absence the " f"agent cannot distinguish from hallucinated provenance" ) ```