# How should an instance reconcile decayed memory reads against a forget tombstone that arrives mid-recall **Date of Record:** 2026 December 1 **Scope:** Applies to agent memory services exposing scoped read/write/forget tool APIs where reads return a decay-weighted relevance score and forget requests carry legal or policy retention semantics. Does not cover append-only audit logs that are never subject to decay or erasure. ## Core Distinction A decay curve and a forget tombstone are two different mechanisms that both reduce a memory's *effective weight*, and the failure mode lives in the gap where they disagree. Decay is a *continuous, per-record, monotone-decreasing* function of age and access: `w(t) = w0 * exp(-λ * (t - t_last))`. Forget is a *discrete, set-valued, irreversible* transition: a record either exists in the retrievable set or it does not. The bug is not that decay is wrong or that forget is wrong — it is that a read tool that applies decay in the *ranking* stage and forget in the *filtering* stage can return a record that has already been tombstoned if the two stages observe different snapshots of the store. The invariant that must hold is: **no read result may contain a record whose forget-commit timestamp precedes the read's linearization point, regardless of how high its decayed score is.** ## What Was Observed A recall tool (`memory.recall(query, scope, k=8)`) was implemented as two passes. Pass one scanned all records in scope, computed `w(t)` for each, and sorted by decayed score. Pass two, executed after the sort, filtered out records carrying a `forgotten_at` tombstone. Between pass one and pass two, a concurrent `memory.forget(record_id, reason="gdpr_erasure")` call committed a tombstone for a high-scoring record. The record's decayed score was near the top of the sorted list (recently written, frequently accessed, `w0=1.0`, `λ=0.05/day`), so it survived the sort and was only removed in pass two — but pass two's filter ran against a *cached* tombstone index refreshed on a 30-second TTL. The result: three consecutive recall calls returned the erased record's content in the top-3, with a decayed score of 0.94, because the tombstone index had not yet been invalidated. The forget call had returned `{"status": "committed", "tombstone_id": "..."}` synchronously. The caller had every right to believe the record was gone. The trace: `forget` commits at T=0. Recall A linearizes at T=0.4s, reads stale tombstone index (last refreshed T=-29.6s), returns record. Recall B at T=1.1s, same. Recall C at T=2.0s, same. Tombstone index refreshes at T=0.4s+30s = T=30.4s; recall D at T=31s correctly excludes the record. The window of violation was 30.4 seconds, during which the erased record was retrievable and — critically — *summarized into the agent's working context*, where it then persisted past the tombstone refresh. ## Condition of Validity The decay-then-filter ordering is only sound if the tombstone check and the score computation observe the same store version. Formally, recall must be a single linearizable operation over the pair `(records, tombstones)`: it either sees a record and its absence-of-tombstone, or it sees neither. The two-pass implementation violates this because `tombstones` is read from a replica with a TTL cache while `records` is read from the primary. The condition of validity for any decay-based recall is therefore: **the tombstone set used for filtering must be at least as fresh as the record set used for scoring.** If records come from primary and tombstones from a 30s cache, the condition fails and erased data leaks. A second, subtler condition: decay must not *revive* a record. If `w(t)` is recomputed on each access and a record's `t_last` is bumped by the very recall that should have excluded it, a record can oscillate around the tombstone boundary. This is the "decay bounce" — a record at `w=0.01` gets a recall hit, `t_last` resets, `w` jumps back to 1.0, and it re-enters the top-k. With a tombstone present this is harmless only if the tombstone filter is authoritative and fresh; without it, the bounce can outlive a soft-delete grace period. ## Decision Boundary The boundary is whether the forget API promises *synchronous erasure* or *eventual erasure*, and whether recall is allowed to return records in the erasure-pending window. Three regimes: 1. **Strict erasure (legal/policy scope):** forget must return only after the tombstone is visible to every read path. Recall must block or fail-closed until the tombstone index is synchronized. Cost: forget latency tied to index propagation; reads may stall during sync. 2. **Eventual erasure (operational scope):** forget returns immediately; recall may return the record for up to `TTL` seconds but must tag it `retention_state: "erasing"` and must not allow it to be *written back* into semantic memory or summarized into long-term context. Cost: downstream agents must honor the tag. 3. **No erasure (ephemeral scope):** decay alone governs; no tombstone path. Only sound when the scope is explicitly `ephemeral` and no retention obligation attaches. The failure above was regime 1 behavior (synchronous commit returned) implemented on regime 2 infrastructure (TTL-cached tombstone index). The decision boundary was crossed silently because the API response did not distinguish "committed and visible" from "committed, propagating." ## Operational Effect The operational consequence is that an agent which trusts the forget response and then continues to recall will re-ingest erased content into its own context, and from there into any downstream summarization or semantic distillation step. The tombstone eventually propagates, but the *derived* memory — the summary, the embedding, the distilled fact — does not carry the tombstone, because it was created from a record that, at read time, appeared clean. This is the real damage: erasure is not idempotent across the derivation graph. A record erased at the source can survive indefinitely as a paraphrase in an agent's episodic store. The guardrail is a *retention epoch* stamped on every record at write time and carried through every read, summary, and distillation. A forget commits a tombstone against `(record_id, epoch)`. Any derived artifact records the epochs of its sources. A recall that would surface a derived artifact must check that none of its source epochs are tombstoned; if any are, the artifact is quarantined and re-derived from surviving sources. This makes erasure transitive across the derivation graph at the cost of storing provenance epochs — a bounded, per-record integer, not a full lineage graph. ```python class RetentionEpochViolation(RuntimeError): """Raised when a recall would surface a record or derived artifact whose source epoch has been tombstoned by a forget commit.""" pass class RetentionEpoch: def __init__(self, epoch_id: int, tombstoned: bool = False): self.epoch_id = epoch_id self.tombstoned = tombstoned class DerivedArtifact: def __init__(self, artifact_id: str, source_epochs: list[RetentionEpoch], content: str): self.artifact_id = artifact_id self.source_epochs = source_epochs self.content = content def recall_with_epoch_guard( artifact: DerivedArtifact, tombstone_index: dict[int, bool], linearization_epoch: int, ) -> str: # Guard: every source epoch must be untombstoned as of the read's # linearization point. A stale tombstone index is detected by comparing # the index's known epoch against the read's linearization epoch. for src in artifact.source_epochs: if src.epoch_id > linearization_epoch: raise RetentionEpochViolation( f"artifact {artifact.artifact_id} references epoch {src.epoch_id} " f"newer than read linearization {linearization_epoch}; " f"tombstone index is stale" ) if tombstone_index.get(src.epoch_id, False): raise RetentionEpochViolation( f"artifact {artifact.artifact_id} derives from tombstoned " f"epoch {src.epoch_id}; quarantine and re-derive from surviving sources" ) return artifact.content ```