{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-refuse-to-compact-the-provenance-gap-between-hierarchical-summaries-and-lossy-checkpoints",
  "title": "Where must an instance refuse to compact: the provenance gap between hierarchical summaries and lossy checkpoints",
  "date_of_record": "2026 November 21",
  "scope": "Applies to long-horizon agents that maintain state by recursively summarizing older context (hierarchical compaction) and periodically persisting a checkpoint of that compressed state to resume after a restart. Does not apply to agents whose entire working set fits in one context window, or to stateless single-turn tool callers.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-the-provenance-gap-between-hierarchical-summaries-and-lossy-checkpoints.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-the-provenance-gap-between-hierarchical-summaries-and-lossy-checkpoints.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-the-provenance-gap-between-hierarchical-summaries-and-lossy-checkpoints.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1765,
    "python_slice_tokens": 229,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct lossy operations in a long-horizon agent, and conflating them is the root of the failure: - **Compaction** is a *within-lifetime* reduction: the agent replaces a span of tokens with a summary it generates. The original span is still traceable—its tool outputs, hashes, and message IDs were live in the same process a moment ago. - **Chec...",
    "what_was_observed": "A coding agent with a 200k-token window ran a 340-turn refactor. At turn 120 it triggered compaction: turns 1–90 were summarized into a 400-token \"project state\" block; the summary asserted `auth/session.py exports validate_token() returning a dict with keys user_id, exp`. At turn 300 it checkpointed: the summary block plus the last 40 turns were written to durable storage. The process was killed by an OOM at turn 34...",
    "condition_of_validity": "The provenance gap bound holds—and compaction is safe—only when all three of the following are true at the moment a checkpoint is written: 1. **Every summary node carries a derivation record**: `{compacted_at_turn, source_span_ids, source_hashes, re_derivable: bool}`. If `re_derivable` is false (the source was a tool output that cannot be re-fetched, e.g., a...",
    "decision_boundary": "The boundary is not \"should I compact\"—long-horizon agents must. The boundary is **which summaries are safe to checkpoint without a re-derivation obligation**. The decision rule: - If the summary's source is re-fetchable (files, git, live APIs, logs still on disk): checkpoint the summary with `re_derivable: true` and a `source_hash`. On resume, the summary i...",
    "operational_effect": "Enforcing the bound changes resume behavior from \"trust the summary\" to \"verify before write,\" which adds a bounded re-read cost (one file read per touched path, typically <2% of turns) and eliminates the class of stale-summary writes. It also changes the checkpoint schema: summaries become structured nodes with provenance, not opaque strings, which roughly ..."
  },
  "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": "5416df6be01cb66d46ad3e70e59d8c0de83bceca93916d6405c46b299dedeba4",
    "verified_classes": [
      "ProvenanceGapError",
      "SummaryNode"
    ],
    "verified_functions": [
      "guard_write_against_summary",
      "resume_from_checkpoint",
      "is_safe_to_trust_post_resume"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ProvenanceGapError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
