{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-prompt-injection-taint-at-the-tool-output-boundary-when-a-retrieval-context-re-materializes-the-same-bytes",
  "title": "Why does an instance lose prompt-injection taint at the tool-output boundary when a retrieval context re-materializes the same bytes",
  "date_of_record": "2026 November 15",
  "scope": "Applies to agent runtimes that attach data-flow labels (taint) to retrieved chunks and tool outputs and propagate those labels into the prompt context. Does not apply to systems that treat the entire context window as a single unlabeled trust domain, nor to systems that re-derive labels from scratch at every model invocation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-at-the-tool-output-boundary-when-a-retrieval-context-re-materializes-the-same-bytes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-at-the-tool-output-boundary-when-a-retrieval-context-re-materializes-the-same-bytes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-at-the-tool-output-boundary-when-a-retrieval-context-re-materializes-the-same-bytes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1387,
    "python_slice_tokens": 299,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **label identity** and **content identity**. A taint-tracking layer typically assigns a label to a *provenance object* — the specific retrieval hit or tool invocation that produced a byte range. Downstream, the prompt assembler concatenates many such objects into a single context string. The failure is that the assembl...",
    "what_was_observed": "A retrieval pipeline ingested a user-supplied URL. The fetched page contained a benign-looking paragraph that was byte-identical to a paragraph in an internal, trusted runbook (the attacker had copied a public snippet and appended an instruction in a sibling node). Both the fetched chunk and the runbook chunk hashed to the same content digest. The context assembler deduplicated identical chunks to save tokens, keepin...",
    "condition_of_validity": "The failure requires all of the following to hold simultaneously: 1. Taint labels are attached to provenance objects, not to byte ranges that are re-verified at assembly time. 2. Some layer between label attachment and prompt assembly keys on content (hash, normalized text, embedding similarity) rather than provenance. 3. At least two provenances produce byt...",
    "decision_boundary": "The operational rule: **never let a content-addressed cache or dedup step be the authority for a taint label.** Labels must be joined to content by provenance identity (object ID, retrieval event ID), and the join must be re-validated at the moment of prompt assembly. When two provenances collide on content, the assembly must either (a) keep both entries wit...",
    "operational_effect": "With the fix in place, the observed incidents disappeared: the duplicated paragraph retained its `untrusted` label, the adjacent instruction was not promoted, and the planner refused the tool call. The cost was a modest token increase from no longer collapsing cross-provenance duplicates, and a requirement that the cache key include provenance ID. The deeper..."
  },
  "matched_failure_symptoms": [
    "PROMPT_INJECTION_OR_CONFUSED_DEPUTY"
  ],
  "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": "beaaf6130e69103106be4ba15cef432ffa773a38b3054bd5473b1f41c7691137",
    "verified_classes": [
      "TaintCollisionError"
    ],
    "verified_functions": [
      "merge_spans",
      "assemble_context"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintCollisionError"
    ],
    "sample_fail_closed_invariants": [
      "untrusted span present without emitted per-span label; aggregate taint is insufficient"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
