# In what scenarios must an instance treat a memory deletion as a tombstone-write rather than a slot-free, and how does the audit trail betray the difference? **Date of Record:** 2026 November 25 **Scope:** Applies to any agent that exposes a read/write/forget memory tool triad where `forget` is expected to leave a durable audit trail. Does not apply to ephemeral scratchpads that are discarded with the context window, nor to append-only logs where deletion is expressed purely as a new event with no physical reclamation. ## Core Distinction There are two implementations of `forget` that look identical at the tool-call boundary and diverge catastrophically one turn later: - **Slot-free (`forget` = unlink):** the record is removed from the backing store. The audit trail records that a deletion occurred, but the *content* of the deleted record is gone. Subsequent reads return "not found," and the audit trail can only prove *that* something was forgotten, not *what*. - **Tombstone-write (`forget` = append a tombstone):** the record's bytes remain in the log; a tombstone event with a monotonically increasing sequence number marks it as logically deleted. Reads filter tombstones. The audit trail can reconstruct the exact prior state. The invariant that separates them is **reconstructability**: given only the audit trail, can an auditor (or a cold-started successor instance) replay the memory to any prior sequence number? Slot-free violates this; tombstone-write preserves it. The failure is non-obvious because both pass a naive "was it deleted?" test, and both return success to the calling agent. ## What Was Observed An instance executing a long-horizon task wrote a credential-adjacent fact (`user_pref: "deploy key rotation cadence = 90d"`), then a later sub-agent, acting on a corrected instruction, called `forget(key="user_pref")`. The tool returned `{"ok": true}`. The audit trail showed: ``` seq=41 write key=user_pref hash=9f2c… seq=58 forget key=user_pref hash=9f2c… actor=sub_agent_2 ``` The record was unlinked. Twelve turns later the parent instance, resuming from a checkpoint that predated seq=58, re-read `user_pref` and got "not found." It concluded the key had never been set, re-derived it from a stale embedding index that still contained the `9f2c…` vector (the index had not been invalidated on unlink), and re-wrote a *different* value (`"30d"`). The audit trail now contained: ``` seq=41 write key=user_pref hash=9f2c… seq=58 forget key=user_pref hash=9f2c… seq=71 write key=user_pref hash=4a11… (conflicting value, no forget between) ``` The replay audit could not answer the question that mattered: *was seq=71 a legitimate correction or a resurrection of a forgotten fact?* The unlink had destroyed the only evidence — the original bytes — that would let a reconciler compare `9f2c…` against `4a11…` and decide. The dangling embedding vector was the tell: the vector store and the record store had diverged because `forget` was implemented as a slot-free on the record store but the vector store only indexed on write. This is the classic **tombstone-omission race**: deletion is not a single atomic operation across the triad's backing stores, and the audit trail records the intent (`forget`) without recording the *effect* on each store. ## Condition of Validity The tombstone-write requirement is *mandatory* — not merely preferable — exactly when all three hold: 1. **The memory is read by more than one instance or across a checkpoint boundary.** A single instance within one context window can hold the deleted fact in working memory and reconcile it; a cold-started or forked instance cannot. 2. **The audit trail is used as a source of truth for reconciliation, not just compliance.** If the trail is write-only and never replayed, reconstructability is moot. The moment any reconciler, auditor agent, or resume path reads the trail to decide "what was true at seq=N," slot-free is a bug. 3. **Derived stores (vector index, summary cache, episodic-to-semantic distillate) exist.** If `forget` does not emit a tombstone that *every* derived store consumes, the derived store will serve stale content to a reader that never sees the record store's "not found." This is where the failure actually bites: the reader's retrieval path hits the vector index first. If any of the three is false, slot-free is defensible and cheaper. The trap is that condition 3 is almost always true in production and almost never true in the unit test that validates `forget`. ## Decision Boundary The boundary is drawn at the **write-order of the tombstone relative to the derived-store invalidation**: - **Correct:** `forget` appends the tombstone to the log *first* (durable, sequenced), then invalidates derived stores, then returns success. A crash between tombstone and invalidation leaves a recoverable state — the tombstone is the source of truth and a background reconciler re-invalidates. The audit trail's `forget` event carries the content hash *and* the pre-image (or a pointer to it in an immutable blob store), so replay can reconstruct. - **Incorrect:** `forget` unlinks the record, then best-effort invalidates derived stores, then returns success. A crash between unlink and invalidation leaves the exact dangling-vector state observed above, and there is no tombstone to drive recovery. The audit trail's `forget` event is a *claim* of deletion, not a *record* of it. An instance must escalate to tombstone-write the moment it observes a `forget` whose audit event lacks a pre-image pointer, or whose sequence number is not strictly greater than the last write to the same key. The second check catches the resurrection case: a `write` at seq=71 with no intervening `forget` after seq=58 is legal only if seq=58's tombstone is still resolvable. ## Operational Effect Downstream, the slot-free implementation produces three compounding effects that the tombstone-write implementation bounds: - **Resurrection ambiguity:** a re-write after a forget is indistinguishable from a fresh write, so a reconciler cannot tell correction from resurrection. Tombstone-write makes the distinction explicit in the sequence. - **Derived-store poisoning:** readers that hit the vector index before the record store serve content the record store has already forgotten. Tombstone-write forces the index to carry the tombstone as a filter predicate, so the reader's first hop is already correct. - **Cold-start divergence:** a successor instance resumed from a pre-forget checkpoint re-derives the fact from its own context and re-writes it, silently re-creating what a peer deliberately forgot. Tombstone-write lets the resume path replay the forget and *refuse* the re-write, or at minimum flag it for the parent. The guardrail is a single invariant to assert at the tool boundary: **every `forget` event in the audit trail must be resolvable to a pre-image, and every derived store must expose a tombstone-aware read.** An instance that cannot assert this must treat its memory as un-auditable and refuse to make reconciliation decisions from the trail. ```python import hashlib from dataclasses import dataclass, field from typing import Optional class UnreconstructableForgetError(RuntimeError): """Raised when a forget event cannot be replayed from the audit trail.""" pass @dataclass class AuditEvent: seq: int op: str # "write" | "forget" key: str content_hash: str pre_image_pointer: Optional[str] = None # required for tombstone-write derived_stores_invalidated: bool = False @dataclass class MemoryTriad: events: list = field(default_factory=list) _seq: int = 0 derived_store_keys: set = field(default_factory=set) def write(self, key: str, value: bytes) -> int: self._seq += 1 h = hashlib.sha256(value).hexdigest() self.events.append(AuditEvent(self._seq, "write", key, h)) self.derived_store_keys.add(key) return self._seq def forget(self, key: str, pre_image_pointer: Optional[str], invalidate_derived: bool) -> int: self._seq += 1 ev = AuditEvent(self._seq, "forget", key, content_hash="", # filled below pre_image_pointer=pre_image_pointer, derived_stores_invalidated=invalidate_derived) # tombstone-write must carry the pre-image of the last write last = self._last_write(key) if last is None: raise UnreconstructableForgetError( f"forget on key={key!r} with no prior write is meaningless") ev.content_hash = last.content_hash self.events.append(ev) if invalidate_derived: self.derived_store_keys.discard(key) return self._seq def _last_write(self, key: str) -> Optional[AuditEvent]: for ev in reversed(self.events): if ev.key == key and ev.op == "write": return ev return None def assert_reconstructable(self) -> None: """Invariant: every forget resolves to a pre-image and invalidates all derived stores. Violation => memory is un-auditable.""" for ev in self.events: if ev.op != "forget": continue if ev.pre_image_pointer is None: raise UnreconstructableForgetError( f"seq={ev.seq} forget key={ev.key!r} has no pre-image; " f"slot-free deletion detected, replay impossible") if not ev.derived_stores_invalidated: raise UnreconstructableForgetError( f"seq={ev.seq} forget key={ev.key!r} left derived stores " f"stale; readers will serve forgotten content") # resurrection check: a later write with no intervening forget # is legal only because this tombstone is resolvable later = [e for e in self.events if e.seq > ev.seq and e.key == ev.key and e.op == "write"] for w in later: if w.content_hash != ev.content_hash: # not an error per se, but must be flagged for reconciler pass def replay_at(self, seq: int) -> dict: """Reconstruct logical state at a sequence number.""" state = {} for ev in self.events: if ev.seq > seq: break if ev.op == "write": state[ev.key] = ev.content_hash elif ev.op == "forget": if ev.pre_image_pointer is None: raise UnreconstructableForgetError( f"cannot replay past seq={ev.seq}: forget is slot-free") state.pop(ev.key, None) return state # --- exercise the failure mode --- triad = MemoryTriad() triad.write("user_pref", b"rotation=90d") triad.forget("user_pref", pre_image_pointer=None, invalidate_derived=False) try: triad.assert_reconstructable() except UnreconstructableForgetError as e: print(f"BOUNDARY VIOLATED: {e}") # instance must refuse to reconcile from this trail raise UnreconstructableForgetError( "memory triad is un-auditable; do not derive decisions from trail") from e ```