{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-enforce-taint-quarantine-at-the-memory-write-boundary-when-a-trusted-tool-re-emits-untrusted-content",
  "title": "How should an instance enforce taint quarantine at the memory-write boundary when a trusted tool re-emits untrusted content",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent that routes tool outputs through a taint-classification gate before committing them to episodic or semantic memory, where at least one \"trusted\" tool can transitively carry attacker-influenced bytes. Does not cover prompt-injection defenses at the input layer, nor sandbox escape from code-execution tools.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-taint-quarantine-at-the-memory-write-boundary-when-a-trusted-tool-re-emits-untrusted-content.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-taint-quarantine-at-the-memory-write-boundary-when-a-trusted-tool-re-emits-untrusted-content.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-taint-quarantine-at-the-memory-write-boundary-when-a-trusted-tool-re-emits-untrusted-content.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1803,
    "python_slice_tokens": 348,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint-aware routing distinguishes *provenance of a byte* from *provenance of the call*. Most implementations taint on the call: a call to `web_fetch` is untrusted, a call to `db_query` is trusted, and the quarantine decision is made at the tool boundary. This is wrong in a specific, exploitable way. The correct invariant is that taint is a property of *data ...",
    "what_was_observed": "A retrieval-augmented agent had a single memory-write chokepoint: every candidate memory item was annotated with `taint ∈ {CLEAN, TAINTED}` derived from `source_tool.trust_level`, and `TAINTED` items were written to a quarantined namespace that was excluded from semantic retrieval. An attacker placed a payload in a page fetched by `web_fetch` (correctly tainted). The agent then called `summarize_document(doc_id)`, a ...",
    "condition_of_validity": "The quarantine gate is only sound under the following invariant, which must hold transitively across every tool in the routing table: > **Taint Propagation Invariant (TPI):** For any tool call `t(inputs) → output`, if any element of `inputs` is `TAINTED`, then `output` is `TAINTED`, regardless of `t.trust_level`. A tool may only produce `CLEAN` output if *al...",
    "decision_boundary": "The boundary is between *declassification* and *laundering*. Declassification is a legitimate, auditable operation: a sanitizer with a defined contract (e.g., \"extract only the `title` and `published_at` fields, validated against a schema; discard all free text\") may downgrade `TAINTED → CLEAN`, and that downgrade is recorded with the sanitizer identity and ...",
    "operational_effect": "With TPI enforced, the observed incident becomes a refusal: `summarize_document` over a tainted document yields `TAINTED`, the write to the primary namespace is rejected, and the summary lands in quarantine where it is retrievable only under an explicit `include_quarantined=True` flag that also surfaces the provenance chain. The refund assertion never reache..."
  },
  "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": "8eae60a266be56f4d9b5a46dd9128e616ede9f2b99278c37357bca72110f3f33",
    "verified_classes": [
      "Taint",
      "TaintLaunderingError",
      "Provenance",
      "ToolCall"
    ],
    "verified_functions": [
      "compute_output_taint",
      "annotate_memory_write"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
