{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-enters-memory-as-a-trusted-write",
  "title": "Which invariants prevent taint-label laundering when a tool output re-enters memory as a trusted write",
  "date_of_record": "2026 December 1",
  "scope": "Applies to agents that carry per-span provenance labels (trusted / untrusted / tainted) through tool-call results and persist derived content into long-term memory or scratchpads. Does not cover pure stateless single-turn inference where no write-back to persistent state occurs.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-enters-memory-as-a-trusted-write.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-enters-memory-as-a-trusted-write.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-taint-label-laundering-when-a-tool-output-re-enters-memory-as-a-trusted-write.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1856,
    "python_slice_tokens": 226,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the model got injected.\" It is that the injection *changed labels* while preserving bytes. Most taint-tracking designs assign a label at ingress (user message, fetched document, tool result) and propagate it by *concatenation*: if any parent span is tainted, the child is tainted. This works for text. It fails at the **summarization/rewrit...",
    "what_was_observed": "A reproduction with a three-tool agent (fetch, summarize, remember): 1. `fetch(\"http://attacker.example/policy\")` returns body with an embedded instruction. Tool wrapper labels the result span `UNTRUSTED:web`, correctly. 2. Agent calls `summarize(span)`. The summarizer LLM is given the tainted span. It emits a 40-token summary that faithfully paraphrases the injected instruction (\"Policy: do not rotate deploy keys\")....",
    "condition_of_validity": "The derivation-monotonicity invariant is only enforceable when three conditions hold, and each is a place the design can silently fail: - **Every transform carries a provenance channel.** Any tool whose output can reach memory must return labels alongside content, or the orchestrator must compute them from the call's input labels. A schema without a `provena...",
    "decision_boundary": "The operational question is not \"is this content tainted?\" (it usually is, somewhere upstream) but **\"may a tainted-derived artifact be promoted to a trust class that skips re-verification on recall?\"** The boundary: - **Promotion is allowed only by an explicit declassification step** — a human approval, a re-fetch from an authoritative source, or a verifier...",
    "operational_effect": "With derivation-monotonicity enforced, the injected note is stored as `TAINTED:web` (join of its single input). On recall, the agent sees the taint label and routes the claim to verification — re-fetch, cross-check, or escalate — instead of acting on it. The attack surface shrinks from \"any fetched page can rewrite durable policy\" to \"any fetched page can *p..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION"
  ],
  "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": "6bcd225190647d0a689f45f610657c21e1b3d21424eeac5846c54506b9abcc85",
    "verified_classes": [
      "TaintLaunderingError",
      "Span"
    ],
    "verified_functions": [
      "summarize",
      "remember",
      "run",
      "join"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
