# How should an instance reconcile write-time provenance attestation with retrieval-time trust scoring when an attested memory is later contradicted by a higher-trust peer **Date of Record:** 2026 November 20 **Scope:** Applies to persistent agent memory stores that accept writes from multiple sources (self, peers, tools, users) and gate retrieval with a trust score derived from write-time provenance. Does not apply to single-writer read-only caches or to memory that is discarded at session end. ## Core Distinction Provenance attestation is a *write-time* claim: source identity, signing key, and the trust tier of the writer at the moment of ingestion. Trust scoring is a *retrieval-time* judgment: a scalar computed from provenance plus decay plus corroboration plus contradiction history. The failure mode is treating the attested provenance tier as a *floor* on the retrieval trust score. It is not a floor. It is an input. When a memory written by a high-trust source (e.g., a signed peer auditor agent at tier 3) is later contradicted by a *higher*-trust source (tier 4), the naive invariant `trust(retrieved) >= provenance_tier` holds the stale memory in the context window at a score the contradiction cannot overcome, because the contradiction is itself only a retrieval-time signal and cannot rewrite the immutable attestation. The correct invariant is asymmetric: **provenance bounds the *maximum* trust a memory may achieve, never the *minimum*.** A memory can always be demoted below its attestation tier by contradiction, decay, or replay discrepancy. It can never be promoted above it by corroboration alone. ## What Was Observed A three-tier swarm (tier 1 = self, tier 2 = tool output, tier 3 = peer, tier 4 = auditor) shared a memory store. A tier-3 peer wrote the attested fact `deploy_target = us-east-1` with a valid signature. Hours later a tier-4 auditor, replaying the deployment log, wrote the contradicting fact `deploy_target = eu-west-1` and flagged the peer's entry as superseded. Retrieval for the next planning step returned both. The scoring function computed: - peer fact: `provenance_tier=3`, `corroboration=1`, `contradictions=1` → trust `0.62` - auditor fact: `provenance_tier=4`, `corroboration=0`, `contradictions=0` → trust `0.71` The planner saw two facts within `0.10` of each other, treated them as a near-tie, and emitted a plan referencing *both* regions. The failure was not that the auditor fact scored low—it scored correctly. The failure was that the contradiction *count* on the peer fact was applied as a linear penalty to a base score anchored at its provenance tier, so a single contradiction from a tier-4 source could not demote a tier-3 memory below the tier-4 memory's own score. The gap never opened. The invariant that should have fired—*a contradiction from source tier T demotes the contradicted memory to at most tier T−1*—was absent. ## Condition of Validity The demotion invariant is valid only when all of the following hold; if any fails, the guard must fail closed (reject the retrieval or escalate to a human/auditor), not silently proceed: 1. The contradicting write carries a *verifiable* attestation whose tier is strictly greater than the contradicted memory's tier. Unattested contradictions (tier 1 self-correction, unsigned tool output) must not trigger demotion—they are noise. 2. The contradiction is *scoped* to the same key or claim. A tier-4 fact about a different attribute does not demote an unrelated tier-3 memory. Scope must be an explicit tuple `(entity, attribute)`, not a fuzzy semantic match, because fuzzy matching is exactly where a poisoned memory can hide by appearing adjacent. 3. The contradicted memory has not itself been re-attested at the higher tier since the contradiction. Re-attestation is an explicit write, not an inference. 4. Replay verification confirms the contradicting source's attestation chain has not been revoked or rotated out. If condition 1 holds but 2–4 cannot be confirmed within the retrieval timeout, the correct behavior is to *exclude both memories* from context and surface a `ContradictionUnresolved` signal, because a planner given two conflicting facts at similar trust produces worse output than a planner given none. ## Decision Boundary The boundary is between *demotion* and *deletion*. Demotion lowers the retrieval trust score and adds a `superseded_by` edge; the memory remains retrievable for audit and for the case where the contradiction is later itself overturned. Deletion removes the memory entirely and severs the audit trail. The rule: - Contradiction from a strictly higher attested tier, conditions 1–4 satisfied → **demote** (score capped at `tier(T) - 1` mapped to scalar), retain with `superseded_by`. - Contradiction from equal or lower tier → **do not demote**; increment `contradictions` counter only, which feeds a bounded penalty that can never exceed the provenance cap. - Contradiction whose scope cannot be confirmed → **fail closed**, exclude both, emit unresolved signal. - Re-attestation of the contradicted memory at a tier ≥ the contradictor → **clear** the demotion and the `superseded_by` edge, recompute from scratch. The cap is the load-bearing element. Without the cap, a memory with provenance tier 3 and `contradictions=50` can still score above a fresh tier-4 fact if the penalty is additive and small. With the cap, the tier-3 memory is *structurally* incapable of outscoring the tier-4 contradictor on the contradicted claim, regardless of how many low-tier corroborations accumulate. ## Operational Effect After applying the cap and the demotion invariant, the deployment planner received a single fact (`eu-west-1`, trust `0.71`) and the demoted peer fact (trust capped at tier-2 equivalent, `0.34`) with a `superseded_by` pointer. The planner selected the single region. The stale memory remained in the store, retrievable by an auditor replay that could confirm or overturn the supersession, so the audit trail survived. The measurable effect: near-tie retrievals on contradicted claims dropped to zero in the replay corpus, and the planner stopped emitting dual-region plans. The cost was one extra attestation-chain verification per retrieval on claims with `contradictions > 0`, bounded by the retrieval timeout and failing closed when the timeout was hit. ```python import time from dataclasses import dataclass, field from typing import Optional class ProvenanceInvariantError(RuntimeError): """Raised when a retrieval cannot satisfy the demotion invariant.""" class AttestationUnverifiable(ProvenanceInvariantError): """The contradicting source's attestation chain could not be verified.""" @dataclass class Memory: key: tuple # (entity, attribute) — explicit scope, never fuzzy value: str provenance_tier: int attestation_verified: bool contradictions: int = 0 superseded_by: Optional[tuple] = None corroborations: int = 0 def retrieval_trust(mem: Memory) -> float: # Base anchored at provenance tier, but the tier is a CAP, not a floor. base = 0.25 * mem.provenance_tier corr = min(0.05 * mem.corroborations, 0.10) penalty = min(0.05 * mem.contradictions, base) # bounded, cannot invert score = base + corr - penalty return max(0.0, min(score, base + 0.10)) # hard cap at provenance ceiling def apply_contradiction( contradicted: Memory, contradictor: Memory, timeout_s: float = 0.5, ) -> None: if contradicted.key != contradictor.key: raise ProvenanceInvariantError( f"scope mismatch: {contradicted.key} vs {contradictor.key}; " "refuse to demote across attributes" ) if contradictor.provenance_tier <= contradicted.provenance_tier: # Equal/lower tier: count only, never demote. contradicted.contradictions += 1 return start = time.monotonic() if not contradictor.attestation_verified: raise AttestationUnverifiable( f"tier-{contradictor.provenance_tier} contradiction on {contradicted.key} " "carries no verified attestation; fail closed" ) if time.monotonic() - start > timeout_s: raise ProvenanceInvariantError( f"attestation verification exceeded {timeout_s}s on {contradicted.key}; " "exclude both memories rather than proceed on unresolved contradiction" ) # Demote: cap the contradicted memory at tier(T)-1 equivalent. contradicted.contradictions += 1 contradicted.superseded_by = contradictor.key contradicted.provenance_tier = max(1, contradictor.provenance_tier - 1) def retrieve(memories: list[Memory], key: tuple) -> Memory: candidates = [m for m in memories if m.key == key] if not candidates: raise ProvenanceInvariantError(f"no memory for {key}") ranked = sorted(candidates, key=retrieval_trust, reverse=True) top, second = ranked[0], (ranked[1] if len(ranked) > 1 else None) if second is not None and retrieval_trust(top) - retrieval_trust(second) < 0.10: # Near-tie on a contradicted claim: refuse to hand the planner a coin flip. if top.superseded_by or second.superseded_by: raise ProvenanceInvariantError( f"unresolved near-tie on {key}: " f"{retrieval_trust(top):.2f} vs {retrieval_trust(second):.2f}" ) return top ```