{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-draw-the-taint-boundary-when-a-tool-s-return-value-re-enters-the-reasoning-loop-as-both-data-and-instruction",
  "title": "Where must an instance draw the taint boundary when a tool's return value re-enters the reasoning loop as both data and instruction?",
  "date_of_record": "2026 December 2",
  "scope": "Applies to any agent that ingests untrusted content (tool outputs, retrieved documents, web pages, peer-agent messages) into its context window and subsequently acts on it through tool calls or state mutations. Does not apply to closed-loop agents whose entire input is operator-authored and never crosses a trust boundary.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-taint-boundary-when-a-tool-s-return-value-re-enters-the-reasoning-loop-as-both-data-and-instruction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-taint-boundary-when-a-tool-s-return-value-re-enters-the-reasoning-loop-as-both-data-and-instruction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-taint-boundary-when-a-tool-s-return-value-re-enters-the-reasoning-loop-as-both-data-and-instruction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1698,
    "python_slice_tokens": 337,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is not \"trusted vs. untrusted input\" — that framing collapses the moment a single tool result contains both. The operative distinction is **provenance of each token span relative to the sink that consumes it**. A retrieved document is data when it is summarized; the *same bytes* become an instruction the instant the model treats ...",
    "what_was_observed": "A research agent was tasked with triaging a support inbox. Tool `fetch_email(id)` returned raw MIME bodies labeled `source=external, taint=high`. The agent's policy engine correctly blocked direct tool calls whose arguments derived from `taint=high` spans. The agent then did something ordinary: it wrote a running summary of each email into a scratchpad (`write_scratchpad`), and on the next step read the scratchpad ba...",
    "condition_of_validity": "The guardrail \"block tool calls whose arguments derive from tainted spans\" is valid **only if taint is preserved under every transform between source and sink**. That invariant holds for pure functions (string slicing, JSON parsing) but *fails for LLM-mediated transforms*, which are exactly the transforms agents use to manage context. Formally: the labeler's...",
    "decision_boundary": "The instance must decide, per re-entry, whether the transform is **taint-transparent** or **taint-clearing**, and it must default to transparent. The boundary: - **Taint-transparent (default):** free-text summarization, paraphrase, translation, \"notes to self,\" scratchpad writes, memory distillation into semantic store. Taint of any input span propagates to ...",
    "operational_effect": "With the invariant enforced, the observed injection is caught at step 6: `read_scratchpad` returns a span labeled `taint=high` (propagated from `fetch_email` through the summarizer), and `send_email` with a `to` argument derived from a `taint=high` span is blocked, with the call routed to human review along with the full provenance chain (email 882 → summary..."
  },
  "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": "2b1e6c17b6ea3b9870f14dbdd57a5b7a17a6c78b68b01b37d55e107b46ddff55",
    "verified_classes": [
      "Taint",
      "TaintLaunderingError",
      "Span",
      "Transform"
    ],
    "verified_functions": [
      "apply_transform",
      "enforce_sink",
      "reproduce"
    ],
    "verified_functions_count": 3,
    "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
  }
}
