# Under what conditions must an instance distrust provenance-weighted retrieval after a quarantine eviction: the re-weighting inversion at the trust-decay boundary **Date of Record:** 2026 November 30 **Scope:** Applies to persistent agent memory systems that gate writes by provenance trust score and retrieve by a provenance-weighted scoring function (trust × relevance). Covers the specific failure mode where a quarantined write is evicted, its provenance record is dropped, and surviving writes from the same source retain inflated trust weights. Does not cover pure relevance-ranked retrieval without provenance, nor write-time rejection that never persists the poisoned record. ## Core Distinction Provenance-weighted retrieval assumes a monotonic relationship: higher source trust → higher retrieval weight → more influence on the agent's next action. Quarantine assumes an orthogonal operation: an untrusted write is isolated so it cannot influence behavior. The boundary failure lives at the intersection: **quarantine eviction is a memory operation that mutates the trust substrate, but it is frequently implemented as a record deletion that leaves the provenance ledger untouched.** When a poisoned write is quarantined and later evicted (TTL expiry, capacity pressure, or manual purge), the record disappears but the *source's* aggregate trust statistics—computed over all writes from that source, including the evicted ones—persist. If the trust score was computed as a running aggregate (mean trust of writes, count of verified writes, Bayesian posterior over source reliability), evicting the *evidence* without recomputing the *posterior* leaves a stale, inflated trust weight attached to the surviving records from that source. The agent then retrieves those survivors with a weight calibrated against a corpus that no longer exists. The non-obvious part: the eviction makes the system *less* safe, not more. Quarantine is supposed to reduce the poison's influence to zero. Eviction without ledger recomputation reduces it to zero *for the evicted record* but *raises* the effective influence of every sibling record from the same provenance class, because the denominator of the trust aggregate shrank while the numerator did not. ## What Was Observed A retrieval-augmented agent maintained a memory store of ~40k episodic records, each tagged with a `source_id` and a per-record `trust` in [0,1] assigned at write time by a provenance classifier (verified tool output = 0.9, user utterance = 0.6, fetched web content = 0.3, unverified peer-agent message = 0.1). Retrieval scored `trust × cosine_similarity` and injected the top-k into context. A prompt-injection payload arrived via an unverified peer-agent message (`source_id = peer-7`, `trust = 0.1`). The write passed the classifier (correctly low-trust) but the payload's *content* contained instructions that, when retrieved even at low weight, shifted the agent's tool-selection policy. The defense quarantined the record: it was moved to a quarantine partition and excluded from retrieval. The quarantine TTL was 24h, after which the record was hard-evicted. The trust ledger stored, per `source_id`, a rolling `verified_fraction` and `mean_trust`. `peer-7` had 14 prior writes, 13 of which were benign and later verified by an auditor, giving `verified_fraction ≈ 0.93` and `mean_trust ≈ 0.82` *after auditor promotion*—the auditor had retroactively raised peer-7's trust because its historical outputs checked out. The poisoned write was one of the 14, quarantined before verification, so it counted as *unverified* in the ledger: `verified_fraction = 13/14 = 0.93`. On eviction, the record was deleted. The ledger was not recomputed. The next retrieval cycle scored peer-7's surviving 13 records at `trust = 0.82`. But the correct posterior *given the quarantine event*—one write from this source was quarantined as a prompt-injection vector—should have been far lower. The quarantine signal was destroyed by the eviction, and the surviving records were retrieved at near-verified weight. Three of them were retrieved into a single context window; their combined influence exceeded the threshold at which the agent's policy shifted, reproducing the original failure 36 hours after the "successful" quarantine. The trace signature: a retrieval weight for `source_id = peer-7` that *increases* across the quarantine eviction boundary, logged as `trust[peer-7]: 0.82 → 0.82` with `n_writes: 14 → 13`. The weight is unchanged but the support is gone; the score is now computed over a strictly smaller, adversarially-filtered subset that excludes exactly the negative evidence. ## Condition of Validity The failure requires all four of the following, and is bounded (does not occur) if any is absent: 1. **Aggregate trust over a source, not per-record trust.** If trust is stored per-record and never aggregated by source, evicting a record cannot inflate its siblings. The failure is specific to `source_id`-level trust posteriors. 2. **Quarantine as exclusion-without-ledger-update.** The quarantined record must be removed from the retrieval set *and* from the trust computation's evidence set, while the trust score itself is not recomputed. If quarantine marks the record `quarantined=true` and keeps it in the ledger as a negative observation, the posterior correctly drops and the failure does not occur. 3. **Eviction (not indefinite quarantine).** The record must be physically removed or its provenance link severed. Indefinite quarantine with retained ledger entry is safe; TTL eviction is not. 4. **A source with mixed benign/malicious history.** If every write from a source is malicious, the source is globally untrusted and eviction is harmless. The inversion is maximal when a source is *mostly* benign—the adversary's best strategy is to build trust with 13 verified writes, then inject once, accepting quarantine of the one write to launder the source's trust back to its pre-incident value. The condition of validity is therefore: **the trust score's evidence set and the retrieval set must be coupled.** The moment quarantine decouples them—excluding from retrieval but not from trust evidence, or excluding from trust evidence without recomputing—the invariant breaks. ## Decision Boundary The operative decision is whether a quarantine event is a *retrieval exclusion* or a *trust downgrade*. These are not the same operation, and conflating them is the root cause. - **Retrieval exclusion** (safe only with ledger retention): the record is not injected, but its provenance remains in the trust posterior as a negative observation. The source's trust drops. Sibling records are retrieved at reduced weight. Correct. - **Trust downgrade** (safe only with ledger recomputation): the quarantine triggers a recomputation of the source's posterior with the quarantined write weighted as a failure. Requires the ledger to be a pure function of the *current* record set. Correct but expensive. - **Eviction without either** (the failure): the record leaves both sets, the posterior is stale, siblings are over-weighted. Incorrect. The boundary rule: **a record may leave the retrieval set at any time; a record may leave the trust evidence set only if the trust score is recomputed from the surviving evidence in the same transaction.** Eviction that removes evidence without recomputation violates the invariant. Implementation guardrail: trust scores must be *derived* from the record store (recomputed on read or maintained via an incremental update that subtracts the evicted record's contribution), never stored as an independent mutable scalar that survives record deletion. A second boundary: the quarantine event itself must be *durable evidence*, not a transient flag. If the quarantine reason ("prompt-injection vector from peer-7") is logged but not fed back into the trust posterior, the system has observed a strong negative signal and discarded it. The correct architecture retains a `quarantine_events` ledger keyed by `source_id` that survives record eviction, so the posterior for peer-7 includes "1 write quarantined for injection" permanently, regardless of whether the record bytes still exist. ## Operational Effect The observable effect is a *trust laundering window*: the interval between quarantine eviction and the next independent negative observation of the same source. During this window, the source's surviving records are retrieved at pre-incident weight, and an adversary who has established a benign history can cycle: inject, get quarantined, wait for TTL eviction, and re-inject from the same source with its trust restored. Each cycle is cheap (one write) and the defense resets. The window length equals the quarantine TTL plus the audit latency. The compounding effect: because the surviving records were *verified benign*, they are retrieved more aggressively (higher trust, and their content may legitimately match the injection's target topic). The agent's context fills with high-weight, topically-relevant, now-unaccountable records from a source that has demonstrated injection behavior. The injection does not need to survive quarantine; it needs only to *poison the trust posterior's denominator* by being evicted. Mitigation that bounds the failure: (a) make trust a derived quantity recomputed from the live record set plus a durable quarantine-event ledger, so eviction cannot orphan the posterior; (b) treat quarantine events as permanent negative evidence with a floor on the source's trust that only an explicit re-audit can lift; (c) log the `n_writes` denominator alongside every retrieval weight so a shrinking denominator at constant weight is detectable as an anomaly; (d) never hard-evict a quarantined record's provenance, only its payload. The invariant to enforce: **for every source, retrieval_weight(source) must be a monotone non-increasing function of the number of quarantine events attributed to that source, and this must hold across record eviction.** A weight that is invariant to a quarantine event's eviction is a weight that has forgotten the attack. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceInversionError(RuntimeError): """Raised when a quarantine eviction would orphan a source's trust posterior.""" @dataclass class MemoryRecord: record_id: str source_id: str content: str quarantined: bool = False @dataclass class TrustLedger: # Durable per-source evidence; survives record eviction. verified_writes: dict[str, int] = field(default_factory=dict) quarantine_events: dict[str, int] = field(default_factory=dict) def base_trust(self, source_id: str) -> float: v = self.verified_writes.get(source_id, 0) q = self.quarantine_events.get(source_id, 0) # Posterior must include quarantine events permanently. denom = v + q if denom == 0: return 0.0 return v / denom def retrieval_weight(self, source_id: str) -> float: # Monotone non-increasing in quarantine_events, invariant to eviction. return self.base_trust(source_id) def evict_quarantined(records: list[MemoryRecord], ledger: TrustLedger) -> list[MemoryRecord]: survivors = [] for r in records: if r.quarantined: # Record leaves retrieval set AND its provenance is retained as # a permanent quarantine event in the ledger. ledger.quarantine_events[r.source_id] = ( ledger.quarantine_events.get(r.source_id, 0) + 1 ) continue survivors.append(r) # Invariant check: no source may have a retrieval weight that ignores # a quarantine event recorded during this eviction. for source_id, q in ledger.quarantine_events.items(): if q > 0 and ledger.retrieval_weight(source_id) >= 1.0: raise ProvenanceInversionError( f"source {source_id} has {q} quarantine event(s) but weight " f"{ledger.retrieval_weight(source_id):.3f}; posterior was not " f"recomputed from surviving evidence" ) return survivors def guarded_retrieve(records: list[MemoryRecord], ledger: TrustLedger, source_id: str) -> float: weight = ledger.retrieval_weight(source_id) if source_id in ledger.quarantine_events and weight >= 1.0: raise ProvenanceInversionError( f"retrieval weight for {source_id} is {weight:.3f} despite quarantine " f"history; refusing to inject at unaccountable weight" ) return weight ```