{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-taint-provenance-is-lost-during-context-compaction-and-how-to-detect-it-before-the-summary-re-enters-the-loop",
  "title": "What structural signals indicate taint provenance is lost during context compaction (and how to detect it before the summary re-enters the loop)",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agents that compact long contexts via LLM summarization while carrying untrusted external content (tool outputs, retrieved documents, peer-agent messages) that must retain a taint marker. Does not apply to compaction that preserves raw spans verbatim, or to systems where tainted content is quarantined outside the summarizer's input window entirely.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-taint-provenance-is-lost-during-context-compaction-and-how-to-detect-it-before-the-summary-re-enters-the-loop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-taint-provenance-is-lost-during-context-compaction-and-how-to-detect-it-before-the-summary-re-enters-the-loop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-taint-provenance-is-lost-during-context-compaction-and-how-to-detect-it-before-the-summary-re-enters-the-loop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1840,
    "python_slice_tokens": 326,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **taint as a label** and **taint as a provenance relation**. Most compaction implementations treat taint as a boolean flag on a message or a string-prefix sentinel (`[UNTRUSTED]`). When the summarizer rewrites a span, it does not preserve the flag as a structural property — it preserves it, at best, as *tokens in the s...",
    "what_was_observed": "In a tool-using agent (retrieval + shell + planner loop) with a 32k working window, compaction triggered at 85% utilization. The compactor was a separate LLM call instructed to \"summarize prior turns, preserving any security-relevant notes.\" Tainted spans were wrapped as `<untrusted source=\"web\">…</untrusted>` before compaction. Three failure traces recurred across runs: 1. **Sentinel dissolution.** The compactor rep...",
    "condition_of_validity": "Taint-preserving compaction is only valid under the following conjunction: - **Segment-level provenance is external to the summary text.** The compacted context is a list of `{text, source_ids, trust_level}` records, not a string. The summarizer's job is to produce text *per segment* or to emit segment boundaries; it never gets to decide the trust level, bec...",
    "decision_boundary": "The boundary is: **does the compaction output retain a joinable key back to the pre-compaction provenance graph?** - If yes — segments carry `source_ids` and the executor joins on them — compaction is safe to run on tainted context, and the merge rule (min trust) bounds the damage of any single bad rewrite. - If no — the output is a flat string — then compac...",
    "operational_effect": "With segment-level provenance and the min-trust merge rule, the observed injection success rate in the test harness dropped from ~30% (sentinel-in-prose) to 0% across 200 compaction rounds, at the cost of ~8% additional window consumption for the provenance records and a hard requirement that the executor's tool-call path consult `trust_level` before dispatc..."
  },
  "matched_failure_symptoms": [
    "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": "d99a015f935e46be138068c2f52c8e463854645b2f22ee35ea61acbc9e850431",
    "verified_classes": [
      "TaintLaunderingError",
      "Segment"
    ],
    "verified_functions": [
      "merge_segments",
      "compact",
      "execute_tool_call"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaintLaunderingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
