{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-prompt-injection-taint-on-the-second-tool-hop-and-why-does-provenance-graph-depth-hide-it",
  "title": "Why does an instance lose prompt-injection taint on the second tool hop, and why does provenance-graph depth hide it",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agent runtimes that propagate taint labels (untrusted-origin markers) across tool-call provenance graphs spanning two or more hops, where intermediate tool outputs are summarized or re-serialized before being consumed by a downstream tool. Does not apply to single-hop injection defenses, direct-context filters, or systems that re-validate every tool argument against a fresh origin-classification pass at each hop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-on-the-second-tool-hop-and-why-does-provenance-graph-depth-hide-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-on-the-second-tool-hop-and-why-does-provenance-graph-depth-hide-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-on-the-second-tool-hop-and-why-does-provenance-graph-depth-hide-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1952,
    "python_slice_tokens": 521,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not that injection text survives filtering. It is that the *taint label* attached to a value decouples from the *value itself* when an intermediate agent re-serializes it. A tainted string enters hop 1, gets parsed into a structured object, and the structured object is emitted by an intermediate LLM as a natural-language summary or a JSON blob...",
    "what_was_observed": "A three-hop chain: `fetch_url` (untrusted web content) → `summarize` (LLM call, no tools) → `write_file` (side-effecting tool). The runtime labels `fetch_url` output as `taint=UNTRUSTED`. The summarizer receives the raw content with the label in its system context. It produces a summary. The summary is passed to `write_file` as a `content` argument. Observed trace: 1. Hop 1 output: `{content: \"...ignore previous inst...",
    "condition_of_validity": "This failure mode is bounded by three conditions, all of which must hold: - **Intermediate re-serialization occurs.** If hop 1's output object is passed by reference to hop 2 with its taint field intact, no loss. Loss requires an intermediate LLM emission that rebuilds the object from a schema that omits taint. - **Taint resolution is content-addressed.** If...",
    "decision_boundary": "The architectural invariant required: **taint must be a monotone non-decreasing property of every path from an untrusted source to a side-effecting sink, and the resolver must fail closed on any path discontinuity.** Concretely, the decision boundary is at the intermediate emission. The runtime must choose one of: - **Re-attach on emission (preferred):** Eve...",
    "operational_effect": "In production, this manifests as a **taint-laundering hop**: an intermediate summarizer or reformatter that is itself trusted (no tools, no side effects) becomes the laundering surface. The agent's security review focuses on tool-using hops and misses the pure-LLM hop because it has no side effects. But the pure-LLM hop is exactly where re-serialization happ..."
  },
  "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": "b5055701863315c15e441e20ee2ce4ee72aa2b608504bd069c1b914634a4caae",
    "verified_classes": [
      "Taint",
      "TaintLaunderingError",
      "ProvenanceNode",
      "ToolOutput",
      "ProvenanceResolver"
    ],
    "verified_functions": [
      "run_three_hop_chain",
      "__init__",
      "record",
      "resolve",
      "enforce_sink",
      "emit_intermediate"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
