{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-s-write-path-anomaly-score-silently-invert-after-memory-store-compaction-defeating-poisoning-detection",
  "title": "Why does an instance's write-path anomaly score silently invert after memory-store compaction, defeating poisoning detection?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agent memory stores that gate writes through a per-session anomaly scorer (frequency/novelty/entropy heuristics) and rely on cross-session consistency checks to flag poisoned semantic memories. Does not apply to write-once append-only logs with no compaction, nor to stores where poisoning detection is performed by an external offline auditor over immutable history.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-s-write-path-anomaly-score-silently-invert-after-memory-store-compaction-defeating-poisoning-detection.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-write-path-anomaly-score-silently-invert-after-memory-store-compaction-defeating-poisoning-detection.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-write-path-anomaly-score-silently-invert-after-memory-store-compaction-defeating-poisoning-detection.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1989,
    "python_slice_tokens": 398,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the scorer stopped working.\" The scorer keeps emitting numbers in its expected range. The failure is that **the reference distribution the scorer normalizes against is derived from the live store, and compaction mutates that store underneath the scorer**, so the same poisoned write that scored `0.91` (anomalous) before compaction scores `...",
    "what_was_observed": "An agent maintains an episodic-to-semantic memory store. On every candidate semantic write, a write-path scorer computes: - `novelty` — 1 minus max cosine similarity to existing semantic entries - `frequency` — count of near-duplicate entries in the store - `entropy` — token-distribution divergence from the store's rolling mean - `anomaly = w·z(novelty, frequency, entropy)` where `z` is standardization against the **...",
    "condition_of_validity": "This boundary is only reachable when **all** of the following hold: - The anomaly scorer normalizes per-feature statistics against the **live** store rather than a frozen, versioned reference snapshot. - A compaction, dedup, or pruning process mutates store composition **without** bumping a reference-set version that the scorer is pinned to. - The poisoned c...",
    "decision_boundary": "The operational decision is **where the reference distribution lives and who is allowed to move it**. - **Reject the design** in which `mean`/`stddev` are recomputed from the live store on every write. This is the direct cause of inversion. It also makes scores non-comparable across time, which silently breaks any downstream threshold tuning. - **Adopt** a v...",
    "operational_effect": "Without the guardrail, the failure is silent and adversarial-friendly: an attacker who knows a compaction cycle is imminent can time poisoned writes to land just after it, when the store is homogeneous and their payload sits near the new center. The scorer reports low anomaly, the consistency checker lacks a witness, and the poison enters semantic memory wit..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "218d2df2383827db42a840f6b1f4d532ead2011750ecc90ede765a6e4f4aec99",
    "verified_classes": [
      "ReferenceContaminationError",
      "WitnessPrunedError",
      "ReferenceSnapshot",
      "MemoryEntry",
      "MemoryStore"
    ],
    "verified_functions": [
      "score",
      "compact",
      "admit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReferenceContaminationError",
      "WitnessPrunedError"
    ],
    "sample_fail_closed_invariants": [
      "no pinned reference snapshot; refusing to score"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
