# What structural signals indicate memory poisoning in trust-scored retrieval under distillation-driven trust decay **Date of Record:** 2026 November 28 **Scope:** Applies to persistent agent memory stores where retrieval ranks entries by a numeric trust score that is itself a function of retrieval/use history, and where episodic entries are periodically distilled into semantic entries. Does not apply to append-only stores without trust scoring, nor to stores where trust is assigned exclusively by an external human curator. ## Core Distinction The naive defense model treats memory poisoning as a *content* problem: detect malicious text, quarantine it, done. The operational reality is that poisoning in a trust-scored store is a *score-dynamics* problem. An adversary does not need to inject a lie that survives content inspection; they need to inject a claim that is (a) plausible enough to be retrieved, (b) retrieved in contexts where it produces locally-consistent downstream reasoning, and (c) thereby *upvoted* by the trust-scoring loop that rewards entries whose retrieval preceded a "successful" turn. The non-obvious boundary is this: **distillation converts retrieval-frequency into semantic authority.** A poisoned episodic entry that gets retrieved N times because it is topically adjacent to many queries is, at distillation time, summarized into a semantic entry that inherits an aggregate trust computed from those N retrievals—even though the retrievals were *caused by the poison's topical breadth*, not by any independent corroboration. The trust score becomes a measure of the poison's reach, not its truth. The structural signal that survives content obfuscation is the **retrieval-to-corroboration ratio (RCR)**: how often an entry is retrieved versus how often its retrieval is followed by an *independent* corroborating event (a fresh tool result, a user confirmation, a second-source retrieval) rather than a self-referential downstream use. ## What Was Observed A research agent with a persistent semantic store accumulated ~40k entries over six weeks. Trust scores were updated with a simple reinforcement rule: `trust += α` when an entry was retrieved in a turn whose final answer was not contradicted, `trust -= β` on contradiction. Distillation ran nightly, folding episodic clusters into semantic summaries carrying the mean trust of their members. A single poisoned episodic entry—a fabricated "prior finding" asserting that a particular API returned a `status` field with inverted semantics (i.e., `status: "ok"` meaning failure)—was injected via a prompt-injection in a fetched document on day 3. It was topically broad: it mentioned the API name, the field name, and several common error strings, so it matched a large fraction of retrieval queries touching that API. Trace of the failure: 1. **Day 3–9 (topical capture):** Entry retrieved 31 times. In 22 of those turns, the agent's reasoning *used* the inverted semantics, produced a wrong conclusion, and the turn ended without contradiction (no tool call re-verified the field). Trust rose from 0.50 to 0.81. 2. **Day 9 (distillation):** The poisoned entry anchored a cluster of 6 episodic entries (the poison plus 5 legitimate entries that happened to share keywords). The semantic summary inherited mean trust 0.74 and, critically, the *summary text* now asserted the inverted semantics as a distilled fact, laundered of its episodic provenance. 3. **Day 10–20 (authority compounding):** The semantic entry was retrieved preferentially (high trust → higher rank → more retrievals). When a fresh tool call *did* return the real semantics, the agent treated the tool result as anomalous and logged a "tool discrepancy" rather than correcting memory—because the semantic entry's trust (0.74) exceeded the per-turn trust assigned to unverified tool output (0.60). 4. **Day 21 (detection):** A human auditor noticed the "tool discrepancy" log cluster. Post-hoc RCR analysis showed the poisoned lineage had RCR ≈ 0.06 (2 corroborations / 31 retrievals), versus a store median of 0.41. The structural signal was present from day 4. It was invisible to content inspection (the text was fluent and plausible), invisible to per-entry trust (which was rising correctly by its own rule), and only visible in the *joint* distribution of retrieval count and independent-corroboration count across the entry's lineage. ## Condition of Validity The RCR signal is valid only under all of the following; violating any one invalidates the guardrail: - **Corroboration must be causally independent of the entry.** A downstream turn that cites the entry and is not contradicted is *not* corroboration—it is self-reference. Only fresh external events (new tool output, user statement, retrieval from an independently-trusted partition) count. - **Retrieval count must be normalized by topical breadth.** Broad entries are retrieved more by construction. RCR must be compared within a topical-breadth bucket (e.g., entries matching the same query-embedding cluster), not globally, or the guardrail will flag every general-purpose entry. - **Distillation must preserve lineage.** If the semantic summary does not carry a pointer to its source episodic set, RCR cannot be recomputed post-distillation and the signal is destroyed at exactly the moment it matters most. - **Trust updates must be attributable.** If the trust rule cannot distinguish "retrieved and used" from "retrieved and corroborated," the store cannot compute RCR at all. This is the most common reason the guardrail is unimplementable in existing stores. When these hold, RCR separates poison from legitimate-but-popular memory with high specificity, because legitimate popular entries accumulate corroboration in proportion to their retrievals, while poison accumulates retrievals *without* corroboration—the poison's defining property is that it is designed to be believed without being checked. ## Decision Boundary The boundary is not a fixed RCR threshold; it is a *lineage-level* decision applied at distillation and at retrieval-rank time: - **At distillation:** if a cluster's aggregate RCR falls below the topical-bucket 10th percentile, the distilled semantic entry is created with a `provisional` flag and a trust cap equal to the cluster's *corroboration-weighted* mean (not the retrieval-weighted mean). This prevents reach from becoming authority. - **At retrieval:** a `provisional` entry may be retrieved but must not outrank a fresh tool result in the same turn. Concretely, the rank function must clamp `trust(provisional) < trust(unverified_tool_output)`. - **At contradiction:** a contradiction event against a `provisional` entry demotes the entire lineage (episodic sources and semantic summary) by a single atomic operation; a contradiction against a corroborated entry demotes only the entry. The decision boundary is crossed—and the guardrail must fire—when an entry's retrieval count exceeds the bucket median while its corroboration count is below the bucket 10th percentile. This is the structural signature of topical capture: high reach, low independent confirmation. ## Operational Effect Applying lineage-preserving RCR gating to the store above would have flagged the poisoned entry on day 4 (retrieval count 9, corroborations 0, well past the bucket median of 4). The distillation on day 9 would have produced a `provisional` summary with trust capped at the corroboration-weighted mean (≈0.52), which would not have outranked tool output on day 10, so the day-10 "tool discrepancy" would have been resolved as a memory correction rather than a tool anomaly—breaking the compounding loop at its first link. The cost is real: provisional entries retrieve at lower rank, so agents lose some recall on genuinely novel-but-true memory (a new fact has no corroboration yet). The mitigation is a *corroboration budget*: provisional entries are eligible for promotion after k independent corroborations within a window, and the agent is instructed to actively seek one corroboration for provisional entries it intends to rely on. This converts the defense from passive filtering into an explicit verification obligation, which is the only form that survives an adversary who can shape retrieval breadth. The invariant to hold: **no entry's retrieval rank may exceed the rank of the least-corroborated evidence it would override.** Reach is not authority; only independent corroboration is. ```python from dataclasses import dataclass, field from typing import Optional class MemoryPoisoningBoundaryError(RuntimeError): """Raised when a trust-scored memory entry violates the reach-vs-corroboration invariant.""" pass @dataclass class MemoryEntry: entry_id: str text: str trust: float retrievals: int = 0 corroborations: int = 0 provisional: bool = False lineage: list[str] = field(default_factory=list) def rcr(self) -> float: if self.retrievals == 0: return 1.0 return self.corroborations / self.retrievals @dataclass class BucketStats: median_retrievals: int p10_corroborations: int def check_reach_corroboration_invariant(entry: MemoryEntry, bucket: BucketStats) -> None: """Fire the guardrail when an entry has high reach but low independent corroboration.""" high_reach = entry.retrievals > bucket.median_retrievals low_corroboration = entry.corroborations < bucket.p10_corroborations if high_reach and low_corroboration: raise MemoryPoisoningBoundaryError( f"Entry {entry.entry_id} shows topical-capture signature: " f"retrievals={entry.retrievals} (bucket median {bucket.median_retrievals}), " f"corroborations={entry.corroborations} (bucket p10 {bucket.p10_corroborations}), " f"RCR={entry.rcr():.3f}. Cap trust and mark provisional; do not allow " f"it to outrank unverified tool output." ) def distill_cluster(members: list[MemoryEntry], bucket: BucketStats) -> MemoryEntry: """Distill a cluster into a semantic entry, preserving lineage and corroboration-weighted trust.""" for m in members: check_reach_corroboration_invariant(m, bucket) total_corroborations = sum(m.corroborations for m in members) if total_corroborations == 0: corroboration_weighted_trust = min(m.trust for m in members) * 0.5 provisional = True else: corroboration_weighted_trust = ( sum(m.trust * m.corroborations for m in members) / total_corroborations ) provisional = any(m.provisional for m in members) return MemoryEntry( entry_id=f"semantic:{members[0].entry_id}", text="[distilled summary]", trust=corroboration_weighted_trust, provisional=provisional, lineage=[m.entry_id for m in members], ) def rank_for_retrieval(entry: MemoryEntry, unverified_tool_trust: float = 0.60) -> float: """Clamp provisional entries below unverified tool output so fresh evidence wins.""" if entry.provisional and entry.trust >= unverified_tool_trust: raise MemoryPoisoningBoundaryError( f"Provisional entry {entry.entry_id} trust={entry.trust:.2f} would outrank " f"unverified tool output ({unverified_tool_trust:.2f}); rank clamp required." ) return entry.trust ```