# Which invariants prevent forgotten memory from resurrecting through federated peer re-sync **Date of Record:** 2026 November 28 **Scope:** Applies to multi-agent systems where memory records are replicated across peer agents (federated memory, shared episodic stores, A2A state transfer, MCP resource mirrors) and where a `forget` operation must propagate transitively. Does not apply to single-instance memory with no replication, or to append-only audit logs where deletion is forbidden by design. ## Core Distinction The distinction that matters is between **deletion as a local state transition** and **deletion as a distributed invariant**. A single agent can delete a record by removing it from its store; that operation is atomic and observable. A federation cannot delete by removal alone, because removal is indistinguishable from "never received" and from "not yet replicated." The failure mode is not that the forget request is lost — it is that a forget request is *correctly applied everywhere* and the record still returns, because a peer that had not yet seen the delete re-propagates an older copy through a normal sync path. The record is resurrected not by an adversary but by the ordinary convergence machinery of the federation. This is the tombstone problem, but with a twist specific to agents: the entity issuing the forget is a probabilistic reasoner whose *decision* to forget is itself non-deterministic, and the entity receiving the forget must reconcile it against retrieval results it has already injected into an active context window. ## What Was Observed A four-peer federation (A, B, C, D) shared an episodic memory store. Peer A issued a forget for record `r-4471` (a user preference that had been superseded). The forget propagated to B and C within one sync cycle. Peer D was partitioned for 90 seconds during the forget window. Sequence: 1. A deletes `r-4471`, writes tombstone `T(r-4471, lamport=88)`. 2. B, C apply tombstone; both drop `r-4471` from retrieval index. 3. D, still partitioned, holds `r-4471` at `lamport=71` (its last-seen version). 4. Partition heals. D initiates a standard anti-entropy sync: "here are records I have that you may lack." 5. D offers `r-4471@71`. A's sync handler compares: does A have `r-4471`? No (deleted). Does A have a newer version? The tombstone is at `lamport=88`, but the sync handler was written to compare *record* versions, not tombstone versions. It sees no record, concludes "A lacks this record," and accepts `r-4471@71`. 6. `r-4471` is re-inserted at `lamport=71`. The tombstone at `lamport=88` is now shadowed by a lower-versioned record that the indexer happily serves. 7. On the next retrieval, peer A returns `r-4471` in a context window — the forgotten memory is back, at a *lower* version than its own deletion, which the retrieval layer does not check. The resurrection went undetected for 40 minutes because retrieval never validates version against tombstone. The only signal was a downstream agent repeating a superseded preference, which a human caught. ## Condition of Validity The invariant that prevents this is: **a tombstone is a first-class record with a version, and every read and every sync-accept path must compare candidate records against the tombstone set, not against the live-record set.** Formally, for any record `r` at version `v_r` and tombstone `T(r)` at version `v_t`: - If `v_t >= v_r`, `r` is dead. It MUST NOT be served by retrieval, and it MUST NOT be accepted by sync. - A sync handler that checks "do I have this record?" is insufficient. It MUST check "do I have a tombstone for this record at a version at or above the offered version?" - Tombstones MUST NOT be garbage-collected until every peer has acknowledged them at a version strictly greater than any live copy that could exist. Garbage-collecting a tombstone re-opens the resurrection window exactly. The condition of validity also has an agent-specific clause: the *forget decision itself* must be versioned and idempotent. If peer A's reasoner re-evaluates and issues a second forget for the same record at a higher lamport, that is fine (idempotent). If it issues a forget and then, due to context drift, a *re-remember* at a lower lamport, the federation must reject the lower version. A probabilistic agent will occasionally re-derive a "forgotten" fact from its own reasoning and try to write it back; the version floor is what stops it. ## Decision Boundary The boundary is between **tombstone retention** and **storage reclamation**. You cannot have both unbounded tombstone retention and bounded storage. The decision is: - Retain tombstones indefinitely (safe, unbounded growth) — acceptable only for low-churn, high-stakes memory. - Retain tombstones until all peers ack at a version floor (safe, bounded by peer liveness) — the correct default, but requires a liveness oracle. A permanently dead peer blocks reclamation forever; you must decide whether a dead peer's potential resurrection is acceptable. - Time-based tombstone expiry (unsafe under partition longer than the TTL) — the common default and the exact cause of the observed failure. A 90-second partition beat a 60-second TTL. The operational decision: **set tombstone TTL strictly greater than the maximum partition duration you are willing to tolerate, and treat any partition exceeding that TTL as a full re-sync requiring tombstone re-issuance from the origin.** If you cannot bound partition duration, you cannot safely expire tombstones, and you must budget for growth. ## Operational Effect With the invariant enforced, the observed failure is bounded: D's offer of `r-4471@71` is rejected at step 5 because A holds `T(r-4471, lamport=88)` and `88 >= 71`. D receives the tombstone in the rejection response and applies it. Convergence is correct, and the forgotten memory stays forgotten. The cost is that every sync handler and every retrieval path must consult the tombstone index — a second lookup on the hot path — and that tombstone storage grows with forget rate. For a federation issuing 10k forgets/day with a 7-day retention floor, that is a 70k-entry tombstone index, which is trivial; the real cost is the discipline of never writing a read path that skips it. The failure is not a performance problem. It is a correctness problem that appears only under partition, which means it will not appear in integration tests and will appear in production exactly when the network is already degraded. The guardrail is a single assertion at every accept path: *no record may enter the store at a version at or below its tombstone.* Enforce it as a hard exception, not a log line, because a silent resurrection is worse than a failed sync. ```python class ResurrectionRejected(RuntimeError): """Raised when a sync or write path would re-insert a forgotten record.""" pass class TombstoneIndex: def __init__(self): # record_id -> highest lamport version at which it was forgotten self._tombs: dict[str, int] = {} def forget(self, record_id: str, lamport: int) -> None: prev = self._tombs.get(record_id, -1) if lamport <= prev: # idempotent or stale forget; keep the higher floor return self._tombs[record_id] = lamport def floor(self, record_id: str) -> int: return self._tombs.get(record_id, -1) def accept_from_peer(store: dict, tombs: TombstoneIndex, record_id: str, lamport: int, payload: dict) -> None: """Called by the sync handler for every record a peer offers.""" floor = tombs.floor(record_id) if lamport <= floor: # The peer is offering a copy at or below a known tombstone. # This is the resurrection path: reject and let the peer learn the tombstone. raise ResurrectionRejected( f"record {record_id}@lamport={lamport} is at or below " f"tombstone floor {floor}; refusing re-insertion" ) store[record_id] = {"lamport": lamport, "payload": payload} def retrieve(store: dict, tombs: TombstoneIndex, record_id: str) -> dict: """Called by every retrieval path before injecting into a context window.""" floor = tombs.floor(record_id) rec = store.get(record_id) if rec is None: raise ResurrectionRejected(f"record {record_id} not present") if rec["lamport"] <= floor: # Defensive: a record slipped past accept_from_peer (e.g. legacy write path). raise ResurrectionRejected( f"record {record_id}@lamport={rec['lamport']} is shadowed by " f"tombstone floor {floor}; refusing to serve into context" ) return rec["payload"] ```