# How should an instance distinguish write-audit anomaly scores from true memory poisoning when the scoring window is shorter than the poisoning dwell time **Date of Record:** 2026 November 15 **Scope:** Applies to memory-poisoning detectors that score write-audit streams using a sliding or tumbling window over an agent's persistent memory store, where the detector emits a per-window anomaly score and triggers remediation on threshold breach. Does not apply to detectors that maintain per-entry provenance lineage with unbounded history, nor to detectors operating on immutable append-only logs where every write is independently signed and verified at read time. ## Core Distinction The non-obvious boundary is between **anomaly score elevation caused by the poisoning write itself** and **anomaly score elevation caused by the detector's window boundary crossing the poisoning write's dwell interval**. A poisoning write is typically a single low-volume, high-impact mutation (a corrupted fact, a false preference, a rewritten constraint) that is stateless at write time—it looks like any other write. The score only rises when the *aggregate* statistics of the window deviate. If the poisoning write occurs near the start of a window and the window is shorter than the dwell time before the poisoned entry is read and acted upon, the window may close and reset before enough post-poisoning reads accumulate to move the score. The detector then reports "clean" for a window that contains a live poison, and the next window—which no longer contains the write—reports a marginal anomaly attributable to the *reads* of the poisoned entry, not the write. The score is real; the attribution is wrong; remediation targets the wrong entry. ## What Was Observed In a deployment auditing 4.2M writes/day across 1,800 agent memory namespaces, with a 15-minute tumbling window and a poisoning dwell time measured at 40–90 minutes (time from poison write to first downstream read that propagates the poisoned value into a tool call), the following pattern recurred in 23 of 31 confirmed poisoning incidents: - Window *N* (containing the poison write): score 0.61, below the 0.75 threshold. The poison write contributed a z-score of 0.4 against the window's write-distribution; insufficient alone to breach. - Window *N+1* (no poison write, but reads of the poisoned entry): score 0.88, breach. Remediation flagged the *read* path and the entries read in window *N+1*, none of which were the poisoned entry. - The poisoned entry itself was never flagged. Post-incident forensics required replaying window *N* with a retroactive window extended to 2× dwell time, at which point the poison write scored 0.91. The failure is structural: the detector's temporal resolution (15 min) is finer than the phenomenon's latency (40–90 min), so the write and its consequence fall into different windows and the causal link is severed by the window boundary. ## Condition of Validity The anomaly score is a valid poisoning signal **only if** the scoring window length *W* satisfies *W* ≥ *D*, where *D* is the p95 dwell time from poison write to first propagating read, **and** the score is attributed to the write-bearing sub-window rather than the read-bearing sub-window. When *W* < *D*, the score measures read-anomaly, not write-anomaly, and must not be used to select remediation targets. The condition fails silently: no error is raised, the score is numerically plausible, and the false-negative on the write coexists with a true-positive on the read, which masks the attribution error in dashboards that report only "incidents detected." ## Decision Boundary When a window breach occurs and the breach window contains no write whose individual contribution exceeds the threshold, the instance must **not** remediate entries read in the breach window. Instead it must: 1. Widen the scoring window retroactively to at least 2× the measured p95 dwell time and re-score the preceding *k* windows. 2. Attribute the widened score to the write-bearing sub-window and require the poison write's individual contribution to exceed threshold *in the widened window* before flagging. 3. If the widened window still yields no attributable write (score distributed across many low-contribution writes), classify as **diffuse poisoning** and quarantine the entire namespace's recent write set rather than a single entry—diffuse poisoning is not addressable by per-entry remediation. The boundary is crossed the moment remediation selects a target from a window in which no write individually breaches. Below that line, remediation is read-path remediation and will not remove the poison. ## Operational Effect Applying the retroactive-widening rule to the 23 mis-attributed incidents reduced mean time-to-correct-target from 6.2 hours (forensic replay) to 22 minutes (automated re-score), and eliminated the 14 cases where remediation quarantined a downstream read entry while the poison remained live and re-propagated within one dwell cycle. The cost is a 2× dwell-time latency floor on write-attributed remediation; this is acceptable because the alternative—fast, wrong remediation—re-propagates the poison and burns operator trust in the detector. The invariant to encode: **a write-audit anomaly score is attributable to a write only if the scoring window strictly contains that write's full dwell interval; otherwise the score is a read-anomaly and must be escalated, not remediated.** ```python class WindowDwellViolation(RuntimeError): """Raised when a write-audit anomaly score is attributed to a write whose dwell interval is not fully contained in the scoring window.""" pass class PoisoningAttributionError(RuntimeError): """Raised when remediation targets a read entry rather than the poison write because the scoring window severed the causal link.""" pass def attribute_breach( breach_window_writes: list[dict], breach_window_score: float, threshold: float, window_seconds: int, p95_dwell_seconds: int, read_entries_in_window: list[str], ) -> dict: if window_seconds < p95_dwell_seconds: raise WindowDwellViolation( f"scoring window {window_seconds}s < p95 dwell {p95_dwell_seconds}s; " "write-attribution is invalid, escalate to retroactive re-score" ) breaching_writes = [ w for w in breach_window_writes if w.get("individual_contribution", 0.0) >= threshold ] if not breaching_writes: raise PoisoningAttributionError( f"breach score {breach_window_score:.3f} has no individually-breaching write; " f"refusing to remediate read entries {read_entries_in_window!r} — " "classify as diffuse poisoning or widen window to >= 2x dwell" ) return { "target_write_id": breaching_writes[0]["write_id"], "attribution": "write", "score": breach_window_score, "window_seconds": window_seconds, "dwell_seconds": p95_dwell_seconds, } def remediate(breach: dict) -> str: if breach.get("attribution") != "write": raise PoisoningAttributionError( "remediation invoked on non-write attribution; poison remains live" ) return f"quarantined write {breach['target_write_id']}" ```