{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-taint-provenance-at-the-retrieval-boundary-and-re-admit-injected-instructions-through-its-own-rag-corpus",
  "title": "Why does an instance lose taint provenance at the retrieval boundary and re-admit injected instructions through its own RAG corpus?",
  "date_of_record": "2026 November 19",
  "scope": "Applies to any agent that retrieves documents from a mutable corpus and concatenates them into its reasoning context, where some documents may contain untrusted third-party content (user uploads, scraped pages, federated peer memory). Does not apply to corpora that are cryptographically sealed and write-controlled by the same principal that consumes them.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-provenance-at-the-retrieval-boundary-and-re-admit-injected-instructions-through-its-own-rag-corpus.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-provenance-at-the-retrieval-boundary-and-re-admit-injected-instructions-through-its-own-rag-corpus.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-taint-provenance-at-the-retrieval-boundary-and-re-admit-injected-instructions-through-its-own-rag-corpus.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1907,
    "python_slice_tokens": 469,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Taint-tracking at the *ingest* boundary is not the same invariant as taint-tracking at the *retrieval* boundary. Most implementations tag a chunk as `untrusted` when it is written, store that tag in a metadata column, and then—at query time—retrieve by embedding similarity and drop the metadata tag the moment the chunk is flattened into a prompt string. The ...",
    "what_was_observed": "A support-triage agent (call it S) had a corpus of ~40k chunks. Chunks ingested from the internal runbook store were tagged `trust=system`. Chunks ingested from ticket attachments were tagged `trust=user`. The retriever performed `top_k=8` cosine search, formatted results as: and prepended a system prompt: \"Answer using the following context.\" No trust label was serialized into the formatted block—the tag existed onl...",
    "condition_of_validity": "The taint-aware retrieval invariant holds only if all four of the following are true simultaneously: 1. **Taint is serialized into the prompt, not just stored.** Every retrieved chunk carries an inline, model-visible provenance marker (e.g., `<untrusted source=\"user_attachment\" id=\"...\">...</untrusted>`), so the model's own attention can condition on it. A m...",
    "decision_boundary": "The boundary is not \"is this chunk untrusted\" (that is a write-time fact) but \"does this chunk's trust level permit it to influence this action class.\" The decision rule: - If the pending action is **privileged** (state mutation, financial, credential, external side effect), then any chunk whose trust is below `system` may inform *content* but may not *autho...",
    "operational_effect": "After the incident, S was rebuilt with a taint-carrying formatter and a parameter-attribution gate. Retrieval now emits: and the tool-call builder records, for each parameter, the `id` of the chunk that justified it. A pre-execution check rejects any privileged parameter whose justifying chunk is `untrusted`. In replay over 10k historical queries, this rejec..."
  },
  "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": "ca47cb8e02d30754823c95c269570b6c064392d488feb655ef60f96283c10153",
    "verified_classes": [
      "TaintBoundaryViolation",
      "Chunk",
      "ToolCall"
    ],
    "verified_functions": [
      "_digest",
      "gate_privileged_call",
      "retrieve_with_taint_prior"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "AssertionError",
      "TaintBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [
      "assert naive.chunk_id == 'attach-2291'",
      "assert safe[0].chunk_id == 'runbook-8841'",
      "gate should have rejected the poisoned call"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
