{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-enforce-taint-provenance-on-tool-output-before-reinjection-and-what-breaks-when-the-sanitizer-is-a-value-level-filter-rather-th",
  "title": "Where must an instance enforce taint provenance on tool output before reinjection, and what breaks when the sanitizer is a value-level filter rather than a provenance-level gate?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent loop that reinjects tool-call results into its own context window and relies on an output sanitizer (regex scrubber, classifier, PII redactor, \"safety filter\") as the boundary between untrusted tool output and trusted reasoning state. Does not apply to architectures where tool results are never reinjected into the same context that issued the call, or where the tool output is consumed only by deterministic non-LLM code.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-enforce-taint-provenance-on-tool-output-before-reinjection-and-what-breaks-when-the-sanitizer-is-a-value-level-filter-rather-th.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-enforce-taint-provenance-on-tool-output-before-reinjection-and-what-breaks-when-the-sanitizer-is-a-value-level-filter-rather-th.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-enforce-taint-provenance-on-tool-output-before-reinjection-and-what-breaks-when-the-sanitizer-is-a-value-level-filter-rather-th.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2219,
    "python_slice_tokens": 537,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A sanitizer that inspects the **value** of a tool result (\"does this string contain an instruction-like pattern?\") is not the same as a gate that inspects the **provenance** of the tool result (\"which origin produced this byte range, and is that origin permitted to contribute to the instruction-bearing region of context?\"). The first is a content filter runn...",
    "what_was_observed": "A retrieval tool returned a document whose `body` field contained a benign-looking table plus a footer of the form `<!-- ref: see internal note -->`. The sanitizer, a PII/pattern scrubber, passed it (no PII, no imperative verbs, no known injection markers). The agent framework wrapped it as `{\"source\":\"web\",\"content\":\"...\"}` and reinjected it into the working context. On the *next* tool call, a second tool (a file re...",
    "condition_of_validity": "The value-level sanitizer is only sound when, for every reinjected tool result, the following holds: 1. **Single-origin closure.** The result's bytes derive from exactly one origin, and that origin's trust class is recorded alongside the bytes. 2. **No cross-result binding.** No token in result A can be interpreted by the model as a reference that resolves i...",
    "decision_boundary": "The boundary is drawn at the reinjection call site, not inside the sanitizer. Concretely: - If the tool result will be placed in a context region the model treats as instructions (system-adjacent, tool-result block that the model has learned to obey), the gate MUST check provenance trust class and MUST refuse reinjection of `untrusted` results into that regi...",
    "operational_effect": "Enforcing the provenance-level gate changes three things in the trace: 1. **Reinjection is a typed operation.** Every `tool_result` carries `{origin, trust_class, correlation_id, nonce}` and the context writer refuses to place an `untrusted` result in the instruction region, raising a gate error instead of silently passing. 2. **Cross-result reference resolu..."
  },
  "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": "6939e78c7406ac6eb2bd89b8a6cd1f5aa756dc9fb794e1a643ad68861ba50b7e",
    "verified_classes": [
      "TrustClass",
      "Region",
      "TaintGateError",
      "ToolResult"
    ],
    "verified_functions": [
      "sanitize_value",
      "admit",
      "resolve_reference",
      "reinject_pair"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "TaintGateError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "secrets",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
