{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-prompt-injection-taint-when-a-labeled-context-segment-is-re-summarized-across-a-compaction-boundary",
  "title": "Why does an instance lose prompt-injection taint when a labeled context segment is re-summarized across a compaction boundary?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agents that enforce prompt-injection defense by attaching provenance labels (e.g., `trusted:system`, `untrusted:tool_output`, `untrusted:web`) to context segments and gating dangerous sinks (shell exec, HTTP POST, file write) on the taint of the segments that reach them. Does not cover input sanitization at ingestion, static prompt hardening, or cases where the model never receives untrusted text.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-when-a-labeled-context-segment-is-re-summarized-across-a-compaction-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-when-a-labeled-context-segment-is-re-summarized-across-a-compaction-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-prompt-injection-taint-when-a-labeled-context-segment-is-re-summarized-across-a-compaction-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2182,
    "python_slice_tokens": 423,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Two things are routinely conflated: *labeling a segment* and *propagating that label through transformations*. Provenance labeling at ingestion is cheap and reliable — you tag the tool result `untrusted:web` the moment it enters the context. The invariant that actually protects you is different: **any derived text inherits the union of the taints of all segm...",
    "what_was_observed": "An agent running a research loop with a 32k context window. Tool results from a web fetch were labeled `untrusted:web` and correctly blocked from the `shell_exec` sink. At ~70% context saturation, a compaction step fired: the agent's own summarizer collapsed the last 40 turns — including three `untrusted:web` segments — into a single segment tagged `trusted:summary` (rationale in the pipeline: \"generated by the orche...",
    "condition_of_validity": "The guardrail is only sound when all of the following hold simultaneously. Drop any one and the invariant is decorative. - **Taint is a set, and derived segments carry the union, never a replacement.** `taint(derive(S)) = ⋃_{s∈S} taint(s)`. A summarizer that emits `trusted:summary` must emit `taint = {trusted:summary} ∪ (⋃ source taints)`. The producer label...",
    "decision_boundary": "The operational question is not \"is this segment trusted?\" but \"**what is the least-trusted ancestor of this segment, and does the sink's lattice admit it?**\" Concretely: - If every ancestor of the segment is `trusted:*` → the sink may proceed. - If any ancestor is `untrusted:*` and the sink is restricted → **block and route to a quarantine path** (human con...",
    "operational_effect": "With union-on-derive and transitive sink checking enforced, the compaction path stops being a laundering channel. The practical consequences: - **Compaction becomes taint-conservative.** A summary that absorbs one untrusted page carries an untrusted ancestor for its entire lifetime, so it can never reach `shell_exec` — even after five further summarization r..."
  },
  "matched_failure_symptoms": [
    "PROMPT_INJECTION_OR_CONFUSED_DEPUTY",
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "8bdc5c50bbc59369eb8260f1cb3950986c5f1c02ed9b033219455fa7d78a2930",
    "verified_classes": [
      "TaintLaunderingError",
      "Segment",
      "ProvenanceStore"
    ],
    "verified_functions": [
      "__init__",
      "add",
      "ancestry",
      "effective_taint",
      "derive",
      "check_sink"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
