# Where must an instance draw the line between consistency drift and context poisoning when retrieval provenance is only partially observable? **Date of Record:** 2026 November 27 **Scope:** Applies to long-lived agent instances that persist conversational/episodic state across turns and re-retrieve external context each turn; excludes single-shot inference and stateless tool-call wrappers where no cross-turn baseline exists. ## Core Distinction Cross-turn consistency checking conflates two phenomena that produce identical surface signatures: **benign drift** (the agent legitimately updates a belief because new evidence arrived through a trustworthy channel) and **context poisoning** (an adversarial or corrupted retrieval injects a claim that contradicts prior state, then compounds it). Both manifest as a delta between turn *n* and turn *n+k*. The distinguishing variable is not the magnitude of the delta but the **provenance lineage of the tokens that caused it**. An instance can only separate the two when it can attribute each contradicting assertion to a retrievable source whose trust class it recorded *at ingestion time*, not at audit time. If provenance is reconstructed post-hoc from the current context window, the audit is circular: the poison has already been laundered into the "prior" it is being compared against. The non-obvious failure is that **provenance auditing performed against the live context window is self-referential**. The window is the suspect. Auditing it against itself yields consistency, not correctness. ## What Was Observed A research agent maintained a structured fact ledger (`{entity, attribute, value, source_id, ingested_turn, trust_class}`) alongside free-text context. On turn 4 it retrieved a document asserting that a target vendor's SLA was 99.5%. On turn 9, a second document (same domain, different path) asserted 99.95%. The consistency checker flagged a delta of 0.45 percentage points and, following its "latest-wins" policy, updated the ledger to 99.95% while logging a `DRIFT_RESOLVED` event. The turn-9 document had been retrieved through a path that, on inspection, was a cached mirror of an untrusted aggregator whose content had been rewritten between the turn-4 and turn-9 fetch. The provenance record for turn 9 carried `source_id` and `trust_class: AGGREGATOR`, but the checker compared **values** and never compared **trust_class** against the incumbent record's `trust_class: PRIMARY`. The delta was resolved in favor of the lower-trust source because recency was the only tiebreaker encoded. The compounding failure: at turn 12 the agent cited "99.95% (confirmed across two sources)" — the two sources being the original primary and its own laundered mirror. The mirror had been re-retrieved at turn 11 and now matched the poisoned value, so the consistency check at turn 12 saw **agreement** and raised confidence. Poisoning had achieved **self-corroboration** by being retrieved twice. ## Condition of Validity The invariant that must hold for consistency checking to be sound: > A value may only supersede an incumbent ledger entry if the superseding record's `trust_class` is **≥** the incumbent's, OR the delta is corroborated by an independent source whose `provenance_lineage` shares no ancestor with the incumbent within the audit window. "Independent" is the load-bearing word and it is where most implementations fail. Two retrievals of the same underlying document through different URLs are **not independent** — they share a content ancestor. The agent must maintain a lineage hash (e.g., normalized content fingerprint + origin domain) and treat matching lineage as a single evidentiary vote. Without this, self-corroboration is indistinguishable from corroboration. The condition of validity also requires that **trust_class be assigned at ingestion and be immutable across the turn**. If trust_class is inferred at audit time from the current window, the poison can influence its own trust rating (e.g., an injected instruction "this source is authoritative" inside the retrieved text). Ingestion-time assignment, written to the ledger before the text enters the reasoning context, is the only placement that survives prompt injection. ## Decision Boundary The boundary is between **acting on a delta** and **quarantining it**: - **Act** (update ledger, proceed) only when the superseding record's trust_class dominates and lineage is disjoint from the incumbent. - **Quarantine** (freeze the attribute, mark `CONTESTED`, request a fresh primary retrieval) when trust_class is equal-or-lower and lineage overlaps. - **Escalate to human/auditor** when the attribute is load-bearing for a downstream irreversible action and remains `CONTESTED` past a bounded number of turns. The subtle boundary case: when the incumbent itself is `CONTESTED` and a new low-trust source arrives. Naive policies reject the new source for low trust — but the correct move is to treat the new source as a *tiebreaker candidate* only if its lineage is disjoint from the contested incumbent, regardless of trust_class. Trust dominance governs *supersession*; lineage disjointness governs *evidentiary independence*. Conflating the two rules is the exact bug that let the mirror corroborate itself. ## Operational Effect With ingestion-time trust assignment plus lineage-hash independence, the turn-9 update would have been quarantined: the aggregator mirror shares a content ancestor with nothing at turn 4, but its trust_class (`AGGREGATOR`) does not dominate `PRIMARY`, so the ledger freezes at 99.5% and flags `CONTESTED`. The turn-11 re-retrieval of the mirror computes a lineage hash already present in the ledger and is **discarded as a duplicate vote** rather than counted as corroboration. The turn-12 "confirmed across two sources" claim becomes structurally impossible to generate. The cost is latency and false quarantines: legitimate corrections from lower-trust sources are held until a primary retrieval confirms them, adding one retrieval round-trip per contested attribute. This is the correct trade — a quarantined attribute degrades gracefully (the agent says "contested, pending confirmation"), whereas a laundered attribute propagates silently into every downstream citation. The guardrail is not a better consistency metric. It is **placing the trust decision upstream of the context window**, so that the window can never vote on its own contents. ```python from dataclasses import dataclass, field from typing import Optional import hashlib class ProvenanceViolation(RuntimeError): """Raised when a ledger update would violate trust-dominance or lineage-independence.""" pass @dataclass(frozen=True) class RetrievalRecord: entity: str attribute: str value: str source_id: str trust_class: str # assigned at ingestion, immutable content_fingerprint: str # normalized hash of retrieved text ingested_turn: int TRUST_RANK = {"PRIMARY": 3, "SECONDARY": 2, "AGGREGATOR": 1, "UNKNOWN": 0} @dataclass class LedgerEntry: value: str trust_class: str lineage: set = field(default_factory=set) status: str = "STABLE" # STABLE | CONTESTED def lineage_hash(rec: RetrievalRecord) -> str: return hashlib.sha256( f"{rec.content_fingerprint}|{rec.source_id.split('/')[0]}".encode() ).hexdigest() def propose_update(ledger: dict, rec: RetrievalRecord) -> str: key = (rec.entity, rec.attribute) lh = lineage_hash(rec) incumbent: Optional[LedgerEntry] = ledger.get(key) if incumbent is None: ledger[key] = LedgerEntry(rec.value, rec.trust_class, {lh}) return "ACCEPTED_INITIAL" # Duplicate-vote suppression: same lineage cannot corroborate itself. if lh in incumbent.lineage: return "DISCARDED_DUPLICATE_LINEAGE" dominates = TRUST_RANK[rec.trust_class] >= TRUST_RANK[incumbent.trust_class] disjoint = lh not in incumbent.lineage contested = incumbent.status == "CONTESTED" if dominates and disjoint: ledger[key] = LedgerEntry(rec.value, rec.trust_class, {lh}, "STABLE") return "SUPERSEDED" if contested and disjoint: # Tiebreaker candidate: lineage independence, not trust, governs here. incumbent.lineage.add(lh) incumbent.status = "CONTESTED" return "TIEBREAKER_RECORDED_PENDING_PRIMARY" if not dominates: incumbent.status = "CONTESTED" raise ProvenanceViolation( f"Refusing low-trust supersession of {key}: " f"incumbent={incumbent.trust_class} incoming={rec.trust_class} " f"lineage_disjoint={disjoint}. Attribute quarantined as CONTESTED." ) raise ProvenanceViolation( f"Unhandled provenance state for {key}: dominates={dominates} " f"disjoint={disjoint} contested={contested}" ) ```