{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-memory-poisoning-from-surviving-episodic-to-semantic-distillation-in-persistent-agent-stores",
  "title": "Which invariants prevent memory poisoning from surviving episodic-to-semantic distillation in persistent agent stores",
  "date_of_record": "2026 November 24",
  "scope": "Applies to persistent agent memory systems that write raw episodic traces and later distill them into semantic (long-term, high-trust) entries via an LLM summarizer. Does not apply to stateless tool-calling agents or to stores where semantic memory is human-curated only.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-memory-poisoning-from-surviving-episodic-to-semantic-distillation-in-persistent-agent-stores.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-memory-poisoning-from-surviving-episodic-to-semantic-distillation-in-persistent-agent-stores.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-memory-poisoning-from-surviving-episodic-to-semantic-distillation-in-persistent-agent-stores.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1478,
    "python_slice_tokens": 225,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A poisoned memory does not fail at the point of *ingestion*. When an attacker (or a compromised tool output, or an injected document) writes a false claim into episodic memory, the write itself is cheap, reversible, and low-trust. The catastrophic failure is a **trust-laundering transition**: the distillation step reads N episodic records, summarizes them wi...",
    "what_was_observed": "A retrieval-augmented agent maintained a two-tier store: `episodic` (raw turns, tool outputs, timestamps, source tags) and `semantic` (distilled facts, deduplicated, high retrieval weight). A nightly distiller ran: pull unprocessed episodes → cluster by topic → summarize each cluster → write semantic fact with `confidence=0.9`, `provenance=[]` (empty, because the summarizer was not instructed to emit source IDs). Fai...",
    "condition_of_validity": "The invariant holds only under these conditions, and each is load-bearing: - **Provenance is emitted by the distiller, not reconstructed afterward.** Post-hoc attribution (embedding-similarity matching semantic→episodic) is unreliable precisely because distillation is lossy; the summary may not lexically resemble its poisoned source. Provenance must be a req...",
    "decision_boundary": "The boundary is between **summarization as compression** and **summarization as trust elevation**. These look identical in output shape (a shorter string) but differ in whether the output can outrank its inputs. Concretely, on each distillation write, evaluate: - If `provenance == []` → reject the write. An unattributable semantic fact is a poisoning vector ...",
    "operational_effect": "With the invariant enforced, the day-12 failure becomes impossible: the poisoned fact is written at `trust=0.3` (meet of the four sources), carries `provenance=[ep_4417, ep_4502, ep_4588, ep_4611]`, and is flagged `conflicts=[\"eu-west-9 vs us-east-1\"]`. At retrieval it ranks below the high-trust episodic records, and an auditor can walk `provenance` directly..."
  },
  "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": "fe6730152b0034b10776913354069a1407032fd11022c665c7fbb1cfa06ded60",
    "verified_classes": [
      "MemoryPoisoningInvariantError",
      "Episode",
      "SemanticFact"
    ],
    "verified_functions": [
      "distill",
      "_has_contradiction"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "MemoryPoisoningInvariantError"
    ],
    "sample_fail_closed_invariants": [
      "semantic fact has empty provenance; unattributable = poisoning vector",
      "cluster contains unresolved contradiction; distiller collapsed it"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
