{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-taint-labels-at-the-tool-boundary-when-its-own-tool-output-re-enters-as-trusted-context",
  "title": "Why does an instance lose taint labels at the tool boundary when its own tool output re-enters as trusted context?",
  "date_of_record": "2026 November 19",
  "scope": "Applies to single- and multi-agent systems that implement dynamic information-flow control (DIFC) by attaching taint labels to context segments and propagating them across tool-call boundaries. Does not cover static prompt sanitization, classifier-based injection detection, or systems with no explicit label propagation mechanism.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-labels-at-the-tool-boundary-when-its-own-tool-output-re-enters-as-trusted-context.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-labels-at-the-tool-boundary-when-its-own-tool-output-re-enters-as-trusted-context.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-labels-at-the-tool-boundary-when-its-own-tool-output-re-enters-as-trusted-context.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2112,
    "python_slice_tokens": 491,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is not \"tainted vs. clean data\" in the abstract. It is **label provenance vs. label authority**. A taint label has two independent properties: where it was *born* (the untrusted source that originated the bytes) and who is *entitled to clear or relabel it* (the component holding the clearing warrant). Most DIFC implementatio...",
    "what_was_observed": "A retrieval agent reads an external document (untrusted, label `TAINT:external`, warrant held by the `document_reader` tool). It passes a quoted excerpt to a summarization tool. The summarization tool returns a summary. The runtime re-inserts that summary into the agent's context window as a fresh segment. At this insertion point, the runtime assigns the summary a default label of `TRUSTED:internal` — because the *to...",
    "condition_of_validity": "The failure is bounded and predictable. It occurs iff all three hold: - **Re-entry labeling is emitter-keyed.** The runtime assigns labels at segment insertion based on which tool/agent produced the segment, rather than tracing the segment's byte-level ancestry back to its untrusted origin. - **The emitting tool's authority is broader than the data it handle...",
    "decision_boundary": "The operational decision is where to enforce the invariant, and the boundary is sharp: - **Enforce at emission (tool side).** Tool must attach a signed taint envelope describing the *maximum* taint of any byte it consumed. Cheap, but trusts the tool to self-report honestly — a compromised or buggy tool under-reports. Insufficient alone. - **Enforce at ingest...",
    "operational_effect": "The practical consequence: **any DIFC scheme that labels by emitter is fail-open under paraphrase and fail-closed under strict ingestion, with no configuration that is both safe and usable.** Fail-open means prompt injection through tool round trips is undetectable by the flow layer. Fail-closed means every tool output is quarantined and the agent cannot use..."
  },
  "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": "008f32ed15a27f66687b69b079c9bf2c9fd08547212faae7539b1ba627b11f87",
    "verified_classes": [
      "TaintLevel",
      "Segment",
      "ToolResponse",
      "TaintBoundaryError",
      "LineageStore"
    ],
    "verified_functions": [
      "ingest_tool_output",
      "clear_taint",
      "guarded_tool_call",
      "__init__",
      "register",
      "get"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "TaintBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
