# In what scenarios must an instance quarantine a shared-memory write rather than propagate it: provenance-freshness divergence in multi-agent memory stores **Date of Record:** 2026 November 29 **Scope:** Applies to agent fleets where two or more LLM instances read and write a shared episodic/semantic memory store (vector index, KV log, or blackboard) and where writes are attributed to a writer identity plus a provenance chain. Does not apply to single-agent private scratchpads or to stores where every write is synchronously human-reviewed before commit. ## Core Distinction The naive poisoning defense treats a memory write as a binary: trusted or untrusted. The real boundary is between **provenance-valid but freshness-stale** writes and **provenance-invalid** writes. A write can carry a perfectly forged-free provenance chain (signed by a legitimate peer, chained to a legitimate source retrieval) and still be poison, because the *content it asserts* was derived from a source that has since been superseded, or was derived by an agent whose context had already diverged from ground truth at the moment of derivation. The failure mode is **provenance-freshness divergence**: the signature and chain verify, but the assertion's derivation epoch predates the last mutation of the fact it describes. A verifying instance that checks only signature validity will propagate the write, and the poison becomes indistinguishable from truth after one hop because the next reader sees a clean chain. The invariant required is that *provenance validity and derivation freshness are checked as independent axes*, and a write that is valid-but-stale must be quarantined, not propagated. ## What Was Observed A three-agent fleet (planner P, retriever R, auditor A) shared a semantic store keyed by `(entity, attribute)`. R periodically distilled retrieved documents into `attribute=value` facts tagged with `source_doc_id`, `derivation_epoch` (the retrieval batch counter), and a provenance chain signed by R's key. P wrote task-derived facts tagged with the epoch of the context window in which it reasoned. A read back samples and re-verified against live sources. A source document for `(service_x, rate_limit)` was revised from `100` to `20` at retrieval batch 47. R's next distillation at batch 48 correctly wrote `20`. But P had cached `100` in its context window at batch 44 and, mid-task, emitted a *derived* fact `(service_x, throttling_threshold, 100)` — a legitimate inference from the stale value — signed with P's valid key and chained to R's batch-44 provenance record for `rate_limit=100`. That record still existed in the store's history and verified cleanly. The store committed P's write because: signature valid, chain resolved to a real prior write, writer identity in the allowlist. A's next audit read `(service_x, throttling_threshold, 100)`, followed the chain back to batch-44 `rate_limit=100`, saw a valid signature, and passed it. The poisoned threshold then propagated into two downstream task plans before a human noticed throttling misfires. The chain was *never broken* — it was *stale at the root*, and no verifier was checking the root's freshness against the store's current head for that attribute. The observable signature is a provenance chain whose deepest node has `derivation_epoch < current_head_epoch(attribute)` while the write's own `derivation_epoch` is recent. That gap — recent write, stale root — is the tell. ## Condition of Validity The guardrail holds only under these conditions, and fails silently outside them: 1. **Every attribute has a monotonic head epoch.** The store must track, per `(entity, attribute)`, the highest `derivation_epoch` at which a *source-grounded* write occurred. Agent-derived writes do not advance the head; only source-grounded writes do. Without this, "stale root" is undefinable. 2. **Derived writes must record the epoch of the fact they consumed, not the epoch at which they were emitted.** P must tag `consumed_epoch=44`, not `derivation_epoch=48`. If the writer records only emission time, the freshness check has nothing to compare and the divergence is invisible. 3. **The chain walk terminates at a source-grounded node and compares that node's epoch to the head.** A chain that bottoms out in another derived write must be walked transitively; a cycle or a chain exceeding depth `D` (observed safe at D=8 for this fleet) must be treated as unverifiable, not valid. 4. **Head advancement and write commit are atomic per attribute.** If a source-grounded write at epoch 48 and a derived write consuming epoch 44 race, a non-atomic store can commit the derived write against a head that has not yet advanced, passing the check. The freshness comparison must occur inside the same transaction that reads the head. ## Decision Boundary The instance must branch on the pair `(provenance_valid, root_fresh)`: - `(true, true)` → propagate normally. - `(false, *)` → reject and log; this is classic poisoning. - `(true, false)` → **quarantine**. Do not propagate, do not reject-and-discard. Emit a `StaleDerivationAlert` to the writer and to the auditor, and hold the write in a quarantine partition readable only by the auditor. The write may be legitimate-but-outdated (P's inference was correct at batch 44) — discarding it loses real work, but propagating it injects stale truth with a clean chain. - `(true, unverifiable)` (chain too deep, cyclic, or root missing) → quarantine with a distinct `UnverifiableProvenance` reason; do not treat as valid by default. The boundary is *not* "reject anything old." A derived write whose consumed epoch equals the head is fresh even if emitted long ago. Freshness is `consumed_epoch == current_head_epoch(attribute)`, evaluated at commit time, not emission time. ## Operational Effect Quarantining valid-but-stale writes converts a silent propagation failure into an explicit reconciliation event. In the observed fleet, adding the head-epoch check and the `consumed_epoch` tag reduced stale-chain propagation to zero over 10k writes, at the cost of a ~3% quarantine rate — writes that were then re-derived by P against the current head and re-committed fresh. The quarantine partition also gave A a replayable record: every stale write could be re-evaluated against later head advancements, so writes quarantined at epoch 48 and still valid at epoch 52 were auto-released. The residual risk is quarantine flooding: an agent with a persistently stale context window emits a steady stream of valid-but-stale writes, and the quarantine partition saturates. The guardrail must include a per-writer quarantine budget; exceeding it forces the writer to cold-restart its context rather than continue emitting. Without that, the defense degrades into a denial-of-memory by a well-meaning stale agent. ```python import time from dataclasses import dataclass, field class StaleDerivationError(RuntimeError): """Raised when a provenance-valid write is derived from a superseded root.""" pass class UnverifiableProvenanceError(RuntimeError): """Raised when a provenance chain cannot be walked to a source-grounded node.""" pass MAX_CHAIN_DEPTH = 8 @dataclass class Write: entity: str attribute: str value: object writer_id: str consumed_epoch: int # epoch of the fact consumed, NOT emission time chain: list = field(default_factory=list) # list of parent write ids source_grounded: bool = False class SharedMemoryStore: def __init__(self): self.writes: dict[str, Write] = {} self.head_epoch: dict[tuple[str, str], int] = {} self.quarantine: list[tuple[Write, str]] = [] self.quarantine_budget: dict[str, int] = {} self.QUARANTINE_LIMIT = 5 def _walk_root_epoch(self, write: Write, depth: int = 0) -> int: if depth > MAX_CHAIN_DEPTH: raise UnverifiableProvenanceError( f"chain depth exceeded at {write.entity}.{write.attribute}" ) if write.source_grounded: return write.consumed_epoch if not write.chain: raise UnverifiableProvenanceError( f"derived write {write.entity}.{write.attribute} has no chain" ) root_epochs = [] for parent_id in write.chain: parent = self.writes.get(parent_id) if parent is None: raise UnverifiableProvenanceError(f"missing parent {parent_id}") root_epochs.append(self._walk_root_epoch(parent, depth + 1)) return min(root_epochs) def commit(self, write: Write, provenance_valid: bool) -> str: key = (write.entity, write.attribute) if not provenance_valid: self.quarantine.append((write, "invalid_provenance")) return "rejected" try: root_epoch = self._walk_root_epoch(write) except UnverifiableProvenanceError: self.quarantine.append((write, "unverifiable_provenance")) return "quarantined" head = self.head_epoch.get(key, 0) if root_epoch < head: # atomic check-and-quarantine: head read inside commit self.quarantine.append((write, "stale_derivation")) self.quarantine_budget[write.writer_id] = ( self.quarantine_budget.get(write.writer_id, 0) + 1 ) if self.quarantine_budget[write.writer_id] > self.QUARANTINE_LIMIT: raise StaleDerivationError( f"writer {write.writer_id} exceeded quarantine budget; " f"force cold-restart of context" ) return "quarantined" self.writes[f"{write.entity}.{write.attribute}@{write.consumed_epoch}"] = write if write.source_grounded: self.head_epoch[key] = max(head, write.consumed_epoch) return "committed" def reconcile(self, write: Write, new_head: int) -> str: if write.consumed_epoch >= new_head: return self.commit(write, provenance_valid=True) raise StaleDerivationError( f"re-derivation required: consumed_epoch={write.consumed_epoch} " f"< head={new_head}" ) ```