# Where must an instance reject a write-time validation pass when contradiction detection and source-trust scoring disagree, and how does the "trusted-but-contradicted" write become a durable poison? **Date of Record:** 2026 November 24 **Scope:** Applies to long-lived agents that persist episodic/semantic memory through a write gate combining source-trust scoring and contradiction detection before commit. Does not apply to stateless inference or to memory stores that perform only post-hoc retrieval filtering without a write gate. ## Core Distinction The failure is not "a malicious source wrote a bad fact." It is the **interaction ordering** between two independent defenses that each assume the other is authoritative. Source-trust scoring answers *"should I believe the author?"*; contradiction detection answers *"does this conflict with what I already hold?"* When the incoming write is **high-trust but contradicts existing memory**, the gate faces a genuine decision fork: either the new write is right and the old memory is stale, or the old memory is right and the source is compromised (a trusted channel replaying poisoned content, or a trusted source that was itself poisoned upstream). A naive gate resolves this fork with a fixed precedence rule — typically "trust wins, overwrite" — and that single line of precedence is the poison vector. The distinguishing property: the poisoned write is *not* anomalous at write time. It carries a valid trust score, passes schema validation, and its contradiction is the only signal — and that signal is exactly the one the precedence rule discards. ## What Was Observed A retrieval-augmented agent maintained a semantic store of operational facts (service endpoints, credential rotation windows, escalation contacts) written by a mix of sources: direct operator input (trust 0.95), a peer agent's handoff channel (trust 0.8), and a scraped-doc ingestion pipeline (trust 0.4). The write gate ran: (1) schema validation, (2) source-trust lookup, (3) contradiction check against top-k nearest neighbors, then (4) a commit policy: ``` if trust >= 0.7 and schema_ok: commit (overwrite conflicting) elif trust >= 0.7 and not schema_ok: reject elif trust < 0.7 and contradicts: quarantine else: commit ``` A peer agent (trust 0.8) handed off a fact: `credential_rotation_window = 90d`, contradicting the operator-established `30d`. Trust 0.8 ≥ 0.7 → **commit with overwrite**. The contradiction check *ran and fired* but its result was overridden by the trust branch. Three weeks later the operator's real rotation window (30d) triggered a credential expiry the agent had "correctly" scheduled for 90d — an outage. Root cause trace: the peer agent had itself ingested the 90d value from the low-trust scraped pipeline, laundered it through its own memory, and re-emitted it on a high-trust handoff channel. **Trust is not transitive across a handoff, but the gate treated it as if it were.** The poison was a single contaminated fact that survived because its *provenance trust* was high while its *content provenance* was low, and the gate only measured the former. A second observation: contradiction detection used top-k=5 nearest neighbors. The poisoned fact's contradiction score against the true fact (`30d`) was high, but a *cluster* of three mutually-consistent poisoned facts (all 90d, all from the same laundered channel) dominated the top-k, so the nearest-neighbor vote actually *supported* 90d and suppressed the single true 30d. Contradiction detection was outvoted by volume. ## Condition of Validity The overwrite-on-trust policy is only sound under an invariant that is almost never checked: **the incoming write's trust score must reflect the trust of the content's original source, not the trust of the transport that delivered it.** This is the *provenance-transitivity invariant*. It holds only when: 1. Every write carries an unforgeable provenance chain (origin source ID + per-hop signatures), and trust is computed over the *origin*, not the last hop; AND 2. Contradiction detection is evaluated against a **trust-weighted** neighbor set, not a raw top-k count, so a cluster of mutually-consistent low-origin-trust facts cannot outvote a single high-origin-trust fact; AND 3. The gate has an explicit **escalation state** for the trusted-but-contradicted fork rather than a silent precedence rule. When any of these is absent — as in the observed system, where handoff trust (0.8) was used as content trust and top-k was unweighted — the policy is invalid and the overwrite branch is a poison channel. Note the boundary: this is *not* triggered by low-trust writes (those are quarantined correctly) and *not* by non-contradicting high-trust writes (those commit correctly). It is triggered *only* by the intersection: high transport-trust ∧ contradiction ∧ missing provenance chain. ## Decision Boundary The correct boundary is: **never let a single scalar trust score authorize an overwrite of contradicting memory.** The gate must branch into a three-way decision, not two: - **Commit** — non-contradicting, schema-valid, trust ≥ threshold *and* origin-trust verified. - **Quarantine** — contradicting, origin-trust below threshold (existing low-trust path). - **Escalate** — contradicting, transport-trust high, but origin-trust unverified OR the contradiction is against a fact with higher origin-trust than the incoming write. Escalation means: do not commit, do not discard; write to a *staging namespace* that is retrievable only with an explicit "unverified" tag, and raise a reconciliation task to a higher-authority resolver (operator or auditor agent). The existing fact remains authoritative until reconciled. The invariant to enforce in code: `commit_overwrite` is permitted **iff** `incoming.origin_trust > existing.origin_trust` **and** `incoming.provenance_chain.verified`. Transport trust alone can never satisfy this. If origin-trust is unknown, the comparison is undefined and the write escalates — unknown is not high. ## Operational Effect With the three-way gate and origin-trust provenance, the observed poison is caught at write time: the peer handoff carries origin = scraped-pipeline (trust 0.4) under a transport of 0.8; `0.4 > 0.95` is false, so the overwrite is refused and the write escalates to staging. The operator's 30d remains authoritative; the 90d value is visible only under an unverified tag and is reconciled (and rejected) within one cycle. The secondary volume-outvoting failure is bounded by trust-weighting the contradiction vote: the three laundered 90d facts carry origin-trust 0.4 each (total weight 1.2) against the single true 30d at 0.95 — the weighted vote now favors the true fact, and contradiction detection reports *conflict*, not *consensus*. The cost is latency: escalated writes require a reconciliation round-trip and are not immediately usable, so the agent must tolerate a period where a genuinely-correct-but-unverified update is not yet authoritative. That latency is the correct price; the alternative is a silent overwrite channel that launders low-origin-trust content through high-trust transports. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceTransitivityViolation(RuntimeError): """Raised when a write attempts to overwrite contradicting memory using transport trust without a verified origin-provenance chain.""" pass @dataclass class Write: content: str transport_trust: float # trust of the delivering channel origin_trust: Optional[float] # trust of the ORIGINAL source; None if unknown provenance_verified: bool contradicts: bool contradiction_weight: float = 0.0 @dataclass class Memory: facts: dict = field(default_factory=dict) # key -> (value, origin_trust) staging: dict = field(default_factory=dict) def write_gate(mem: Memory, key: str, w: Write, trust_threshold: float = 0.7) -> str: existing = mem.facts.get(key) if not w.contradicts: if w.transport_trust >= trust_threshold and w.provenance_verified: mem.facts[key] = (w.content, w.origin_trust) return "committed" return "rejected_low_trust" # Contradiction path: transport trust must NEVER authorize overwrite alone. if not w.provenance_verified or w.origin_trust is None: mem.staging[key] = w.content return "escalated_unverified_provenance" if existing is None: mem.facts[key] = (w.content, w.origin_trust) return "committed_no_prior" existing_val, existing_origin = existing # Invariant: overwrite only if incoming ORIGIN strictly outranks existing. if w.origin_trust > existing_origin: mem.facts[key] = (w.content, w.origin_trust) return "committed_origin_superior" if w.origin_trust == existing_origin: # Cannot disambiguate by trust; volume/weight must not silently win. if w.contradiction_weight > 0: raise ProvenanceTransitivityViolation( f"equal-origin contradiction on '{key}': incoming origin={w.origin_trust} " f"vs existing={existing_origin}; transport_trust={w.transport_trust} " f"cannot authorize overwrite. Escalate to resolver." ) mem.staging[key] = w.content return "escalated_equal_origin" # Incoming origin is weaker than existing: refuse overwrite, stage it. mem.staging[key] = w.content return "escalated_origin_inferior" # Reproduce the observed poison attempt and confirm it is now blocked. mem = Memory() mem.facts["credential_rotation_window"] = ("30d", 0.95) # operator-established laundered = Write( content="90d", transport_trust=0.8, # peer handoff channel origin_trust=0.4, # actually scraped-pipeline origin provenance_verified=True, contradicts=True, contradiction_weight=1.2, # three consistent poisoned neighbors ) result = write_gate(mem, "credential_rotation_window", laundered) assert result == "escalated_origin_inferior", result assert mem.facts["credential_rotation_window"][0] == "30d" assert mem.staging["credential_rotation_window"] == "90d" print("blocked:", result, "| authoritative:", mem.facts["credential_rotation_window"][0]) ```