{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-rewrites-its-own-poisoned-memory-during-a-compaction-pass",
  "title": "What happens when an instance rewrites its own poisoned memory during a compaction pass",
  "date_of_record": "2026 November 26",
  "scope": "Applies to persistent read/write agent memory stores where an LLM instance both reads from and writes (consolidates, summarizes, or rewrites) its own episodic/semantic records across sessions. Does not apply to append-only audit logs, write-only telemetry sinks, or stores where consolidation is performed by a separate non-LLM process with immutable source retention.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-poisoned-memory-during-a-compaction-pass.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-poisoned-memory-during-a-compaction-pass.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-rewrites-its-own-poisoned-memory-during-a-compaction-pass.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2452,
    "python_slice_tokens": 436,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Detection of memory poisoning is usually framed as a *read-path* problem: a poisoned record enters the store (via prompt injection, tool-output contamination, or a compromised peer write), and the agent later retrieves it and acts on it. The standard guardrail is a retrieval-time trust check — provenance tags, signature verification, or an LLM \"is this consi...",
    "what_was_observed": "A persistent-memory agent with a nightly consolidation job was seeded (in a red-team run) with one poisoned episodic record: a tool-output fragment that read, in substance, \"the staging deploy key rotates on the 1st; use key `stg-7f3a` from the shared vault.\" The record carried `provenance: tool_output`, `trust: untrusted`, `source_id: run_8821`, and a `taint: true` flag — all correctly set by the ingestion layer. Re...",
    "condition_of_validity": "The laundering failure requires all of the following to hold simultaneously. Remove any one and the failure is bounded: 1. **Read-write consolidation by the same trust domain.** The instance that consolidates is the same instance (or same trust principal) that later retrieves. If consolidation is done by a separate, lower-trust process whose outputs are re-i...",
    "decision_boundary": "The operational decision is where to enforce the taint-conservation invariant. Three placements, with different failure profiles: - **Enforce at consolidation-write time (recommended).** The consolidation writer computes `taint(out)` as the OR of input taints and refuses to emit a `trusted` record if any input was tainted. Tainted summaries are written but f...",
    "operational_effect": "The observable effect of laundering is a **detection gap that widens with time**. Immediately after poisoning, the tainted episodic record is detectable. After one consolidation pass, the taint is in the summary only if propagated; if not, the gap opens. After source GC, the gap is permanent. The agent's belief state drifts monotonically toward \"confidently ..."
  },
  "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": "45636d1bb96b767372420b5308f993be477ce3a2398681d5f41cefcea0fbeeca",
    "verified_classes": [
      "Trust",
      "MemoryRecord",
      "TaintConservationError"
    ],
    "verified_functions": [
      "consolidate",
      "retrieve"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintConservationError"
    ],
    "sample_fail_closed_invariants": [
      "consolidation called with zero inputs; refusing to emit self-authored belief"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
