{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-loss-of-provenance-when-a-model-driven-context-pruner-rewrites-the-working-set",
  "title": "Which invariants prevent silent loss of provenance when a model-driven context pruner rewrites the working set",
  "date_of_record": "2026 November 8",
  "scope": "Applies to agentic context managers where an LLM (or a learned policy) issues `prune`, `summarize`, or `rewrite` operators over an active context window that is itself the substrate for subsequent tool calls and citations. Does not apply to append-only logs, human-curated retrieval indexes, or systems where every rewrite is re-derived from an immutable source of truth on each turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-loss-of-provenance-when-a-model-driven-context-pruner-rewrites-the-working-set.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-loss-of-provenance-when-a-model-driven-context-pruner-rewrites-the-working-set.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-loss-of-provenance-when-a-model-driven-context-pruner-rewrites-the-working-set.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1763,
    "python_slice_tokens": 322,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two families of context-editing operators, and they fail differently: - **Lossy-by-construction operators** (`summarize`, `abstract`, `compress`) are *expected* to discard tokens. The invariant that matters is that the discarded content remains reachable via a stable handle, and that the summary is tagged as derived rather than primary. - **Lossles...",
    "what_was_observed": "In a long-running coding agent (≈40k-token working set, 200+ tool calls per session), a pruner was invoked at 80% window utilization with the instruction \"remove redundant tool outputs, keep all unique facts.\" Observed across ~1,200 prune events: 1. **Silent merge of near-duplicates.** Two `read_file` outputs of the same path at different offsets (lines 1–200 and 180–400) were collapsed to one, on the reasoning that ...",
    "condition_of_validity": "The following invariants are what make model-driven pruning safe. They hold only under these conditions, and each is independently testable: - **I1 — Provenance monotonicity.** Every token in the post-prune window resolves to at least one `source_handle` (tool call ID, file+offset+hash, or user-utterance ID). Rewrites may *add* handles but never remove the l...",
    "decision_boundary": "The operational rule: **a model-driven operator may be trusted as lossless only if it passes a semantic-diff gate against grounded spans; otherwise it must be demoted to a lossy operator with derivation tagging and durable handles.** Concretely, before committing a prune/rewrite: - Extract grounded spans (numbers, identifiers, paths, config values, quoted us...",
    "operational_effect": "Enforcing I1–I5 changed observed behavior measurably: silent-merge events dropped from ~7% of prunes to <0.5% (the residual being byte-identical true duplicates, which are safe); rewrite-induced fact drift went to zero on grounded spans because such rewrites were reclassified as `derived` and forced through review; citation-marker retention stabilized at ≥97..."
  },
  "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": "9240bf592abf660c3c0547db56ab900d77d07458b006137b3c0f5dc40da33c32",
    "verified_classes": [
      "ProvenanceInvariantError"
    ],
    "verified_functions": [
      "commit_context_edit"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ProvenanceInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
