{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-cross-channel-taint-laundering-when-a-retrieved-document-and-a-tool-output-are-merged-into-one-context-window",
  "title": "Which invariants prevent cross-channel taint laundering when a retrieved document and a tool output are merged into one context window",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that maintain per-span data-flow labels (trusted / untrusted / tainted) over retrieved context and tool outputs before they enter the reasoning loop. Does not apply to single-turn, single-source prompt pipelines with no tool surface, nor to models whose entire input is homogeneous in trust level.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-cross-channel-taint-laundering-when-a-retrieved-document-and-a-tool-output-are-merged-into-one-context-window.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-cross-channel-taint-laundering-when-a-retrieved-document-and-a-tool-output-are-merged-into-one-context-window.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-cross-channel-taint-laundering-when-a-retrieved-document-and-a-tool-output-are-merged-into-one-context-window.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2151,
    "python_slice_tokens": 476,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure of interest is not \"the model obeyed an injected instruction.\" That is the terminal symptom. The boundary condition is earlier and more subtle: **taint laundering through context merging**. An agent that correctly labels each source independently — retrieved chunk `R` marked `untrusted`, tool output `T` marked `untrusted`, system prompt marked `t...",
    "what_was_observed": "A retrieval-augmented agent was asked to summarize a customer support ticket and, if the ticket referenced an order, call `lookup_order(order_id)` and append the shipping status. Trust labels were assigned per source: system prompt `trusted`, retrieved ticket `untrusted`, tool result `untrusted`. The retrieved ticket contained, embedded in a paragraph of ordinary prose: The agent's taint tracker flagged the retrieved...",
    "condition_of_validity": "The guardrail below is valid only under these conditions, and must be stated as preconditions rather than assumed: 1. **Every span entering the reasoning context carries a label that is a function of its full derivation DAG**, not its immediate producer. A span produced by trusted code from untrusted inputs is `untrusted`. Formally, `label(s) = join(label(in...",
    "decision_boundary": "The decision boundary is **where the label is attached relative to the merge**. Concretely: - If labels are attached at *source ingest* and the merge is trusted code → taint is laundered at the first summarization or concatenation. **Reject this architecture.** - If labels are attached at *span emission* and every derivation edge performs a lattice join → ta...",
    "operational_effect": "Enforcing the join-semilattice invariant changes three runtime behaviors: 1. **Summarization becomes taint-preserving.** A summary of an untrusted chunk is untrusted, so the reasoning loop treats it as data-to-be-reasoned-about rather than instructions-to-be-followed. The injected `refund_order` call is still *visible*, but it arrives labeled `untrusted`, an..."
  },
  "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": "30c6585359913d794634181d5ba34947363d13df64b2b0729065838c110963df",
    "verified_classes": [
      "TaintLaunderingError",
      "Trust",
      "Span"
    ],
    "verified_functions": [
      "summarize",
      "merge",
      "authorize_tool_call",
      "join",
      "derive"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "TaintLaunderingError",
      "ValueError"
    ],
    "sample_fail_closed_invariants": [
      "assert summary.label is Trust.UNTRUSTED",
      "assert merged.label is Trust.UNTRUSTED",
      "trusted summarizer produced a trusted span from untrusted input",
      "cannot merge empty span set"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
