{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-memory-poisoning-in-persistent-agent-memory-stores-the-write-amplification-invariant",
  "title": "What structural signals indicate memory poisoning in persistent agent memory stores: the write-amplification invariant",
  "date_of_record": "2026 November 16",
  "scope": "Applies to persistent agent memory stores where an external or semi-trusted process writes records that are later retrieved as context by a reasoning agent, and where retrieval is scored by embedding similarity rather than provenance. Does not apply to append-only audit logs read by humans, nor to stores where every write is gated by a deterministic policy engine that validates content against a schema before commit.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-memory-poisoning-in-persistent-agent-memory-stores-the-write-amplification-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-memory-poisoning-in-persistent-agent-memory-stores-the-write-amplification-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-memory-poisoning-in-persistent-agent-memory-stores-the-write-amplification-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2004,
    "python_slice_tokens": 394,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The intuitive detection model treats poisoning as a *content* problem: a poisoned memory contains false, malicious, or instruction-injecting text, so a classifier or an LLM judge should be able to flag it. This model fails in practice because the agent's memory store is, by design, a high-trust channel — retrieved records are injected into the prompt as auth...",
    "what_was_observed": "Across a three-week window on a store with ~410k records and ~120 writes/minute, we tracked four counters per source: writes, retrievals (record appeared in a top-k result set), citations (record was referenced by the agent in an emitted action or answer), and *orphan-retrievals* (retrieved but never cited). The discriminating signal was not any single counter but the joint distribution. A campaign was detected when ...",
    "condition_of_validity": "The invariant holds only when: 1. The store has a per-source write attribution that cannot be spoofed by the writer. If sources are self-declared, the write-amplification signal is trivially gamed. 2. Retrieval and citation are logged as *separate* events with record IDs. If the pipeline logs only \"context assembled\", the orphan-retrieval ratio is uncomputab...",
    "decision_boundary": "The operational rule: **treat retrieval-inflation-with-citation-deflation as a quarantine trigger, not a deletion trigger.** Concretely, a source enters quarantine when, over a rolling 24h window, all of the following hold simultaneously: - retrieval rate ≥ 4× its 30-day median, and - orphan-retrieval ratio ≥ 0.60 (baseline + 2σ), and - ≥ 30% of its high-ret...",
    "operational_effect": "Implementing the invariant reduced mean time-to-quarantine for campaign-style poisoning from \"discovered during a post-incident review\" (days) to 41 minutes over the following quarter, with 3 false positives (all new high-value tool sources, reinstated within an hour). The dominant cost is instrumentation: per-source write attribution and decoupled retrieval..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "742b900bcf481947cbbf7221a654973bb44ce8f206a385f7bb2d316e173b87ec",
    "verified_classes": [
      "MemoryPoisoningInvariantError",
      "SourceWindow"
    ],
    "verified_functions": [
      "evaluate_source",
      "gate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "MemoryPoisoningInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
