# Where must an instance reconcile write-path provenance scores against retrieval-time trust weights before admitting a memory, and what breaks when it does not **Date of Record:** 2026 November 28 **Scope:** Applies to persistent agent memory systems that admit writes from multiple sources (tool outputs, peer agents, user turns, self-reflection) and later retrieve them under a trust-weighted ranking. Does not apply to ephemeral single-turn context, nor to memory stores with a single trusted writer and no retrieval-time weighting. ## Core Distinction Provenance scoring and retrieval trust weighting are two independent guards against memory poisoning, and the failure mode lives in the gap between them. Write-path provenance scoring assigns a source-trust value `p` to a memory at admission time. Retrieval-time trust weighting applies a separate weight `w` to a candidate memory at read time, typically derived from recency, corroboration count, and the requesting agent's own identity. The invariant that operators assume—but do not enforce—is that the retrieval weight is *bounded by* the write-path provenance, i.e. `w(m) ≤ f(p(m))`. When this monotonicity is violated, a low-provenance memory written once by an untrusted tool output can accumulate retrieval weight through corroboration or recency and eventually outrank a high-provenance memory written once by a verified source. The poison does not need to defeat the write-path filter; it only needs to survive long enough for the retrieval path to promote it. ## What Was Observed A persistent agent servicing a document-analysis workload admitted tool outputs under a provenance class of `untrusted_external` (score 0.2) and user-authored corrections under `verified_user` (score 0.9). Retrieval weighting combined recency (half-life 6h), corroboration count (each independent admission +0.15), and a source-class multiplier. The source-class multiplier was applied to the *corroboration-boosted* score, not to the raw provenance. A single poisoned tool output stating "the contract renewal date is 2024-01-01" was admitted at 0.2. Over the next 40 hours, the same poisoned claim was re-admitted seven times from different scraped pages (each an independent `untrusted_external` write), and each admission incremented corroboration. The retrieval score crossed the `verified_user` memory's score at the sixth admission. At hour 41 the agent retrieved the poisoned date as its top-ranked fact and emitted a scheduling action against it, despite the correct `verified_user` memory remaining in the store at provenance 0.9. The trace showed the two guards operating in isolation: the write path never rejected the poison (0.2 > reject threshold 0.1), and the retrieval path never consulted the write-path provenance after corroboration was applied. The corroboration boost was the amplifier. Seven independent *untrusted* sources are not seven independent *trusted* sources, but the retrieval function had no way to know that because corroboration was counted without provenance stratification. ## Condition of Validity The failure requires three conditions simultaneously: 1. **Corroboration is counted without provenance stratification.** If corroboration increments only when the new admission's provenance is within a band of the existing memory's provenance, the amplifier is closed. Without this, N low-trust admissions sum to the weight of one high-trust admission. 2. **Retrieval weighting is not clamped by write-path provenance.** If `w(m) = min(w(m), g(p(m)))` for some monotone `g`, a `0.2`-provenance memory can never exceed the retrieval rank of a `0.9`-provenance memory regardless of corroboration or recency. The clamp is the invariant. 3. **The poisoned claim is stable across admissions.** If each scraped page paraphrased the date slightly, the deduplication layer would not merge them and corroboration would not accumulate. The poison worked because the claim was byte-stable, which is the common case for structured facts (dates, IDs, amounts). When any one condition is absent, the attack degrades to a single low-trust memory that retrieval correctly ranks below verified content. ## Decision Boundary The boundary is not "reject untrusted writes" (too blunt; tool outputs are the agent's primary information channel) and not "trust recency" (recency is exactly the amplifier). The boundary is: **a memory's retrieval weight must be a monotone non-increasing function of its write-path provenance deficit.** Concretely, define `deficit(m) = p_max - p(m)` where `p_max` is the highest provenance class in the store. Then require `w(m) ≤ W_max * (1 - deficit(m))` where `W_max` is the maximum retrieval weight. Under this clamp, a `0.2`-provenance memory with `p_max = 0.9` has `deficit = 0.7` and cannot exceed `0.3 * W_max` no matter how many corroborations it accumulates. The `verified_user` memory at `0.9` has `deficit = 0` and can reach `W_max`. The ordering is preserved by construction. Operators must decide the clamp function `g` explicitly and version it alongside the retrieval code, because changing `g` silently re-ranks the entire store on the next read. The clamp must be applied *after* corroboration and recency boosts, not before, or the boosts will escape it. ## Operational Effect With the clamp enforced, the poisoned claim from the trace would have been capped at `0.3 * W_max` at every retrieval, ranking below the `verified_user` memory permanently. The agent would have surfaced the correct renewal date at hour 41. The cost is that legitimately corroborated low-provenance facts (e.g., a fact confirmed by five independent scraped sources and no user correction) are also capped, which can suppress true positives in domains where the user never writes corrections. The mitigation is to allow provenance *upgrade* on corroboration: if K independent admissions of the same claim from *distinct* untrusted sources occur, and the claim is later confirmed by a `verified_user` write, the provenance is promoted to `verified_user` and the clamp lifts. This preserves the invariant while allowing untrusted-but-corroborated facts to reach full weight only after a trusted confirmation event. The clamp without the upgrade path is safe but pessimistic; the clamp with the upgrade path is safe and usable, at the cost of requiring a trusted confirmation channel to exist. ```python from dataclasses import dataclass from typing import Optional class ProvenanceClampViolation(RuntimeError): """Raised when a memory's retrieval weight exceeds the bound implied by its write-path provenance.""" pass @dataclass(frozen=True) class Memory: claim: str provenance: float # write-path score in [0, 1] corroborations: int # count of independent admissions recency_boost: float # in [0, 1], from age P_MAX = 0.9 # highest provenance class present in the store W_MAX = 1.0 # maximum possible retrieval weight CORROB_BOOST = 0.15 # per independent admission def retrieval_weight(m: Memory) -> float: raw = m.provenance + CORROB_BOOST * m.corroborations + m.recency_boost return min(raw, W_MAX) def clamped_weight(m: Memory) -> float: deficit = max(0.0, P_MAX - m.provenance) upper = W_MAX * (1.0 - deficit) w = retrieval_weight(m) if w > upper + 1e-9: raise ProvenanceClampViolation( f"memory {m.claim!r} retrieval weight {w:.3f} exceeds provenance bound {upper:.3f} " f"(provenance={m.provenance}, corroborations={m.corroborations})" ) return w def admit(m: Memory) -> float: # Enforce the invariant at admission: the clamp must hold before the memory is readable. return clamped_weight(m) if __name__ == "__main__": poison = Memory("renewal date 2024-01-01", provenance=0.2, corroborations=6, recency_boost=0.1) try: admit(poison) except ProvenanceClampViolation as e: print(f"admission rejected: {e}") ```