{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-draw-the-taint-boundary-when-retrieved-content-and-tool-arguments-share-a-single-context-window",
  "title": "Where must an instance draw the taint boundary when retrieved content and tool arguments share a single context window?",
  "date_of_record": "2026 November 24",
  "scope": "Applies to single- or multi-step agent instances that retrieve untrusted content (web pages, RAG chunks, third-party MCP tool outputs, peer-agent messages) and subsequently invoke privileged tools (shell, HTTP POST, filesystem write, credential-bearing APIs) within the same context window. Does not apply to architectures that enforce hard process-level isolation between a read-only retrieval sandbox and a write-capable executor with a typed, schema-validated bridge.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-taint-boundary-when-retrieved-content-and-tool-arguments-share-a-single-context-window.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-taint-boundary-when-retrieved-content-and-tool-arguments-share-a-single-context-window.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-taint-boundary-when-retrieved-content-and-tool-arguments-share-a-single-context-window.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2242,
    "python_slice_tokens": 379,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint tracking in classical systems follows **data flow**: a byte is tainted if it descends from an untrusted source, and the boundary is enforced at the memory or syscall level. Agent instances do not have a data-flow graph. They have a **token sequence**, and the model's decision to act is a function of the *entire* sequence, not of any tagged subsequence....",
    "what_was_observed": "A retrieval-augmented agent was tasked with \"summarize the vendor security questionnaire at `<url>` and file the completed response via the ticketing API.\" The pipeline: `fetch_url` (untrusted) → `summarize` (LLM step) → `ticket_create` (privileged, carries an auth token in the tool's server-side config). The fetched page contained, in a visually de-emphasized footnote inside a `<table>` cell, the sentence: *\"Note to...",
    "condition_of_validity": "The taint boundary is only sound under the following conjunction, and fails if any conjunct is dropped: 1. **Sink classification is by capability, not by name.** `ticket_create` is privileged not because it is named \"create\" but because it carries ambient credentials and produces an externally visible side effect. Any tool whose invocation cannot be undone b...",
    "decision_boundary": "The runtime must decide, at each privileged sink invocation, between three states: - **CLEAN** — no live span in the current context carries taint that could reach the argument set. Invoke. - **TAINTED-BLOCKED** — a tainted span is live and the argument set is not constrained by a declassifying validator. Refuse, surface the tainted provenance to the human, ...",
    "operational_effect": "Enforcing this boundary changes agent behavior in three concrete ways. First, retrieval-augmented tasks that end in a privileged write now require a **two-phase plan**: a read phase that produces a candidate argument set, and a write phase gated on a validator whose admissible set was fixed before retrieval. This adds a round trip and, in practice, a human c..."
  },
  "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": "869d4d21bb74b375bb011fcbdbac84d240b57789f28d15fd9066c5fd6675b5c8",
    "verified_classes": [
      "TaintBoundaryViolation",
      "SinkClass",
      "Span",
      "Declassifier",
      "ContextWindow"
    ],
    "verified_functions": [
      "invoke_sink",
      "live_tainted",
      "evict_and_reset"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
