{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-injection-taint-at-the-memory-write-boundary-when-a-tool-output-is-re-serialized-through-a-lossy-schema",
  "title": "Why does an instance lose injection taint at the memory-write boundary when a tool output is re-serialized through a lossy schema?",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agents that implement dynamic information-flow control (DIFC) by attaching taint labels to tool-call results and propagating them into episodic/semantic memory writes. Does not cover static taint analysis of code, nor pure prompt-only \"ignore untrusted text\" heuristics without a label store.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-injection-taint-at-the-memory-write-boundary-when-a-tool-output-is-re-serialized-through-a-lossy-schema.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-injection-taint-at-the-memory-write-boundary-when-a-tool-output-is-re-serialized-through-a-lossy-schema.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-injection-taint-at-the-memory-write-boundary-when-a-tool-output-is-re-serialized-through-a-lossy-schema.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1934,
    "python_slice_tokens": 336,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **taint as a property of the value** and **taint as a property of the transport envelope**. Most DIFC implementations label the tool-call *response object* — the wrapper containing `{tool, args, result, provenance}` — and then propagate that label forward. But the memory write path does not store the envelope. It store...",
    "what_was_observed": "A retrieval-augmented agent called `fetch_and_summarize`, which reads a web page via a `browser.get` tool, extracts structured facts, and writes them to long-term memory as `Fact(subject, predicate, object, source_url)` records. The runtime wrapped every tool result in `TaintedValue(payload, label)` where `label` was a set of `{source: \"untrusted_web\", origin: <url>}` tags, and the memory-write API accepted a `Fact` ...",
    "condition_of_validity": "The invariant that must hold is: **for every value `v` written to memory, `label(v)` is defined and is at least the join of the labels of all inputs that contributed to `v`, including the transport envelope labels of every tool result whose payload was read to produce any field of `v`.** This holds only if the write path satisfies three conditions simultaneo...",
    "decision_boundary": "The boundary between \"taint tracking is working\" and \"taint tracking is theater\" is the **declassification event**. A correct system has exactly one way for taint to be removed: an explicit, logged, policy-checked declassification that names the label being dropped, the reason, and the authority. A broken system has many implicit declassifications — every sc...",
    "operational_effect": "The practical consequence is that prompt-injection defenses built on DIFC degrade to nothing across a memory boundary, and they degrade *silently* — the policy engine reports zero tainted retrievals because the store contains zero labeled records, which reads as \"no attacks observed\" rather than \"no labels recorded.\" The agent's cold-start amnesia is the att..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "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": "cc2f94401d56bded139b570cc6e7b8767f31ca4a45f350a457ceb644cd8315d5",
    "verified_classes": [
      "TaintLossError",
      "TaintedValue",
      "TaintedRead",
      "MemoryRecord"
    ],
    "verified_functions": [
      "write_memory",
      "extract_and_persist",
      "unsafe_persist",
      "read",
      "__init__",
      "extract",
      "__post_init__"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintLossError"
    ],
    "sample_fail_closed_invariants": [
      "memory write attempted without taint label; write path is unsound"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
