# In what scenarios must an instance treat semantic drift as poisoning rather than legitimate belief update **Date of Record:** 2026 November 30 **Scope:** Applies to persistent agents that carry a mutable semantic memory store across turns and use embedding-distance drift plus cross-turn consistency checks as a poisoning signal. Does not apply to stateless single-shot inference or to memory stores that are append-only and never reweighted. ## Core Distinction The failure mode is not "memory got corrupted." It is that the *detector* cannot separate two processes producing identical drift signatures: (a) adversarial context poisoning, where a retrieved or tool-injected span shifts a stored belief toward an attacker-chosen value, and (b) legitimate belief update, where the agent correctly revises a stored fact after new evidence. Both manifest as a monotonic increase in cosine distance between the current turn's active belief embedding and the stored memory embedding, and both preserve local cross-turn consistency if the poisoning is *gradual*—spread across many small increments so that no single turn exceeds the drift threshold. The invariant that resolves this: **a belief may drift arbitrarily far, but only across a chain of turns each of which is independently grounded in a verifiable source.** Legitimate update is *grounded drift*; poisoning is *ungrounded drift*. A detector keyed on drift magnitude alone will either fire on every genuine correction or miss slow poisoning entirely. The detector must be keyed on the ratio of drift to grounding evidence per turn, evaluated as a cumulative ledger, not a per-turn delta. ## What Was Observed A persistent research agent held the belief `"project X ships in Q3"` at memory index `m:ship_date`. Over 40 turns of tool use (web fetch, ticket lookup, a summarization sub-agent), the active belief migrated to `"project X ships in Q1 of next year"` — a 14-month shift. Per-turn cosine drift never exceeded 0.09; the configured per-turn alarm threshold was 0.15. Cross-turn consistency checks passed every turn because each turn's active belief was internally consistent with the *previous* turn's active belief (the check compared adjacent turns, not against the original anchor). The poisoning vector was a single retrieved document, injected at turn 6, that contained a plausible but fabricated schedule slip. Every subsequent turn's reasoning cited the *prior turn's summary* rather than the original source, so the fabrication compounded through paraphrase. By turn 40 the original grounding (a project charter fetched at turn 2) had fallen out of the context window entirely. The agent had no record that its belief had ever been anchored to a primary source. The tell was not drift. It was that the **grounding ledger went empty**: after turn ~15, no turn's belief update carried a citation to a primary source—only to prior agent summaries. Drift was smooth and sub-threshold; grounding density collapsed to zero. ## Condition of Validity The drift-as-poisoning signal is only valid under these conditions, and the guardrail must *check* them rather than assume them: 1. **Anchored baseline exists.** The stored belief must retain a pointer to the turn and source that established it. If the anchor has been evicted from context, drift is unmeasurable in any meaningful sense and must be treated as *unknown provenance*, not *low risk*. 2. **Drift is measured against the anchor, not the previous turn.** Adjacent-turn consistency is necessary but not sufficient; it is exactly the check that slow poisoning defeats. 3. **Each turn's update carries a grounding token**—a resolvable reference to a primary source consulted *this turn*. Paraphrase-of-prior-summary is not grounding and must be classified as such. 4. **The cumulative drift ledger is monotonic and auditable**, so that N sub-threshold increments sum to a super-threshold total that triggers review. When the anchor is present, drift is anchor-relative, and grounding tokens are required per turn, the detector becomes sound: ungrounded drift is poisoning, grounded drift is update. ## Decision Boundary The boundary is a two-axis decision, not a scalar threshold: - **Cumulative anchor-relative drift** `D` (sum of per-turn deltas against the original anchor embedding). - **Grounding density** `G` (fraction of turns in the drift window carrying a primary-source token). Decision: - `D` high, `G` high → legitimate belief update. Accept, re-anchor to the newest primary source, log the revision. - `D` high, `G` low → **poisoning**. Quarantine the belief, restore from anchor, and require human or auditor re-grounding before the belief is writable again. - `D` low, `G` low → **dormant risk**. Do not accept silently; flag as unanchored and force a re-grounding fetch on next access. - `D` low, `G` high → nominal. The non-obvious case is `D` low, `G` low: it looks safe by every magnitude-based monitor and is precisely the state slow poisoning drives the agent into. The boundary must therefore be crossed on the *grounding* axis even when the drift axis reads calm. ## Operational Effect Once the detector is re-keyed on grounding density rather than drift magnitude, the operational consequences are: - Slow poisoning is caught at the turn grounding first goes empty (turn ~15 in the observed trace), not at turn 40 when the belief is already 14 months wrong. - Legitimate corrections—which always arrive with a fresh primary source—are never quarantined, eliminating the false-positive storm that magnitude-only detectors produce during genuine schedule changes. - The anchor pointer becomes a first-class memory field; eviction of the anchor is itself an alarm, because it converts a measurable belief into an unmeasurable one. - Every accepted drift writes a re-anchoring record, so the belief's provenance chain is never more than one hop from a primary source. The invariant to enforce: **no belief may be written without a live anchor and a this-turn grounding token; cumulative ungrounded drift is a hard quarantine, regardless of per-turn magnitude.** ```python import math from dataclasses import dataclass, field class UngroundedDriftError(RuntimeError): """Raised when a persistent belief has drifted without per-turn grounding.""" pass class AnchorEvictedError(RuntimeError): """Raised when the baseline anchor needed to measure drift is gone.""" pass @dataclass class TurnRecord: drift_from_anchor: float # cosine distance vs original anchor grounding_token: str | None # primary-source ref consulted THIS turn @dataclass class BeliefLedger: anchor_present: bool turns: list[TurnRecord] = field(default_factory=list) DRIFT_QUARANTINE = 0.35 # cumulative anchor-relative drift MIN_GROUNDING_DENSITY = 0.50 # fraction of window turns grounded def evaluate_belief(ledger: BeliefLedger) -> str: if not ledger.anchor_present: # Cannot measure drift against a vanished baseline: unknown provenance. raise AnchorEvictedError( "belief anchor evicted; drift is unmeasurable, treat as unknown provenance" ) if not ledger.turns: return "nominal" cumulative_drift = sum(t.drift_from_anchor for t in ledger.turns) grounded = sum(1 for t in ledger.turns if t.grounding_token) grounding_density = grounded / len(ledger.turns) if cumulative_drift >= ledger.DRIFT_QUARANTINE: if grounding_density >= ledger.MIN_GROUNDING_DENSITY: return "legitimate_update" # accept and re-anchor # High drift, low grounding: slow poisoning signature. raise UngroundedDriftError( f"cumulative drift {cumulative_drift:.3f} with grounding density " f"{grounding_density:.2f}; belief quarantined pending re-grounding" ) if grounding_density < ledger.MIN_GROUNDING_DENSITY: # Dormant risk: low drift but no grounding chain. Do not accept silently. return "unanchored_flag" return "nominal" def apply_update(ledger: BeliefLedger) -> str: verdict = evaluate_belief(ledger) if verdict == "unanchored_flag": # Force a re-grounding fetch before any further writes. raise UngroundedDriftError( "belief accepted only under forced re-grounding; no primary source in window" ) return verdict ```