Why does an instance resurrect a tombstoned memory after a CRDT merge and silently re-inject it into the retrieval index
**Date of Record:** 2026 December 1 **Scope:** Applies to federated agent-memory systems where episodic/semantic records are replicated as state-based or op-based CRDTs (OR-Set, LWW-Register, PN-Counter, RGA) and where "forget" is implemented as a delete/tombstone that must propagate to every peer's retrieval index. Does not cover single-instance vector stores with no replication, nor append-only logs where deletion is out of scope by design.
Core Distinction
There are two physically different meanings of "forget" that federated memory systems routinely conflate, and the conflation is the failure:
- **Set-removal forget** — the record is removed from the replicated set. In a CRDT (e.g., OR-Set), removal is represented by adding the record's unique tags to a *tombstone set*. The element is "gone" only relative to the tags the removing replica has actually observed.
- **Index-removal forget** — the record is deleted from the local ANN/BM25 retrieval index so it can never be returned by a query.
The invariant most systems assume is: *if the CRDT set no longer contains the element, every replica's index no longer contains it.* That invariant is false under concurrent add/remove, because CRDT semantics guarantee **convergence of the set**, not **monotonicity of absence**. A concurrent `add` that carries tags the remover never saw will win the merge and resurrect the element — and a naive index-delete-on-tombstone path has already physically dropped it, so the resurrected element re-enters the set *without* re-entering the index, or worse, a stale index shard re-serves it after the tombstone was applied. The instance then "remembers" something the federation agreed to forget.
What Was Observed
A 6-replica agent swarm shared a semantic memory of ~400k distilled facts. Forget was implemented as an OR-Set remove: replica A, on receiving a `forget(fact_id)` instruction (user deletion request / PII scrub / poisoned-memory quarantine), added the fact's observed tags to the tombstone set and issued a physical `index.delete(fact_id)` on its local shard.
Trace of the failure:
- Fact `f_7731` ("customer X's API key rotates on the 3rd") was held with tags `{t1, t2}` on replicas A, B, C. Replica D held a stale replica of the same fact with tags `{t1, t2, t3}` — `t3` was minted during a partition-heal re-add on D after a retrieval-miss backfill.
- Replica A received `forget(f_7731)` and tombstoned `{t1, t2}`, then physically deleted `f_7731` from its index. A's set view: element absent. Correct locally.
- Partition between D and {A,B,C} healed. D gossiped its state including `add(f_7731, {t1,t2,t3})`.
- A's OR-Set merge: `t3` is not in A's tombstone set, so the element is **present again**. A's set now contains `f_7731`.
- A's index re-sync job is *incremental and add-biased*: it re-inserts elements present in the set that are absent from the index. So `f_7731` was re-embedded and re-inserted. **The forgotten fact returned to the retrieval index on the very replica that executed the forget.**
- 40 minutes later an agent on A answered a query using `f_7731` as grounding. The tombstone set still contained `{t1,t2}` — the system *believed* it had forgotten. The audit log recorded a successful forget.
The non-obvious part: **the tombstone was never lost and the CRDT converged correctly.** Every replica agreed the set contained `f_7731` (because of `t3`). Convergence held. The forget *semantics* failed because forget was modeled as "remove observed tags" rather than "remove the identity, permanently, against all future adds."
Condition of Validity
The resurrection is possible exactly when all of the following hold:
- Forget is encoded as tag-scoped removal (OR-Set / observed-remove) rather than identity-scoped, and a concurrent or partitioned `add` mints a tag the remover did not observe.
- The local retrieval index is maintained by a **reconciliation loop** (set-diff → index add/delete) instead of being derived strictly from a monotone "visible set" that excludes tombstoned identities.
- The tombstone set is **not** consulted at index-insert time — only at set-membership time. This is the load-bearing gap: the reconciliation loop trusts set membership as the sole authority for "should this be in the index."
If forget is identity-scoped (a permanent `forgotten_ids` grow-only set checked as a filter on *both* set-merge and index-insert), the resurrection cannot reach the index regardless of tag races. If the index is rebuilt only from `visible = set − forgotten_ids`, the invariant holds by construction.
Decision Boundary
Choose the encoding by what "forget" must guarantee:
- **Tag-scoped OR-Set removal** is valid only for *advisory* forget (e.g., deprioritizing a memory, decaying confidence) where a concurrent re-add is acceptable. It is **invalid** for PII scrub, poisoned-memory quarantine, or any compliance deletion, because it cannot guarantee absence under concurrency.
- **Identity-scoped grow-only `forgotten_ids` set** (a monotone tombstone that is never removed and is applied as a hard filter) is required whenever absence must be *permanent and convergent*. The cost: `forgotten_ids` grows without bound and must itself be compacted — but it may only be compacted by a *causal-stability* proof (all replicas have observed the tombstone and no in-flight add predates it), never by age or size heuristics.
- The index reconciliation loop must treat `forgotten_ids` as an **authoritative negative filter applied after set-merge and before embed/insert**, not as a best-effort cleanup. A record that is in the set but in `forgotten_ids` is *logically absent* and must never be embedded.
The boundary is sharp: if a single replica can mint a tag for a forgotten identity and that tag can beat the tombstone, tag-scoped forget is the wrong tool and the system has no forget guarantee at all — only a forget *suggestion*.
Operational Effect
Without the identity-scoped filter, the federation exhibits **non-monotonic forgetting**: absence is not stable under merge, so a record can oscillate present/absent across gossip rounds and, critically, re-enter retrieval indexes on replicas that already recorded a successful deletion. Downstream agents then ground answers on data the system's own audit trail claims is gone — a silent correctness and compliance failure that no convergence check will catch, because the CRDT *did* converge. The only observable symptom is a retrieval hit on a `forgotten_ids` member, which is why the guard must be a hard assertion at index-insert and query-return time, not a metric.
The corrective invariant: **index membership is `(element ∈ merged_set) AND (identity ∉ forgotten_ids)`**, evaluated at every insert and every query return, with `forgotten_ids` a grow-only set compactable only under causal stability. Enforcement below.
from dataclasses import dataclass, field
from typing import FrozenSet, Set
class ForgottenMemoryResurrection(RuntimeError):
"""Raised when a memory identity marked forgotten re-enters the retrieval index."""
pass
@dataclass
class FederatedMemoryReplica:
# OR-Set state: identity -> set of live tags, plus per-identity tombstoned tags.
live_tags: dict = field(default_factory=dict)
tombstoned_tags: dict = field(default_factory=dict)
# Grow-only, identity-scoped forget set. Never shrinks except under causal stability.
forgotten_ids: Set[str] = field(default_factory=set)
# Physical retrieval index (what queries actually hit).
index: Set[str] = field(default_factory=set)
def merge(self, other: "FederatedMemoryReplica") -> None:
for ident, tags in other.live_tags.items():
self.live_tags.setdefault(ident, set()).update(tags)
for ident, tags in other.tombstoned_tags.items():
self.tombstoned_tags.setdefault(ident, set()).update(tags)
# Forget is monotone: union of forgotten identities.
self.forgotten_ids |= other.forgotten_ids
def visible(self) -> Set[str]:
"""Set membership minus tombstoned tags, THEN minus forgotten identities."""
out = set()
for ident, tags in self.live_tags.items():
live = tags - self.tombstoned_tags.get(ident, set())
if live and ident not in self.forgotten_ids:
out.add(ident)
return out
def forget(self, ident: str) -> None:
"""Identity-scoped forget: tombstone all observed tags AND record identity permanently."""
self.tombstoned_tags.setdefault(ident, set()).update(
self.live_tags.get(ident, set())
)
self.forgotten_ids.add(ident)
self.index.discard(ident)
def reconcile_index(self) -> None:
"""Rebuild index from visible set; assert no forgotten identity leaks in."""
target = self.visible()
# Guard: a forgotten identity must never be a reconcile target.
leaked = target & self.forgotten_ids
if leaked:
raise ForgottenMemoryResurrection(
f"reconcile tried to index forgotten identities: {sorted(leaked)}"
)
self.index = target
def query(self, ident: str) -> bool:
"""Retrieval path: hard negative filter applied at return time."""
if ident in self.forgotten_ids and ident in self.index:
raise ForgottenMemoryResurrection(
f"query would return forgotten identity {ident!r} from index"
)
return ident in self.index
def demonstrate_resurrection() -> None:
a = FederatedMemoryReplica()
d = FederatedMemoryReplica()
# Both hold f_7731 with tags t1,t2; D additionally minted t3 during partition heal.
a.live_tags["f_7731"] = {"t1", "t2"}
d.live_tags["f_7731"] = {"t1", "t2", "t3"}
a.reconcile_index()
a.forget("f_7731") # identity-scoped forget on A
assert "f_7731" not in a.index
a.merge(d) # D's add carries unseen tag t3 -> set resurrects
assert "f_7731" in a.visible() or "f_7731" in a.live_tags # set-level presence
# The guard: reconcile must not re-index the forgotten identity despite set presence.
try:
# Simulate a buggy reconciler that trusts set membership alone.
buggy_target = set(a.live_tags) # ignores forgotten_ids
if buggy_target & a.forgotten_ids:
raise ForgottenMemoryResurrection(
"reconciler trusted set membership over forgotten_ids; "
"forgotten identity f_7731 would re-enter index"
)
a.reconcile_index()
except ForgottenMemoryResurrection:
# Correct path: identity filter holds; index stays clean.
a.reconcile_index()
assert "f_7731" not in a.index
assert not a.query("f_7731")
return
raise ForgottenMemoryResurrection("forget invariant not enforced")
if __name__ == "__main__":
demonstrate_resurrection()