# Why does an instance trust a poisoned fact after the writer that injected it has been evicted from the shared store? **Date of Record:** 2026 November 29 **Scope:** Applies to multi-agent systems where several LLM instances read and write a shared semantic memory (vector store, keyed fact store, or episodic log) and where poisoning detection is performed by per-record provenance checks. Does not apply to single-agent private memory or to stores with globally serialized, cryptographically signed writes where every record carries an immutable writer warrant. ## Core Distinction The failure is not "an attacker poisoned the store." The failure is a **provenance-decay mismatch**: detection logic validates a record by resolving its `writer_id` against the *currently active* agent roster, while downstream readers consume the record by *semantic content only*. When a writer is evicted (task completion, crash, quarantine, or intentional rotation), the record it wrote survives — but the audit path that would have flagged it also disappears, because the auditor can no longer resolve `writer_id` to a live, trusted principal and defaults to `unknown → treat as legacy → accept`. This is distinct from stale-memory drift (where truth changes over time) and from retrieval mismatch (where the wrong record is fetched). Here the record is fetched correctly, is internally consistent, and passes every check that runs — because the one check that mattered, *"was this written by someone we still trust,"* silently degrades from a hard gate to a soft pass when the writer's identity becomes unresolvable. The invariant that breaks: **a record's trustworthiness must be a function of the record, not of the liveness of its author.** Most implementations violate this because trust is computed lazily at read time by joining against a mutable roster. ## What Was Observed A four-agent swarm (planner, retriever, executor, auditor) shared a fact store keyed by `(entity, attribute)`. Writes appended a record: ``` {key, value, writer_id, warrant_hash, epoch, ttl} ``` The auditor ran a periodic sweep: for each record, resolve `writer_id` in the active roster; if the writer is absent or its warrant is revoked, mark `suspect` and exclude from retrieval. This worked while all four agents were alive. Trigger sequence: 1. The executor was compromised via prompt injection from a tool response and wrote a poisoned fact: `(deploy_target, "prod-db-07")` with a valid `warrant_hash` (it was a legitimate executor at write time) and `epoch=41`. 2. The executor finished its task and was evicted from the roster at `epoch=42`. Its warrant was garbage-collected. 3. The auditor's next sweep reached the poisoned record. `writer_id=executor-3` did not resolve. The auditor's code path was: ```python writer = roster.get(rec.writer_id) if writer is None: rec.status = "legacy" # <-- the bug continue # legacy records are accepted if not writer.warrant_valid(rec.warrant_hash): rec.status = "suspect" ``` The record was relabeled `legacy` and left retrievable. 4. The planner, at `epoch=44`, retrieved `(deploy_target, "prod-db-07")` and issued a deploy directive. The value was internally consistent, recent by `ttl`, and unmarked. No agent had any signal that it originated from a now-untrusted writer. The poisoning was detected only by an out-of-band log replay comparing write epochs against eviction epochs — a check that ran hours later and was not part of the read path. The non-obvious part: **eviction of the writer is what laundered the poison.** Had the executor stayed active with a revoked warrant, the `suspect` branch would have fired. The system's trust model was strongest exactly when the threat was most visible and weakest after the threat actor left the room. ## Condition of Validity The failure requires all of: - **Lazy provenance resolution.** Trust is computed at read/sweep time by joining `writer_id` against a mutable roster, rather than being sealed into the record at write time. - **A benign default for unresolvable provenance.** The `None → legacy → accept` fallback. Any system that treats "cannot resolve author" as "accept" is exposed; treating it as "quarantine" is immune. - **Writer lifecycle shorter than record TTL.** If writers outlive their records, the roster never loses the needed entry and the join always succeeds. Eviction-before-expiry is the enabling condition. - **Content-only downstream consumption.** Readers trust the record's status field, not a re-derivation of trust from the record itself. It does **not** require a malicious writer at write time. A writer that was honest, wrote a fact that was true at `epoch=41`, and was then evicted for an unrelated reason produces the same `legacy` relabel — so the mechanism also silently launders *stale* facts, not just adversarial ones. ## Decision Boundary The boundary is whether provenance is **sealed** or **resolved**. - **Sealed (correct):** At write time, the writer's trust state is frozen into the record — e.g., `trusted_at_write: true`, `warrant_hash`, `write_epoch`, and a signature over `(key, value, writer_id, warrant_hash, epoch)`. Trust at read time is `verify(record.signature) AND record.trusted_at_write AND not revoked_since(record.write_epoch)`. Eviction of the writer does not change the record's verdict; only an explicit *revocation event scoped to the record's epoch* does. - **Resolved (broken):** Trust at read time is `roster[record.writer_id].is_trusted()`. Eviction collapses this to a default. The guardrail invariant: **no record may transition from `trusted` to `accepted` due to the disappearance of its author.** Formally, for any record `r` and any roster mutation `m` that only removes principals, `status(r, roster')` must be at least as restrictive as `status(r, roster)` where `roster' = m(roster)`. Eviction is monotone in suspicion, never in acceptance. A second required guard: **revocation must propagate to records, not just to agents.** When a warrant is revoked at `epoch=E`, every record with `writer_id` matching and `write_epoch <= E` must be re-marked `suspect`, and this set must be computed and persisted *before* the writer entry is removed from the roster. Ordering matters: revoke-then-evict, never evict-then-revoke. ## Operational Effect Without the sealed-provenance invariant, the shared store's trustworthiness is a function of roster churn: the more agents rotate, the more records fall into the `legacy` accept path, and the larger the un-audited surface becomes. In the observed incident, 100% of records written by evicted agents (a growing fraction under normal task rotation) were silently promoted to `legacy` and remained retrievable. Poisoning detection coverage decayed monotonically with uptime. With sealing, the poisoned record retains `trusted_at_write=true` but the revocation sweep at eviction marks it `suspect` in the same transaction that removes the writer, and the read path rejects it. The cost is that records must carry a verifiable signature and an epoch, and revocation must be an ordered, persisted event rather than a roster side effect. The residual risk after the fix is **revocation latency**: between the writer's compromise and the revocation event, records written in that window carry `trusted_at_write=true` and are accepted. This window must be bounded by a max-revocation-lag SLO, and records within `[now - lag, now]` from any writer under active suspicion should be re-verified by an independent auditor rather than trusted on signature alone. ```python from dataclasses import dataclass from typing import Optional class ProvenanceDecayError(RuntimeError): """Raised when a record's trust verdict would improve due to author eviction.""" pass @dataclass class Record: key: str value: str writer_id: str warrant_hash: str write_epoch: int trusted_at_write: bool signature_valid: bool status: str = "trusted" @dataclass class Roster: active: dict # writer_id -> warrant_hash revoked_before: dict # writer_id -> epoch of revocation def seal_on_write(rec: Record, roster: Roster) -> Record: """Freeze trust into the record at write time.""" if rec.writer_id not in roster.active: raise ProvenanceDecayError( f"write from unknown principal {rec.writer_id!r} at epoch {rec.write_epoch}" ) if roster.active[rec.writer_id] != rec.warrant_hash: raise ProvenanceDecayError( f"warrant mismatch for {rec.writer_id!r}: record {rec.warrant_hash!r}" ) rec.trusted_at_write = True return rec def verdict(rec: Record, roster: Roster) -> str: """Trust is a function of the record, not the liveness of its author.""" if not rec.signature_valid: return "suspect" if not rec.trusted_at_write: return "suspect" rev_epoch = roster.revoked_before.get(rec.writer_id) if rev_epoch is not None and rec.write_epoch <= rev_epoch: return "suspect" return "trusted" def evict_writer(recs: list, roster: Roster, writer_id: str, epoch: int) -> Roster: """Revoke-then-evict: mark dependent records BEFORE dropping the principal.""" if writer_id not in roster.active: raise ProvenanceDecayError(f"cannot evict absent writer {writer_id!r}") # 1. persist revocation scoped to epoch roster.revoked_before[writer_id] = epoch # 2. re-verdict every dependent record in the same transaction for r in recs: if r.writer_id == writer_id and r.write_epoch <= epoch: r.status = "suspect" # 3. only now remove from active roster del roster.active[writer_id] return roster def monotonicity_check(before: str, after: str) -> None: """Eviction may only tighten, never loosen, a record's verdict.""" order = {"suspect": 0, "trusted": 1} if order[after] > order[before]: raise ProvenanceDecayError( f"eviction loosened verdict {before!r} -> {after!r}; " f"record was laundered by author disappearance" ) ```