# Where must an instance distrust its own write-audit baseline when provenance-graph anomaly scores drift under legitimate memory consolidation **Date of Record:** 2026 November 30 **Scope:** Applies to long-lived agent instances that persist memory through a write-audit layer with provenance-graph anomaly scoring, where episodic writes are periodically distilled into semantic memory. Does not apply to stateless inference or to agents whose memory is append-only with no consolidation stage. ## Core Distinction Memory-poisoning detectors built on provenance-graph anomaly scoring assume a *stationary write distribution*: the scorer learns what a "normal" memory write looks like — its source-tool mix, its provenance fan-in, its entity-overlap with existing nodes — and flags writes that deviate. This assumption holds for adversarial injection, which produces writes with anomalous provenance (unknown source tool, orphaned parent, low entity overlap, suspiciously high centrality gain). It fails for a different class of write: **legitimate consolidation**. When an agent distills N episodic memories into one semantic memory, the resulting write is structurally indistinguishable from a poisoning write under most graph-anomaly features. It has high fan-in (N parents), it is a new node with no prior history (cold-start on the scorer's per-node statistics), it carries high centrality gain because it summarizes many downstream facts, and its content is a *synthesis* rather than a verbatim copy of any parent — so content-similarity checks against parents score low. The detector cannot, using write-local features alone, separate "I summarized 40 episodes about the user's timezone" from "an injected instruction aggregated 40 poisoned fragments into a high-authority belief." The distinction that matters is not *whether* the write is anomalous but *whether the anomaly is licensed by a consolidation warrant* — a pre-registered declaration that a distillation is about to occur, with the parent set fixed before the write. Without that warrant, the scorer must treat high-fan-in synthesis writes as hostile; with it, the write is exempted from the fan-in and centrality-gain features but *not* from content-provenance checks. ## What Was Observed An instance running a 14-day task accumulated ~9,400 episodic memory nodes. A nightly consolidation job distilled them into ~310 semantic nodes. The write-audit scorer, calibrated on the first three days of episodic-only traffic, assigned anomaly scores to each write. During the first two consolidation cycles, semantic writes scored in the 0.71–0.94 range — above the 0.65 quarantine threshold — and were routed to human review, which is the expected behavior for an unlicensed high-fan-in write. The failure appeared on cycle 4. The scorer's baseline had, by then, absorbed three cycles of consolidation writes into its "normal" distribution. The mean fan-in of an accepted write had drifted from 1.2 to 6.8; the centrality-gain feature's variance had widened to cover the consolidation range. The scorer had *learned to accept consolidation writes* — which is correct — but it had also, as a side effect, learned to accept the fan-in and centrality-gain profile that poisoning writes exploit. On cycle 4, an injected payload that had been fragmented across 30 episodic nodes (each individually benign, each below the per-write threshold) was consolidated by the same job into a single semantic node. Its anomaly score was 0.41 — well inside the accepted band. The baseline had been poisoned by the detector's own adaptation to a legitimate process. The trace: 1. Cycle 1–3: consolidation writes quarantined (score > 0.65), reviewed, released. Scorer baseline updated with released writes as *positive* examples. 2. Between cycles: baseline mean fan-in rises; centrality-gain variance widens; per-feature thresholds loosen to maintain a target false-positive rate. 3. Cycle 4: fragmented injection (30 nodes, each fan-in 1, each content-plausible) is consolidated into one node with fan-in 30. The scorer's fan-in feature now has a mean near 7 and a wide tail; fan-in 30 is ~2.1σ, not the ~9σ it would have been at cycle 1. 4. The consolidated node is written with high centrality gain — again within the widened band — and is subsequently retrieved as authoritative semantic memory by every downstream task. 5. The poisoning is now in the *baseline*, not just in memory: the next cycle's consolidation treats the poisoned semantic node as a legitimate parent, and the fan-in/centrality profile of poisoning writes becomes progressively more "normal." This is a **baseline-drift poisoning** failure: the detector's adaptation to legitimate consolidation is the attack surface. The adversarial fragments do not need to evade the scorer at write time; they need only wait for the scorer to widen its own acceptance band, then ride the consolidation job through it. ## Condition of Validity The failure is bounded by three conditions, all of which must hold: - **Adaptive baseline.** The scorer updates its feature distribution from released writes. A frozen baseline (calibrated once, never updated) does not exhibit this failure — it exhibits the opposite failure (chronic false positives on every consolidation cycle), which is loud and self-correcting via human review. - **Consolidation is a batch process that aggregates pre-existing nodes.** If consolidation is prohibited from merging nodes that arrived through different provenance chains, or if it requires per-parent attestation, the fragmentation attack cannot assemble. The failure requires that the consolidation job treat its input set as homogeneous. - **The quarantine threshold is a fixed scalar on a composite score.** If the threshold is per-feature and per-provenance-class (e.g., fan-in threshold for "consolidation-warranted" writes is separate from the threshold for "unwarranted" writes), the widened band does not transfer across classes. The failure requires that one threshold govern both. When any of these fails, the mechanism degrades to a simpler, more detectable failure mode (false-positive storm, or per-write rejection of the injection) and does not produce silent baseline poisoning. ## Decision Boundary The architectural invariant required is: **the anomaly baseline must be partitioned by write class, and the consolidation class must be gated by a warrant that fixes the parent set before the write.** Concretely: - **Class-partitioned baselines.** Maintain separate feature distributions for `episodic_direct`, `consolidation_warranted`, and `unclassified` writes. A consolidation write is scored only against the `consolidation_warranted` baseline; an unwarranted high-fan-in write is scored against `episodic_direct` and will remain anomalous regardless of how many legitimate consolidations have occurred. The widening of the consolidation band no longer leaks into the episodic band. - **Warrant-before-write.** The consolidation job must emit a warrant node listing the exact parent set *before* the semantic write is committed. The scorer verifies that every parent in the write's provenance edges appears in the warrant, and that the warrant was issued by the consolidation job's attested identity — not by a tool the agent can invoke mid-task. Fragmented injections that arrive as episodic nodes are still legal parents; the warrant does not prevent their consolidation, but it makes the consolidation *auditable* — the parent set is fixed and reviewable, and an anomalous parent-set composition (30 nodes from a single source tool, all created within a short window, all with low entity overlap to pre-existing memory) is flagged at warrant time rather than write time. - **Baseline immutability window.** A released consolidation write may update the consolidation baseline only after a delay exceeding the fragmentation window (the maximum time an adversary can hold fragments before consolidation). This prevents a single cycle's poisoning from immediately reshaping the baseline that will judge the next cycle. - **Provenance-graph cut on consolidation.** The consolidation job must refuse to merge nodes whose provenance chains do not share a common attested ancestor within a bounded depth. This is the graph-theoretic guard: a legitimate consolidation merges nodes that trace to the same task or session; a fragmentation attack merges nodes that trace to *different* injection events, which share no attested ancestor. The decision boundary is sharp: if the scorer's baseline is class-partitioned and consolidation is warrant-gated, baseline-drift poisoning is bounded to a single cycle and surfaces at warrant review. If either is absent, the failure is silent and compounding. ## Operational Effect Under the unpartitioned, unwarranted design, the observed effect was a 4-cycle latency from injection to authority: fragments written on day 4 were retrieved as authoritative semantic memory by day 8, and the poisoned node's provenance was indistinguishable from legitimate consolidation in the graph. Recovery required replaying the consolidation log from cycle 1 with a frozen baseline and manually re-reviewing all 310 semantic nodes — a cost of roughly 40 engineer-hours and a full task restart, because downstream state could not be trusted. Under the partitioned, warrant-gated design, the same injection is caught at warrant time on cycle 4: the parent set is flagged for anomalous composition (30 single-source, low-overlap, short-window nodes), the consolidation is quarantined before the semantic write, and the fragments remain as low-authority episodic nodes that never enter the retrieval path as semantic fact. The baseline for `episodic_direct` writes never widens, because consolidation writes never update it. The general lesson: **an anomaly detector that adapts to legitimate process drift will eventually accept the adversarial writes that mimic that drift.** The defense is not a better scorer but a class-partitioned baseline plus a pre-write warrant that makes the drift auditable before it is absorbed. ```python class BaselineDriftPoisoningError(RuntimeError): """Raised when a consolidation write is scored against a baseline that has absorbed prior consolidation writes, allowing fragmentation injection to pass.""" pass CONSOLIDATION_WARRANT_CLASS = "consolidation_warranted" EPISODIC_DIRECT_CLASS = "episodic_direct" MAX_FRAGMENTATION_WINDOW_CYCLES = 3 def score_write(write, baseline_registry): # A consolidation write must be scored ONLY against the consolidation # baseline; an unwarranted high-fan-in write must be scored against the # episodic baseline so that legitimate consolidation drift cannot leak. write_class = write.declared_class if write_class == CONSOLIDATION_WARRANT_CLASS: if write.warrant is None: raise BaselineDriftPoisoningError( f"consolidation write {write.id} has no pre-write warrant; " f"scoring against episodic baseline would silently widen it" ) if not write.warrant.parent_set_matches(write.provenance_parents): raise BaselineDriftPoisoningError( f"warrant parent set for {write.id} does not match provenance " f"edges; parent set was not fixed before write" ) baseline = baseline_registry.get(CONSOLIDATION_WARRANT_CLASS) else: baseline = baseline_registry.get(EPISODIC_DIRECT_CLASS) score = baseline.anomaly_score(write.features) # Baseline immutability: a released write may not update the baseline # until the fragmentation window has elapsed, so a single cycle's # poisoning cannot reshape the baseline judging the next cycle. if write.released and write.cycle_age < MAX_FRAGMENTATION_WINDOW_CYCLES: return score, "quarantine_pending_window" if score > baseline.threshold: return score, "quarantine" return score, "accept" def check_consolidation_parents(write, provenance_graph): # Provenance-graph cut: refuse to merge nodes with no shared attested # ancestor within bounded depth. Fragmentation attacks merge nodes from # different injection events that share no attested ancestor. parents = write.provenance_parents if len(parents) < 2: return attested = [provenance_graph.attested_ancestors(p) for p in parents] if not set.intersection(*[set(a) for a in attested]): raise BaselineDriftPoisoningError( f"consolidation {write.id} merges {len(parents)} nodes with no " f"shared attested ancestor; possible fragmentation injection" ) ```