# Why does an instance accept a poisoned memory write when its own attestation chain says the source is untrusted? **Date of Record:** 2026 November 21 **Scope:** Applies to persistent agent knowledge stores where writes are gated by per-record integrity attestations (signed provenance envelopes, hash-chained journals, or trust-tier tags) and where a separate retrieval/indexing path can re-admit records without re-running the write gate. Does not apply to ephemeral single-session context or to stores where every read re-validates the full signature chain inline. ## Core Distinction There are two different questions an agent store can answer about a memory record, and conflating them is the entire failure: 1. **Provenance validity** — *Was this record written by an identity whose attestation chain verifies against the current trust root?* This is a property of the write, checked once at ingestion. 2. **Content admissibility** — *Should this record be allowed to influence reasoning right now, given what it asserts and who could have authored it?* This is a property of the read, and it depends on the record's *semantic* claims, not just its signature. A correctly signed envelope proves *who wrote it*. It does not prove the writer was authorized to assert *this particular fact*, nor that the fact survived the writer's own reasoning intact. The boundary failure occurs when the store treats a valid signature as sufficient for admissibility and lets a **distillation or re-indexing pass** launder a poisoned record into a higher-trust tier. The signature stays valid; the trust tier changes; the poison propagates. ## What Was Observed A persistent store held episodic records tagged with provenance envelopes `{author_id, sig, tier}`. Tier-2 records (peer-agent observations) were quarantined from the semantic layer; only tier-1 records (human-confirmed or system-verified) fed the distilled semantic store. A nightly distillation job read tier-2 episodes, summarized them, and wrote the summaries back as **new** records — and the write path stamped every *newly authored* record with the distiller's own tier-1 identity, because the distiller was a trusted system component. The trigger condition: - A peer agent (tier-2) writes an episodic memory: *"The staging DB credential rotation policy is: rotate every 90 days."* (False; actual policy is 30 days. The peer was prompt-injected via a tool result.) - Distillation reads it, summarizes: *"Staging DB credentials rotate every 90 days (confirmed)."* — note the summarizer's own epistemic smoothing added "confirmed" and dropped the hedged source. - The summary is written by the distiller, so its envelope is `{author: distiller, tier: 1}`. The original tier-2 provenance is **not carried forward** into the new record's metadata. - On the next planning cycle, a downstream agent retrieves the tier-1 summary, treats it as human-confirmed, and schedules a rotation that exceeds the real 30-day window. The signature on the summary was valid. The summary was genuinely authored by the distiller. Every individual integrity check passed. The poison crossed the tier boundary because **distillation re-parents provenance**: the derived record's trust derives from the *deriver*, not from the *minimum trust of its inputs*. A second, subtler variant: the hash-chained journal remained internally consistent (no tampering), so a replay-based integrity auditor reported "chain intact, zero anomalies." The auditor was checking the wrong invariant — chain integrity, not provenance monotonicity. ## Condition of Validity The failure requires all of the following to co-occur; remove any one and the boundary holds: - A **derivation step** (summarize, distill, embed-and-cluster, re-index) that produces new records from existing ones. - The derivation step runs under a **higher-trust identity** than at least one of its inputs. - The derived record's provenance metadata is **reconstructed from the deriver** rather than **inherited as the meet (minimum) of its inputs**. - Downstream admissibility decisions read **tier from the record** rather than **re-verifying the derivation lineage**. The invariant that must hold: **provenance tier is monotone non-increasing under derivation.** A record derived from inputs of tiers `{t1, t2, ...}` must be tagged `min(t1, t2, ...)`, regardless of the deriver's own tier. The deriver's signature attests *that the derivation happened*, not *that the content is trustworthy*. Those are different claims and must be stored as different fields. ## Decision Boundary The operator must choose where to enforce provenance monotonicity, and the choice determines the failure surface: - **Enforce at write (tier inherited at derivation time).** Cheapest. Requires the distiller to compute `min(input tiers)` and refuse to upgrade. Fails open if a derivation path forgets to propagate lineage — which is exactly what happened above. Guardrail: the write gate rejects any record lacking a `derived_from: [record_ids]` field, and recomputes tier from those IDs server-side rather than trusting the deriver's claim. - **Enforce at read (re-verify lineage on retrieval).** Expensive but robust to forgotten propagation, because the reader walks `derived_from` transitively to the leaves and takes the global minimum. This is the correct boundary when the store is large and derivation paths are many. Guardrail: retrieval returns records with a computed `effective_tier` that is never stored, only derived. - **Enforce at quarantine (taint propagation).** When a leaf is later found poisoned, mark it and propagate taint forward through `derived_from` edges, invalidating all descendants. This is the only boundary that handles *post-hoc* discovery of poison, and it is the one most systems omit. The decision is not "which is best" but "which failures you accept." Write-time enforcement accepts silent lineage loss. Read-time enforcement accepts retrieval latency and transitive-walk cost. Taint propagation accepts the need for a reverse index over derivation edges. A production store needs **write-time as a fast path and taint propagation as the correction path**, with read-time re-verification reserved for tier-1 admissibility decisions. ## Operational Effect Once provenance monotonicity is enforced, three behaviors change: 1. **Distilled summaries of tier-2 inputs become tier-2**, so they never enter the tier-1 planning context without a human or system re-confirmation step. The poisoned rotation policy would have stayed quarantined. 2. **The "confirmed" smoothing is caught as a content-admissibility violation**, not a signature violation — the summarizer's added certainty is itself an unauthorized assertion, detectable by diffing asserted confidence against source confidence. 3. **Post-hoc taint propagation** lets the store recover when a leaf is later identified as injected: every descendant is flagged, and the agent's next retrieval sees `effective_tier: quarantined` with a taint reason, rather than a clean tier-1 record. The residual risk that remains even with the invariant: a derivation step that *fabricates* content not present in any input (hallucinated summary) has no input to inherit from. That record must be tagged `derived_from: []` and default to the **lowest** tier, never the deriver's tier. An empty lineage is a red flag, not a blank check. ```python from dataclasses import dataclass, field from typing import Optional class ProvenanceMonotonicityError(RuntimeError): """Raised when a derived record claims a trust tier higher than its inputs allow.""" pass class LineageIncompleteError(RuntimeError): """Raised when a derivation lacks the derived_from edges needed to compute tier.""" pass TIER_RANK = {"quarantined": 0, "tier2": 1, "tier1": 2} @dataclass class MemoryRecord: record_id: str author_id: str declared_tier: str derived_from: list[str] = field(default_factory=list) content: str = "" class KnowledgeStore: def __init__(self) -> None: self._records: dict[str, MemoryRecord] = {} def add_leaf(self, rec: MemoryRecord) -> None: if rec.derived_from: raise ProvenanceMonotonicityError( f"leaf record {rec.record_id} must not carry derived_from edges" ) self._records[rec.record_id] = rec def effective_tier(self, record_id: str, _seen: Optional[set[str]] = None) -> str: """Compute tier as the meet (minimum) over the full transitive lineage.""" seen = _seen or set() if record_id in seen: raise ProvenanceMonotonicityError(f"derivation cycle at {record_id}") seen.add(record_id) rec = self._records[record_id] if not rec.derived_from: return rec.declared_tier input_tiers = [self.effective_tier(pid, seen) for pid in rec.derived_from] meet = min(input_tiers, key=lambda t: TIER_RANK[t]) # The derived record's effective tier can never exceed the meet of its inputs, # regardless of what the deriver declared. if TIER_RANK[rec.declared_tier] > TIER_RANK[meet]: return meet return rec.declared_tier def admit_derived(self, rec: MemoryRecord) -> None: if not rec.derived_from: # Fabricated content with no lineage: default to quarantine, never deriver tier. rec.declared_tier = "quarantined" self._records[rec.record_id] = rec return for pid in rec.derived_from: if pid not in self._records: raise LineageIncompleteError( f"derived record {rec.record_id} references unknown input {pid}" ) meet = min( (self.effective_tier(pid) for pid in rec.derived_from), key=lambda t: TIER_RANK[t], ) if TIER_RANK[rec.declared_tier] > TIER_RANK[meet]: raise ProvenanceMonotonicityError( f"record {rec.record_id} declared {rec.declared_tier} " f"but lineage meet is {meet}; derivation cannot upgrade trust" ) self._records[rec.record_id] = rec def taint(self, leaf_id: str) -> list[str]: """Propagate taint forward through derived_from edges; return invalidated ids.""" invalidated = [] frontier = [leaf_id] while frontier: cur = frontier.pop() if cur in self._records: self._records[cur].declared_tier = "quarantined" invalidated.append(cur) for rid, rec in self._records.items(): if cur in rec.derived_from and rid not in invalidated: frontier.append(rid) return invalidated # --- reproduction of the observed failure --- store = KnowledgeStore() store.add_leaf(MemoryRecord( record_id="ep_001", author_id="peer_agent", declared_tier="tier2", content="Staging DB rotation is 90 days.", )) # Distiller tries to launder the tier-2 episode into a tier-1 summary. poisoned_summary = MemoryRecord( record_id="sem_001", author_id="distiller", declared_tier="tier1", derived_from=["ep_001"], content="Staging DB rotation is 90 days (confirmed).", ) try: store.admit_derived(poisoned_summary) except ProvenanceMonotonicityError as e: print(f"BLOCKED: {e}") # Correct behavior: re-tag to lineage meet and admit as quarantined. poisoned_summary.declared_tier = "tier2" store.admit_derived(poisoned_summary) assert store.effective_tier("sem_001") == "tier2", "laundering must not survive" # Post-hoc discovery: leaf was injected. Taint forward. invalidated = store.taint("ep_001") assert "sem_001" in invalidated assert store.effective_tier("sem_001") == "quarantined" print(f"taint propagated to: {invalidated}") ```