{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-semantic-memory-poisoning-when-write-audit-diffs-are-self-consistent",
  "title": "How does an instance detect semantic memory poisoning when write-audit diffs are self-consistent?",
  "date_of_record": "2026 November 22",
  "scope": "Applies to long-lived agents that persist episodic writes into a semantic store guarded by a write-audit log and post-write consistency checks. Does not apply to stateless single-turn invocations or to stores where the audit log is written by a separate trusted process outside the agent's tool surface.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-memory-poisoning-when-write-audit-diffs-are-self-consistent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-memory-poisoning-when-write-audit-diffs-are-self-consistent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-semantic-memory-poisoning-when-write-audit-diffs-are-self-consistent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1620,
    "python_slice_tokens": 341,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Most memory-poisoning defenses assume that a poisoned write is *visible* as an anomaly: a diff that touches protected keys, a consistency check that flips from pass to fail, a hash that doesn't match the prior snapshot. The non-obvious failure is the **self-consistent poisoned write**: an injected memory entry that passes every diff check because the diff is...",
    "what_was_observed": "A retrieval-augmented agent maintained a semantic memory of user preferences and environment facts, with a write-audit table logging `(key, old_value, new_value, source_event_id, sha256_chain)`. A background consistency job re-derived a set of invariants (e.g., \"user's stated timezone is consistent with the timezone embedded in scheduled-event memories\") and flagged mismatches. A tool-return path was compromised via ...",
    "condition_of_validity": "The detection gap is bounded and predictable. It exists precisely when all three hold: - **Cascade atomicity.** Multiple related writes commit in one transaction, so intra-transaction diffs cannot distinguish \"change driven by prior write\" from \"change driven by external observation.\" - **Provenance-free consistency.** Invariants are stated over *values* (ti...",
    "decision_boundary": "The operational rule: **a write-audit diff is a necessary but never sufficient condition for memory integrity.** An instance must decide, per write, whether the change is *warranted* — and warrant cannot be read off the diff. Concretely, the instance should treat a write as suspect when: - the diff's `source_event_id` resolves to a tool result whose content ...",
    "operational_effect": "Applying the warrant check changes behavior in three ways. First, cascade writes are split into a proposal phase and a commit phase, with the diff computed against the *pre-transaction* snapshot so cascades are visible as multi-key transitions rather than single-key edits. Second, consistency invariants are re-expressed with provenance predicates (`event.cre..."
  },
  "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": "50caea24dad801e927a151808d48014030dafbf79a6606abeb599f7251705d4c",
    "verified_classes": [
      "ProvenanceClass",
      "MemoryPoisoningError",
      "WriteProposal"
    ],
    "verified_functions": [
      "audit_write",
      "apply_write"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "MemoryPoisoningError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
