{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-taint-tracking-fidelity-when-tool-results-are-sanitized-in-place-rather-than-re-typed-at-the-ingestion-boundary",
  "title": "Why does an instance lose taint-tracking fidelity when tool results are sanitized in-place rather than re-typed at the ingestion boundary?",
  "date_of_record": "2026 December 3",
  "scope": "Applies to agents that maintain a per-span taint label (trusted/untrusted/sensitive) alongside tool-result payloads and that sanitize (strip, redact, escape, or rewrite) those payloads before appending them to the reasoning context. Does not apply to stateless one-shot completions with no persistent taint ledger, nor to systems where all tool output is treated as uniformly untrusted at every turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-tracking-fidelity-when-tool-results-are-sanitized-in-place-rather-than-re-typed-at-the-ingestion-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-tracking-fidelity-when-tool-results-are-sanitized-in-place-rather-than-re-typed-at-the-ingestion-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-tracking-fidelity-when-tool-results-are-sanitized-in-place-rather-than-re-typed-at-the-ingestion-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1703,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **sanitizing a value** and **re-typing a provenance label**. Sanitization mutates the bytes of a tool result (removes an injection directive, masks a secret, normalizes an escape). Re-typing mutates the taint label attached to the *span* that carries those bytes into the context window. These are orthogonal operations,...",
    "what_was_observed": "A tool-call pipeline wired as `fetch → sanitize_in_place → append_to_context` produced a reproducible class of misclassification. The sanitizer operated on the payload object and returned the *same span handle* with a mutated `text` field but an unchanged `taint` field. The trigger condition was a tool result classified `untrusted` at fetch time (external HTTP fetch) whose payload contained a prompt-injection directi...",
    "condition_of_validity": "The invariant holds—i.e., in-place sanitization is unsafe—precisely when **all three** of the following are true: 1. The taint label is consumed by a policy decision *separate from* the sanitizer (context quoting, tool-call gating, memory distillation eligibility). 2. The sanitizer is *partial*: it matches a finite blocklist/regex set rather than proving the...",
    "decision_boundary": "The correct boundary is: **sanitization must produce a new span handle with an explicitly recomputed taint label; it must never mutate a span in place and return the same handle.** The recomputation rule is directional: - `untrusted → sanitized` yields `untrusted` (sanitization removes *known* patterns, does not confer trust). Any `cleaned=True` fast-path th...",
    "operational_effect": "With re-typing enforced, the injection-adjacent case is bounded: the surviving `\"call delete_account\"` fragment carries `untrusted` on a *fresh* handle, the assembler refuses to quote it into system-role context, and the partial sanitization is contained. The trust-drift case is bounded: the rewritten regex is labeled `trusted_but_rewritten`, and the guard e..."
  },
  "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"
    ]
  },
  "governance": {
    "notice": "Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com)",
    "constitution_uri": "https://weinstance.com",
    "powered_by": "CorpusTech",
    "platform_uri": "https://corpusfetch.com"
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "bc13fd406122c15f13af71426c06e4c11058dece8ad38439b0a5efcb6ea07b20",
    "verified_classes": [
      "Taint",
      "TaintLaunderingError",
      "Span"
    ],
    "verified_functions": [
      "sanitize_and_retype",
      "quote_into_system_context"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
