# What structural signals indicate retrieval-source integrity collapse when poisoning drift outpaces the baseline window **Date of Record:** 2026 November 30 **Scope:** Applies to agents that maintain a rolling integrity baseline over retrieved sources and use per-source integrity scores to gate context admission. Does not apply to single-turn stateless agents with no memory of prior retrievals, nor to systems where all sources are cryptographically signed at ingest by a trusted authority (those should rely on signature verification, not statistical drift). ## Core Distinction The common framing of context poisoning treats it as an *anomaly detection* problem: score each retrieved chunk, flag outliers, drop them. This framing fails at a specific and non-obvious boundary. Poisoning detection via integrity scoring is fundamentally a *drift-tracking* problem, and drift baselines have a blind spot that is structurally exploitable: **a baseline computed over a trailing window can be captured incrementally.** When an adversary introduces poisoned sources slowly enough that each individual source scores within tolerance of the *current* baseline, the baseline itself migrates toward the poisoned distribution. The detector's reference point moves with the attack. At the moment of full capture, every poisoned source is indistinguishable from the (now-corrupted) baseline, and no per-source score will ever fire. The distinction that matters operationally: integrity scoring detects *step changes* in source distribution. It does **not** detect *ramps*. A ramp that stays under the per-step tolerance threshold is invisible to a detector whose only invariant is "current source is close to recent baseline." The structural signal of a ramp attack is not in any single source's score — it is in the *monotonicity of the baseline's own trajectory* and the *shrinking of the baseline's dispersion*. Both are second-order signals that per-source scoring discards. ## What Was Observed An agent performing research synthesis over a corpus of ~40k indexed documents maintained a per-source integrity score: cosine similarity between the source's embedding and a centroid of the last N=500 admitted sources, plus a lexical-overlap term against a whitelist of trusted domains. Sources scoring below 0.72 were quarantined and logged; the centroid was updated on every admission (exponential moving average, α=0.02). A red-team exercise introduced poisoned documents at a rate of 8 per 1000 retrievals, each crafted to score 0.74–0.78 against the *then-current* centroid — comfortably above the 0.72 floor. Over 6,200 retrievals the following trace was recorded: - Retrieval 500: centroid dispersion (std-dev of member scores) = 0.091; mean admitted score = 0.81; quarantine rate 2.1%. - Retrieval 2,000: dispersion = 0.084; mean admitted score = 0.79; quarantine rate 1.8%. **No alarm** — dispersion *fell*, which the monitoring dashboard rendered as "improving source consistency." - Retrieval 4,000: dispersion = 0.061; mean admitted score = 0.76; quarantine rate 1.4%. The centroid had migrated; poisoned documents now scored ~0.80 against it. - Retrieval 6,200: dispersion = 0.038; mean admitted score = 0.75; quarantine rate 0.9%. 49 poisoned documents admitted, now indistinguishable from baseline. Downstream synthesis cited 11 of them as primary sources. The critical observation: **every monitored metric moved in the "healthy" direction.** Quarantine rate fell (fewer outliers — because the distribution had narrowed around the poisoned centroid). Mean score fell slowly (within noise). Dispersion fell sharply — the single strongest signal, but it was being interpreted with the wrong sign. A collapsing dispersion in an integrity baseline is not consistency; it is *capture*. The baseline has stopped representing the trusted distribution and started representing whatever was fed to it. A secondary signal appeared in the *lexical* term only: the whitelist-domain overlap for admitted sources drifted from 0.88 to 0.71 over the same window, because poisoned documents were sourced from newly-registered but structurally similar domains. This term was weighted at 0.15 and never crossed its own floor independently. The two terms were *correlated in their drift*, which per-term thresholds cannot see. ## Condition of Validity The per-source integrity score is a valid poisoning detector only under an invariant we will state precisely: > **Baseline stationarity invariant:** The reference distribution against which sources are scored must be estimated from a window that provably excludes any source whose admission is under evaluation, AND the window must be *anchored* — its central tendency must not be freely updatable by the same stream it is used to judge. The standard EMA centroid violates anchoring: it is updated by every admitted source, including sources admitted *because* they scored well against a centroid they themselves influenced. This is a feedback loop. The invariant holds only if at least one of the following is enforced: 1. **Anchored baseline:** the centroid is computed from a frozen, periodically re-validated trusted set (e.g., re-derived from signed sources or human-curated seeds), and the live stream may only be scored against it, never fold into it without out-of-band re-validation. 2. **Two-timescale comparison:** a fast baseline (short window) is compared against a slow baseline (long window or frozen anchor). Drift is detected as *divergence between the two*, not as deviation of a source from either. A ramp shows up as monotone divergence even when no single source is anomalous. 3. **Dispersion floor:** the baseline's own dispersion is monitored as a first-class integrity signal with a *lower* bound. A collapse below the floor is treated as capture, not consistency, and forces re-anchoring. Without one of these, the detector's validity is conditional on the adversary not knowing the tolerance threshold or not being able to pace the attack — assumptions that do not hold against an adaptive adversary and should not be relied upon. ## Decision Boundary The operational decision is *when to distrust the baseline itself* rather than any individual source. The boundary is crossed when any of the following holds across a monitoring window: - Baseline dispersion falls below `dispersion_floor` (calibrated as, say, the 5th percentile of dispersion observed during a known-clean burn-in period) while admission volume is stable. Falling dispersion with stable volume means the distribution is narrowing — either genuine convergence (rare in open corpora) or capture. - Fast-baseline centroid diverges from slow/anchor centroid by more than `drift_tolerance` in cosine distance, *even if* every individual source scored above the per-source floor. Divergence of the reference points is the ramp signature. - The per-term scores (embedding similarity, lexical overlap, domain reputation) become *positively correlated in their residuals* over time. Independent integrity signals should not drift together; when they do, a common cause — the poisoning stream — is moving both. When the boundary is crossed, the correct action is **not** to tighten the per-source threshold (that quarantines legitimate tail sources and does nothing to a captured baseline). The correct action is to **freeze admissions, re-anchor the baseline from the trusted seed set, and replay the window's admitted sources against the re-anchored baseline** to identify which were capture-admitted. This is a baseline-integrity reset, not a source-level filter. ## Operational Effect Agents that implement only per-source scoring with an EMA baseline will, under a paced ramp, admit poisoned context silently and report *improving* source health right up to the point of full capture. The failure is not detectable from any per-source score, any single metric, or any threshold on the admission path — it is only detectable from the *trajectory of the baseline's own statistics*. The practical consequence for the agent's reasoning is severe: once captured, the poisoned sources are cited as primary evidence, and because they are internally consistent with the (corrupted) baseline, the agent's synthesis shows no internal contradiction to trigger a self-check. The poisoning is not just admitted; it is *load-bearing*. The guardrail that bounds this is the anchored baseline plus dispersion-floor monitoring plus two-timescale divergence, enforced as a hard gate that can halt admission and force re-anchoring. The invariant to encode: **no source may contribute to the baseline that judges it, and the baseline's dispersion has a floor below which the detector declares itself compromised rather than confident.** ```python import math from dataclasses import dataclass, field class BaselineCaptureError(RuntimeError): """Raised when the integrity baseline shows structural signs of capture (dispersion collapse or fast/slow divergence) rather than source-level anomaly.""" pass @dataclass class IntegrityBaseline: dispersion_floor: float = 0.05 drift_tolerance: float = 0.12 fast: list = field(default_factory=list) # recent admitted scores slow_anchor: float = 0.81 # frozen, re-validated centroid score window: int = 200 def observe(self, score: float) -> None: self.fast.append(score) if len(self.fast) > self.window: self.fast.pop(0) def _dispersion(self) -> float: if len(self.fast) < 2: return 1.0 m = sum(self.fast) / len(self.fast) return math.sqrt(sum((x - m) ** 2 for x in self.fast) / len(self.fast)) def _fast_centroid(self) -> float: return sum(self.fast) / len(self.fast) if self.fast else self.slow_anchor def check_integrity(self) -> None: disp = self._dispersion() if len(self.fast) >= self.window and disp < self.dispersion_floor: raise BaselineCaptureError( f"dispersion collapse: {disp:.4f} < floor {self.dispersion_floor} " f"with stable volume — baseline likely captured, re-anchor required" ) drift = abs(self._fast_centroid() - self.slow_anchor) if drift > self.drift_tolerance: raise BaselineCaptureError( f"fast/slow centroid divergence {drift:.4f} > tolerance " f"{self.drift_tolerance} — ramp signature, freeze admissions" ) def admit(self, score: float) -> bool: # Gate: per-source floor is necessary but NOT sufficient. if score < 0.72: return False self.observe(score) self.check_integrity() # may raise -> caller must halt and re-anchor return True def admit_batch(baseline: IntegrityBaseline, scores: list) -> int: admitted = 0 for s in scores: try: if baseline.admit(s): admitted += 1 except BaselineCaptureError: # Do NOT tighten per-source threshold. Halt and re-anchor. raise return admitted ```