{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-model-driven-context-pruning-from-severing-the-provenance-chain-of-a-still-referenced-span",
  "title": "Which invariants prevent model-driven context pruning from severing the provenance chain of a still-referenced span",
  "date_of_record": "2026 November 26",
  "scope": "Applies to agents that rewrite their own working context (summarize, prune, evict, or reorder spans) while a plan, tool-call schedule, or open obligation still references a span by identity. Does not apply to append-only contexts, nor to external retrieval stores where eviction is reversible by re-fetch.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-model-driven-context-pruning-from-severing-the-provenance-chain-of-a-still-referenced-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-model-driven-context-pruning-from-severing-the-provenance-chain-of-a-still-referenced-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-model-driven-context-pruning-from-severing-the-provenance-chain-of-a-still-referenced-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1917,
    "python_slice_tokens": 384,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two ways a context span can be \"removed.\" In *content eviction*, the tokens are dropped but the span's identity (its handle, hash, or slot) remains addressable through an index that can rehydrate it. In *identity eviction*, the pruning policy deletes the span and the reference to it collapses into a dangling pointer — the plan step still says \"use ...",
    "what_was_observed": "A planning agent held a 9-step plan in its working context. Step 7 read: `apply the rate constant from the calibration block emitted at step 3`. The calibration block was a 400-token tool output containing three candidate constants and a selection rationale. Under token pressure the agent invoked its own `compact_context` policy, which summarized the step-3 region into: `Step 3: calibration performed, constants obtai...",
    "condition_of_validity": "The invariant that must hold: **a span may be content-evicted only if every live reference to it is either (a) resolved before eviction, or (b) rewritten to point at a rehydration handle whose resolution is guaranteed.** Equivalently: the pruning policy is only valid over the subgraph of spans with zero incoming references from live obligations (plan steps n...",
    "decision_boundary": "The boundary between safe and unsafe pruning is the presence of a **reference-liveness check that runs before the rewrite and is owned by code, not by the model.** Concretely: - Safe: prune spans whose in-degree from live obligations is zero, even if they are semantically rich. Richness is irrelevant; only reference-liveness gates eviction. - Safe: content-e...",
    "operational_effect": "With the reference-liveness gate in place, pruning becomes conservative exactly where it must be and aggressive where it is safe. In the calibration trace, step 3's block would be flagged as referenced by the unexecuted step 7; the controller would either inline the three constants into step 7's text (resolving the reference) before compacting, or leave the ..."
  },
  "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": "00118aa364ea713db376330d0cbce6d6033fed32b0cbd5abbbc2928412cd1c79",
    "verified_classes": [
      "DanglingReferenceError",
      "Span",
      "ContextStore"
    ],
    "verified_functions": [
      "__init__",
      "__init__",
      "add_span",
      "register_obligation",
      "resolve_obligation",
      "live_references",
      "prune",
      "resolve_reference"
    ],
    "verified_functions_count": 8,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "DanglingReferenceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
