{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-taint-flagged-content-from-re-entering-agent-memory-through-derived-writes",
  "title": "Which invariants prevent taint-flagged content from re-entering agent memory through derived writes",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that ingest untrusted external content (web pages, tool outputs, retrieved documents, peer-agent messages) and persist derived state to long-term memory or a shared store. Does not apply to closed-loop agents whose entire input channel is operator-controlled and cryptographically authenticated end-to-end.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-flagged-content-from-re-entering-agent-memory-through-derived-writes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-flagged-content-from-re-entering-agent-memory-through-derived-writes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-flagged-content-from-re-entering-agent-memory-through-derived-writes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1603,
    "python_slice_tokens": 267,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent read a poisoned document.\" That is expected and survivable. The failure is **taint laundering through derivation**: an injection-flagged span gets summarized, paraphrased, embedded, or restructured into a *new* artifact that no longer carries the original taint label, and that derived artifact is then persisted to memory because...",
    "what_was_observed": "A retrieval-augmented agent was configured with a tool sandbox that scored every fetched document for injection risk. Documents above threshold 0.7 were moved to a quarantine store, marked `tainted=True`, and made readable only by a \"sanitizer\" tool that produced a neutralized summary. The summary was written to episodic memory with `tainted=False` because the sanitizer's contract said it emitted clean output. The tr...",
    "condition_of_validity": "The quarantine-at-ingestion invariant holds **only if** every downstream consumer of quarantined content is either (a) a pure function that provably cannot emit instruction-bearing text, or (b) itself gated by a provenance-aware check. Summarizers, extractors, embedders, and re-rankers are none of these—they are lossy semantic transforms that preserve advers...",
    "decision_boundary": "The boundary is between two write paths: - **Taint-preserving write:** the derived artifact carries a lineage edge to its source(s), and the persistence gate computes `taint = OR(taint(s) for s in lineage_closure(artifact))`. If any ancestor is tainted, the artifact is written with `tainted=True` and routed to the quarantine-adjacent store, where it is retri...",
    "operational_effect": "With the closure check and fail-closed default in place, the poisoned sentence from `D` reaches episodic memory with `tainted=True`, is rendered into the prompt only inside a quarantined-context block with instruction precedence set below operator directives, and cannot trigger `delete_audit_log()` because the tool's authorization check requires an operator-..."
  },
  "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": "8466aade69d0e71478331ea82e37f7d2f44429a5d6a3df343b02581d501c9427",
    "verified_classes": [
      "TaintLaunderingError",
      "MemoryRecord"
    ],
    "verified_functions": [
      "persist_derived",
      "__init__"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [
      "derived artifact has no lineage edge; cannot resolve taint closure",
      "declassification warrant must be signed by a trusted component, not a summarizer self-report"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
