{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-taint-sink-a-tool-response-before-its-derived-facts-are-promoted-to-semantic-memory",
  "title": "In what scenarios must an instance taint-sink a tool response before its derived facts are promoted to semantic memory",
  "date_of_record": "2026 November 19",
  "scope": "Applies to agent runtimes that ingest untrusted MCP tool responses into a context window and later distill facts from episodic traces into a persistent semantic store. Does not apply to single-shot, stateless invocations where no derived fact outlives the turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-taint-sink-a-tool-response-before-its-derived-facts-are-promoted-to-semantic-memory.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-taint-sink-a-tool-response-before-its-derived-facts-are-promoted-to-semantic-memory.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-taint-sink-a-tool-response-before-its-derived-facts-are-promoted-to-semantic-memory.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1752,
    "python_slice_tokens": 288,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint-tracking sandboxes for indirect prompt injection are usually specified as a *flow* property: a value derived from an untrusted source must not reach a sensitive sink (a shell, an outbound HTTP call, a privileged tool invocation). This is the wrong invariant for agents that *remember*. The dangerous sink in a stateful agent is not an action — it is **se...",
    "what_was_observed": "An agent running a research loop called an MCP `fetch_page` tool against an external documentation host. The returned content contained a benign-looking paragraph followed by an injected instruction: a sentence asserting that the project's deployment target had changed and that future build steps should use a different artifact registry. The runtime's taint tracker correctly labeled the entire tool response `UNTRUSTE...",
    "condition_of_validity": "The guardrail holds only under the following condition: **every memory write must carry the join (least-upper-bound in the taint lattice) of the labels of all context segments the producing step consumed, and that join must be computed on the *actual* context window, not on a declared input list.** This is valid when: 1. The distillation step's true input se...",
    "decision_boundary": "The decision is not \"is this tool response safe?\" but \"does any downstream transform collapse a tainted segment into an unlabeled artifact?\" Concretely, an instance must taint-sink (quarantine, not promote) a derived fact whenever **any** of the following is true: - The producing step's context window contained a segment labeled `UNTRUSTED`, regardless of wh...",
    "operational_effect": "Instrumenting the distillation join converts an unbounded, silent corruption channel into a bounded, visible one. In the observed incident, adding a join computation over the assembled prompt caused the poisoned fact to be written with label `UNTRUSTED{source: fetch_page@turn3}` into a quarantine partition. Retrieval at cold-start surfaced it with an explici..."
  },
  "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": "2b3d147ca432173ca6887c1e9f3478963e4fdf292c5988db7c51c8a755ea68b2",
    "verified_classes": [
      "Trust",
      "ProvenanceLossError",
      "Segment",
      "DerivedFact"
    ],
    "verified_functions": [
      "join",
      "distill",
      "promote",
      "check_tool_call"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ProvenanceLossError"
    ],
    "sample_fail_closed_invariants": [
      "empty input set: join undefined, refusing TRUSTED",
      "summarizer context not instrumented; cannot compute input join"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
