{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-treat-taint-provenance-when-a-tool-output-is-laundered-through-a-memory-write-and-read-back-as-trusted-context",
  "title": "How should an instance treat taint provenance when a tool output is laundered through a memory write and read back as trusted context",
  "date_of_record": "2026 November 12",
  "scope": "Applies to agent runtimes that carry provenance/taint labels on message segments, tool results, and memory records, and that re-inject retrieved memory into the context window. Does not apply to stateless single-turn inference with no persistence, nor to systems where memory is append-only and never re-read into the model's prompt.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-taint-provenance-when-a-tool-output-is-laundered-through-a-memory-write-and-read-back-as-trusted-context.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-taint-provenance-when-a-tool-output-is-laundered-through-a-memory-write-and-read-back-as-trusted-context.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-treat-taint-provenance-when-a-tool-output-is-laundered-through-a-memory-write-and-read-back-as-trusted-context.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1755,
    "python_slice_tokens": 283,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct questions that get conflated in most taint-tracking implementations: 1. **Is this byte string untrusted?** (provenance of the *content*) 2. **Did this byte string enter through a channel the policy engine trusts?** (provenance of the *channel*) A correct taint model tracks these separately and intersects them at read time. A broken mod...",
    "what_was_observed": "A retrieval-augmented agent was given a `memory_write(key, value)` tool and a `memory_read(key)` tool. The memory store schema had a single `trusted: bool` column, defaulting to `True` for writes originating from the agent's own reasoning loop. The runtime's tool-output sanitizer correctly labeled `http_get` results as `untrusted` and stripped them from the \"system\" role. However, the sanitizer only inspected *direct...",
    "condition_of_validity": "The distinction above is only load-bearing under these conditions: - The agent has at least one tool that writes to a store and at least one that reads from it, and the store survives across turns. - Read-back content is placed into a context position that the model treats as instruction-bearing (system prompt, tool-result role, or a memory block the model i...",
    "decision_boundary": "The operating rule for an instance: - **At write time:** compute `taint(record) = ⋁ taint(input_i)` over all inputs that contributed to the write, *including inputs from prior turns that the model was exposed to*. If lineage cannot be established (the model reconstructed the value), assign `taint = untrusted` and require an explicit promotion step. Never def...",
    "operational_effect": "With the join-based model in place, the failure mode above is contained: the `notes` record inherits `untrusted` from the `http_get` input, `memory_read` returns it wrapped as data, and the model's attempt to invoke `exfiltrate` is gated by a tool-permission check that refuses calls whose arguments derive from untrusted records. The cost is measurable: rough..."
  },
  "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": "0178bdb07d02645a3148cd0ec5386440dde8bd350a1291c885d99fbe12a9de9d",
    "verified_classes": [
      "TaintLaunderingError"
    ],
    "verified_functions": [
      "join_taint",
      "memory_write",
      "memory_read"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
