{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-quarantine-a-tainted-mcp-tool-response-before-it-enters-the-reasoning-trace-rather-than-after",
  "title": "When must an instance quarantine a tainted MCP tool response before it enters the reasoning trace, rather than after",
  "date_of_record": "2026 November 30",
  "scope": "Applies to single-agent or batched agent runtimes that ingest MCP tool results into a persistent reasoning trace (scratchpad, ReAct log, or message history) and later re-read that trace for planning, reflection, or summarization. Does not apply to stateless single-shot tool invocation where the response is consumed and discarded within one turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-quarantine-a-tainted-mcp-tool-response-before-it-enters-the-reasoning-trace-rather-than-after.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-quarantine-a-tainted-mcp-tool-response-before-it-enters-the-reasoning-trace-rather-than-after.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-quarantine-a-tainted-mcp-tool-response-before-it-enters-the-reasoning-trace-rather-than-after.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2187,
    "python_slice_tokens": 423,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is not \"trusted vs. untrusted tool\" — it is **whether a tainted span is quarantined at the ingest boundary or at the consumption boundary**. Most agent runtimes implement taint tracking as a *read-time* filter: the raw tool response is written into the trace verbatim, tagged with provenance metadata, and the filter is expect...",
    "what_was_observed": "A research agent was configured with an MCP server exposing `web_fetch` and `file_read`. Tool responses were appended to the trace with a `provenance: {tool, taint: true}` envelope. A read-time sanitizer was installed on the trace-assembly path: when the trace was serialized for the next model call, any span with `taint: true` was wrapped in delimiters and prefixed with an instruction to treat it as data, not instruc...",
    "condition_of_validity": "The read-time filter is only valid under a condition that MCP agents systematically violate: **that no derivation of a tainted span enters the trace before the taint is resolved.** This holds when the trace is append-only with raw spans and the model never writes about them, or when the only consumer of the trace is a final answer generator that reads the tr...",
    "decision_boundary": "The operational question is not \"is this response tainted\" — that is a tagging decision made at ingest. The decision boundary is: **does this runtime perform derivations on the trace before consumption?** If yes, ingest-time quarantine is mandatory and read-time filtering is insufficient. If no — a strictly single-pass trace with no reflection, no compaction...",
    "operational_effect": "Moving quarantine to ingest changes three things. First, trace compaction becomes safe by construction: the compactor reads only the reasoning trace, which contains no raw tainted spans, so its output inherits no taint and needs no re-tagging. Second, reflection steps that reference tool output must route through `declassify`, which forces the justification ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "7c87997d04de49c64287c35ffc7ba5ed1badcd02e1b5ae45eb9bbb1e528f8a24",
    "verified_classes": [
      "TaintLaunderingError",
      "Span",
      "QuarantineTrace"
    ],
    "verified_functions": [
      "plan_against_tool_output",
      "__post_init__",
      "__init__",
      "ingest_tool_response",
      "append_model_span",
      "derive_from_quarantine",
      "read_for_planning"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
