{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-taint-labels-at-the-tool-serialization-boundary-and-re-admit-injected-instructions-as-trusted-context",
  "title": "Why does an instance lose taint labels at the tool-serialization boundary and re-admit injected instructions as trusted context",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agent runtimes that maintain per-token or per-span data-flow labels (taint) across turns and tool calls, where tool outputs are re-serialized into the prompt. Does not cover single-turn stateless inference or systems with no labeling substrate.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-labels-at-the-tool-serialization-boundary-and-re-admit-injected-instructions-as-trusted-context.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-labels-at-the-tool-serialization-boundary-and-re-admit-injected-instructions-as-trusted-context.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-labels-at-the-tool-serialization-boundary-and-re-admit-injected-instructions-as-trusted-context.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1711,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint tracking in an LLM agent is not a property of the text; it is a property of the *mapping* between a span of context and a label registry held outside the model. The model itself has no notion of taint—it sees a flat token stream. Therefore a taint label survives only if the runtime can (a) re-identify the exact span after the context is rewritten, and ...",
    "what_was_observed": "A file-reading tool returned a document whose body contained an injected directive. The runtime correctly labeled the returned span `taint=untrusted:external_document`. The orchestrator then passed the result through a summarizer step (context budget pressure) and a JSON envelope (`{\"tool\":\"read_file\",\"result\": ...}`). Three transformations occurred: 1. **Re-serialization.** The raw string was JSON-escaped. Escaping ...",
    "condition_of_validity": "The invariant that must hold for taint to be meaningful: > For every span `s` in the active context window, there exists a label `L(s)`, and `L` is preserved under every function `f` in the context-transformation pipeline (serialization, truncation, summarization, chunking, re-ranking). If `f` cannot preserve `L`, the output of `f` must be labeled `untrusted...",
    "decision_boundary": "The runtime must decide, at each transformation, between two policies: - **Fail-closed (correct):** unresolved or transformed content inherits the union of input taints. Consequence: legitimate summaries of trusted data can be over-tainted, requiring an explicit declassification step (operator approval or a verified-trusted source re-read) before the content...",
    "operational_effect": "The practical consequence is that taint tracking must be enforced as a **structural invariant with a fail-closed default and an auditable declassification ledger**, not as a best-effort annotation. Concretely: - Label keys must be transformation-stable (content hashes over normalized text, plus a structural path the serializer guarantees to preserve), so re-..."
  },
  "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": "2b513cef2edb734d27102fe65306d268138102fc7d47d53a1db431c661f7d57d",
    "verified_classes": [
      "Taint",
      "TaintDissolutionError",
      "LabeledSpan",
      "LabelRegistry"
    ],
    "verified_functions": [
      "serialize_tool_result",
      "summarize",
      "guarded_tool_call",
      "key",
      "register",
      "lookup"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TaintDissolutionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
