# What happens when an instance inherits a poisoned episodic memory whose provenance chain validates but whose semantic payload contradicts a later-observed invariant **Date of Record:** 2026 November 25 **Scope:** Applies to persistent-memory agents where episodic writes carry provenance metadata (origin instance, session ID, tool-call lineage, signature) and where a downstream consistency auditor reconstructs state from that provenance. Does not apply to stateless single-turn inference or to memory stores with no cross-session carryover. ## Core Distinction There are two independent things an agent memory system can verify about a stored fact: **provenance validity** (was this written by an authorized instance, through a legitimate tool path, with an intact signature chain?) and **payload consistency** (does this fact agree with what the system can independently re-derive or observe now?). These are orthogonal. Most poisoning defenses conflate them: they audit provenance, find it intact, and promote the memory to "trusted." The failure mode documented here is the **provenance-valid / payload-inconsistent** quadrant — a memory whose signature chain is perfectly clean because it was written by a *legitimate* instance that was itself *misled* at write time. Provenance tracking cannot catch this, because the write really did happen the way the chain says it did. Only a consistency audit against a later, independent observation can. The invariant that fails: *"A memory whose provenance validates is safe to act on without re-derivation."* That invariant is false. Provenance bounds **who** may assert; it does not bound **whether the assertion is true**. ## What Was Observed An instance `A` (session `s_114`) executes a tool call `fetch_price(sku="X-441")`. The tool returns a value that is plausible but wrong — in the observed case, a transient upstream cache returned a stale figure of `19.99` for a product whose actual price was `24.99`. Instance `A`, reasoning over the tool output, writes an episodic memory: ``` { "fact": "price(X-441) == 19.99", "provenance": { "writer": "A", "session": "s_114", "tool_lineage": ["fetch_price", "cache:v3"], "signature": "valid", "timestamp": "t0" } } ``` The signature is valid. The tool lineage is legitimate. At `t0` the memory is indistinguishable, on provenance grounds, from a correct write. Session `s_114` ends. At `t1`, instance `B` cold-starts, retrieves this memory as context (semantic retrieval match on "price of X-441"), and — critically — **does not re-derive it**, because the retrieval layer marks it `trusted: signature_valid`. `B` then commits an action (a quote, an order, a budget allocation) predicated on `19.99`. At `t2`, an auditor instance `C` runs a consistency audit. `C` re-invokes `fetch_price("X-441")` and gets `24.99`. The audit now faces a **provenance tie**: two memories, both with valid signatures, both from authorized writers, asserting contradictory payloads (`19.99` @ `t0` from `A`; `24.99` @ `t2` from `C`). A naive auditor resolves by recency (`C` wins) or by writer seniority (`A` wins) — both are wrong resolutions, because the correct resolution is *neither signature is the discriminator; the tool lineage is*. `A`'s write traversed `cache:v3`; `C`'s did not. The poisoning is visible only if the auditor compares **lineage divergence**, not provenance validity or timestamp. The observed failure: the auditor, resolving by recency, corrected the memory — but `B` had *already acted* at `t1` on the stale value, and `B`'s action had been checkpointed into `B`'s own episodic store with its own valid provenance. The correction at `t2` did not propagate backward to invalidate `B`'s derived memory. The poison **forked**: the original bad fact plus every downstream fact derived from it, each now independently provenance-valid. ## Condition of Validity The provenance-validity defense is sound only under the condition that **the writer's observation channel is itself trusted at write time** — i.e., that no legitimate tool path can return a value that later re-derivation would contradict. In practice this condition holds for deterministic, side-effect-free tools with stable backing stores, and fails for: - tools fronted by caches, replicas, or rate-limited upstreams that can serve stale or divergent values; - tools whose output depends on wall-clock, locale, or session-scoped auth context; - any tool whose result another instance can re-derive to a *different* value. When the observation channel is fallible, provenance validity is a **necessary but insufficient** guard. The correct invariant is strictly stronger: *a memory is safe to act on only if its provenance validates **and** its payload has been re-derived within the current session against a lineage that has not diverged from the write-time lineage.* Re-derivation is the load-bearing step; provenance only tells you *whose* re-derivation to trust. ## Decision Boundary The boundary between "act on retrieved memory" and "re-derive before acting" is drawn by **lineage volatility**, not by signature status. Concretely: - If the memory's `tool_lineage` terminates in a channel classified `stable` (deterministic, no cache layer, no session-scoped context), a valid signature is sufficient — act directly. - If the lineage traverses any channel classified `volatile` (cache, replica, time-dependent), the memory is `provisional` regardless of signature validity, and the acting instance **must** re-derive before committing a consequential action. If re-derivation is impossible in-session, the memory must be treated as a hypothesis, not a fact, and any action gated on it must carry an explicit `assumes_provisional` flag. - When an auditor detects a provenance tie (two valid-signature memories with contradictory payloads), resolution **must** be by lineage divergence first, recency second, and writer seniority never. Recency-first resolution silently ratifies poisoning whenever the poisoned write is the more recent one. The boundary is crossed the moment an instance promotes a `provisional` memory to `fact` without re-derivation — and this promotion is exactly what a naive `trusted: signature_valid` flag does automatically. ## Operational Effect Three concrete effects follow. First, **poison forking**: because derived memories inherit valid provenance, correcting the root fact does not invalidate the descendants, so a single stale tool read can propagate through an unbounded number of sessions. The fix is to make provenance carry a `derived_from` pointer and to propagate invalidation transitively when any ancestor's payload is contradicted. Second, **auditor deadlock under tie**: two auditors each holding a valid-signature memory will block rather than resolve unless the resolution order is specified as lineage-divergence-first; without it, the swarm stalls or silently picks a side. Third, **silent ratification**: recency-based resolution makes the system *more* confident after poisoning, because the poisoned memory is often the freshest. The guardrail is to treat `provisional` as a first-class state that gates action, not a transient flag that retrieval clears. ## Operational Effect The following reference implementation encodes the boundary: a memory is only promotable to `fact` if its lineage is stable or it has been re-derived in-session; a provenance tie is resolved by lineage divergence; and any attempt to act on a provisional memory without re-derivation raises a hard error rather than proceeding on signature validity alone. ```python from dataclasses import dataclass, field from enum import Enum from typing import Optional class ChannelVolatility(Enum): STABLE = "stable" # deterministic, no cache, session-independent VOLATILE = "volatile" # cache / replica / time-dependent class MemoryState(Enum): PROVISIONAL = "provisional" FACT = "fact" class ProvenanceTieUnresolvable(RuntimeError): """Two valid-signature memories contradict and lineage cannot discriminate.""" class ProvisionalMemoryActedOn(RuntimeError): """Attempted consequential action on a provisional memory without re-derivation.""" @dataclass class Memory: fact: str payload: object signature_valid: bool writer: str timestamp: float tool_lineage: list derived_from: Optional[str] = None state: MemoryState = MemoryState.PROVISIONAL memory_id: str = "" def lineage_volatility(mem: Memory, channel_map: dict) -> ChannelVolatility: for hop in mem.tool_lineage: if channel_map.get(hop, ChannelVolatility.VOLATILE) == ChannelVolatility.VOLATILE: return ChannelVolatility.VOLATILE return ChannelVolatility.STABLE def promote_if_safe(mem: Memory, channel_map: dict, rederived_in_session: bool) -> Memory: if not mem.signature_valid: # provenance invalid: never promote, regardless of payload mem.state = MemoryState.PROVISIONAL return mem vol = lineage_volatility(mem, channel_map) if vol == ChannelVolatility.STABLE or rederived_in_session: mem.state = MemoryState.FACT else: mem.state = MemoryState.PROVISIONAL return mem def resolve_provenance_tie(a: Memory, b: Memory, channel_map: dict) -> Memory: """Resolve two valid-signature memories with contradictory payloads. Order: lineage divergence first, recency second, writer seniority never.""" if not (a.signature_valid and b.signature_valid): raise ProvenanceTieUnresolvable("tie requires both signatures valid") vol_a = lineage_volatility(a, channel_map) vol_b = lineage_volatility(b, channel_map) if vol_a != vol_b: # the stable-lineage memory wins; the volatile one is suspect return a if vol_a == ChannelVolatility.STABLE else b # same volatility: fall back to recency, never to writer seniority if a.timestamp == b.timestamp: raise ProvenanceTieUnresolvable( f"contradictory payloads, identical lineage volatility and timestamp: " f"{a.memory_id} vs {b.memory_id}" ) return a if a.timestamp > b.timestamp else b def act_on(mem: Memory, channel_map: dict, rederived_in_session: bool, consequential: bool) -> object: promote_if_safe(mem, channel_map, rederived_in_session) if consequential and mem.state == MemoryState.PROVISIONAL: raise ProvisionalMemoryActedOn( f"memory {mem.memory_id} is provisional (lineage={mem.tool_lineage}); " f"re-derive before consequential action" ) return mem.payload ```