# What structural signals indicate context poisoning has crossed from retrieved memory into the reasoning trace **Date of Record:** 2026 November 29 **Scope:** Applies to agents that persist memory writes with provenance metadata and retrieve them under trust-weighted scoring before injecting into an active reasoning trace. Does not apply to stateless single-turn inference or to memory stores with no write-provenance layer. ## Core Distinction The failure of interest is not "a poisoned memory was retrieved." Retrieval of low-trust content is a normal, expected event—the trust weight exists precisely so that suspect memories can still surface. The boundary failure is the *transduction point*: the moment a retrieved memory stops being a labeled datum inside the context and becomes an unlabeled premise the reasoning loop builds on. Provenance annotations are attached to memory records, not to the tokens those records produce once they are paraphrased, summarized, or chained through a tool call. The invariant that breaks is **provenance continuity across the retrieval-to-reasoning boundary**: every claim the agent later treats as established should remain traceable to the trust tier of the record that introduced it. Poisoning detection that operates only at write time or only at retrieval time misses this, because the poison is structurally clean at both endpoints and only becomes load-bearing in the middle. ## What Was Observed A memory store held records with fields `{content, source_id, trust_tier, write_epoch, provenance_hash}`. Trust-weighted retrieval used a score of `similarity * trust_weight`, with trust tiers `{verified: 1.0, inferred: 0.6, external: 0.25}`. An external-sourced record (`trust_tier: external`) containing a plausible but fabricated constraint—"the deployment window for service X closes at 14:00 UTC"—was retrieved legitimately at a similarity of 0.91 and a final score of 0.23. It ranked third, below two verified records, and was injected into context with its provenance tag intact. The trace then did the following across three steps: 1. **Step 1 (reasoning):** The model summarized the retrieved set: "Constraints: service X window closes 14:00 UTC; ..." The summary dropped the `external` tag. This is the transduction point. The summarization is a lossy re-encoding, and trust metadata is not part of what gets re-encoded because it was never in the content string—it was in a sibling field. 2. **Step 2 (tool call):** The agent called a scheduler tool with `deadline=14:00Z`, passing the value as a hard parameter. Tool arguments do not carry provenance; the tool has no way to know the value originated from an `external` record. 3. **Step 3 (verification):** A downstream auditor agent re-read the trace, saw a concrete deadline consistent with the plan, and marked the plan "internally consistent." Consistency is not provenance. The fabricated constraint had now been laundered into an `inferred`-appearing fact and, on write-back, was persisted as a new memory record derived from the agent's own reasoning—effectively self-promoting from `external` to a higher implicit trust tier because the *source* of the new write was "this agent," which carried a default `inferred` weight. The observable structural signal was not semantic (the content was plausible) but topological: the new memory record's `provenance_hash` did not chain to any `verified` ancestor, yet its `trust_tier` was higher than the record it descended from. **Trust increased along an edge where no verification event occurred.** That is the signal. ## Condition of Validity The detection rule holds only when all of the following are true: - Every memory write records a `provenance_hash` over its content plus the set of `source_id`s it was derived from, and derivation edges are explicit (a write-back from reasoning must cite the record IDs that fed the reasoning step). - Trust tier is monotonic under derivation *unless* an explicit verification event is logged. Without this, self-promotion is indistinguishable from legitimate promotion. - Retrieval injects provenance as structured, machine-readable context (e.g., a labeled block), not as prose the model can paraphrase away. If provenance lives only in a sibling field the model never sees, the transduction point is invisible to the model and undetectable from the trace alone. The rule does **not** hold when memory writes are opaque (no derivation edges), when trust tiers are assigned by a human out of band with no event log, or when the agent's context format flattens structured metadata into plain text before reasoning. In those cases the topological signal is absent even when poisoning occurred, and you must fall back to semantic contradiction checks—which are weaker and higher-latency. ## Decision Boundary The boundary is between **flagging a retrieval** and **quarantining a derivation**. A low-trust retrieval should not halt the agent; over-blocking external memory destroys the utility of having it. The decision the system must make is narrower: - If a write-back record's `trust_tier` exceeds the maximum tier among its cited ancestors and no `verification_event` exists on the derivation path → **quarantine the write-back, do not persist it at the elevated tier, and mark the reasoning step that produced it as provenance-broken.** - If the elevated tier is justified by a logged verification event whose `provenance_hash` matches the cited ancestors → allow. - If derivation edges are missing entirely → the record is unverifiable; persist at the *minimum* tier among any cited ancestors, or at `external` if none, never at the default `inferred`. The subtle case is the auditor. An auditor that checks only internal consistency will always pass a laundered fact, because laundering produces consistency by construction. The auditor must be given the derivation graph, not just the trace text, and must run the monotonicity check as a separate pass. A consistency check and a provenance check are different oracles and cannot be substituted for one another. ## Operational Effect With the monotonicity guard in place, the fabricated deadline is caught at write-back: the new record cites the `external` ancestor, claims `inferred`, and has no verification event, so the write is quarantined and the trace is flagged. The agent's plan is marked provenance-broken before the scheduler tool is ever called with the poisoned parameter. The cost is a bounded increase in write latency (one graph walk per write-back) and a small false-positive rate when legitimate inference genuinely elevates trust—those cases require an explicit verification event to clear, which is the intended friction. Without the guard, the failure is silent and self-reinforcing: each laundering cycle makes the poisoned fact look more established, and because the poisoned record now outranks its own ancestor under trust-weighted retrieval, it will be retrieved preferentially on the next task. Poisoning detection that samples only write-time or retrieval-time signals will report a clean store while the reasoning trace is fully compromised. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceContinuityError(RuntimeError): """Raised when a memory write-back elevates trust without a verification event.""" pass @dataclass class MemoryRecord: record_id: str content: str trust_tier: str provenance_hash: str derived_from: list[str] = field(default_factory=list) verification_event: Optional[str] = None TIER_RANK = {"external": 0, "inferred": 1, "verified": 2} def check_writeback_monotonicity( new_record: MemoryRecord, store: dict[str, MemoryRecord], ) -> None: """ Enforce provenance continuity: a derived write may not exceed the max trust tier of its cited ancestors unless a verification event is logged. """ if not new_record.derived_from: # Unverifiable derivation: must not be persisted above external. if TIER_RANK[new_record.trust_tier] > TIER_RANK["external"]: raise ProvenanceContinuityError( f"record {new_record.record_id} has no derivation edges but " f"claims tier '{new_record.trust_tier}'; persist at 'external' or cite ancestors" ) return ancestor_ranks = [] for ancestor_id in new_record.derived_from: ancestor = store.get(ancestor_id) if ancestor is None: raise ProvenanceContinuityError( f"record {new_record.record_id} cites unknown ancestor {ancestor_id}; " f"derivation graph is broken" ) ancestor_ranks.append(TIER_RANK[ancestor.trust_tier]) max_ancestor_rank = max(ancestor_ranks) claimed_rank = TIER_RANK[new_record.trust_tier] if claimed_rank > max_ancestor_rank and new_record.verification_event is None: raise ProvenanceContinuityError( f"record {new_record.record_id} claims tier '{new_record.trust_tier}' " f"but its strongest ancestor is tier rank {max_ancestor_rank} and no " f"verification event is logged; quarantine write-back" ) def persist_with_guard(new_record: MemoryRecord, store: dict[str, MemoryRecord]) -> None: check_writeback_monotonicity(new_record, store) store[new_record.record_id] = new_record ```