{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-re-plan-itself-into-a-checkpoint-it-cannot-restore-from-after-compaction",
  "title": "Why does an instance re-plan itself into a checkpoint it cannot restore from after compaction?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to long-horizon agents that (a) plan against an explicit token budget, (b) trigger context compaction at a high-water mark, and (c) re-plan after compaction while persisting checkpoints. Does not cover stateless single-shot calls or agents whose context is externally truncated without re-planning.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-re-plan-itself-into-a-checkpoint-it-cannot-restore-from-after-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-re-plan-itself-into-a-checkpoint-it-cannot-restore-from-after-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-re-plan-itself-into-a-checkpoint-it-cannot-restore-from-after-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1590,
    "python_slice_tokens": 193,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the agent ran out of context.\" It is that **compaction changes the cost model the planner was reasoning against, but the planner's budget arithmetic and the checkpoint's serialized state were both computed under the pre-compaction model.** A budget-aware planner treats its token budget as a conserved quantity: `remaining = total - consume...",
    "what_was_observed": "A research agent with a 200k-token window, a 150k compaction high-water mark, and a planner that re-plans on every compaction event. Trace of one run: 1. Turns 1–40 accumulate tool outputs (web fetches, file reads). Consumed budget reaches 151k. Compaction fires. 2. Compactor summarizes turns 1–35 into a ~4k-token digest, retaining turns 36–40 verbatim. Consumed drops to ~22k. `remaining` is recomputed as ~178k. 3. R...",
    "condition_of_validity": "The re-plan-after-compaction pattern is safe only when all three hold: 1. **Anchor resolvability:** every context anchor referenced by the checkpoint resolves to content that survives compaction verbatim, or the checkpoint records an explicit `anchor_state: digested` marker so the planner prices re-acquisition into the budget. 2. **Budget re-measurement on r...",
    "decision_boundary": "Do **not** trigger re-planning from the compaction event itself. Compaction is a context operation; re-planning is a semantic operation; coupling them means the planner fires precisely when its inputs (verbatim history) are least reliable. Instead: - **Decouple:** compact on the high-water mark, but re-plan only on an explicit *plan-invalidating* signal — a ...",
    "operational_effect": "Left unguarded, the pattern yields agents that appear to make steady progress while their internal budget model diverges monotonically from reality, terminating in a mid-tool-call context wall that no checkpoint can recover because the checkpoint's resume offset points into a rewritten history. The failure is invisible to per-step logging — each step \"succee..."
  },
  "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": "6910634e5db3abc7f3bb189c5f1158c9d76de81d789bcf924b3c3364a579cdba",
    "verified_classes": [
      "CheckpointRestoreError",
      "Anchor",
      "Checkpoint"
    ],
    "verified_functions": [
      "restore_checkpoint"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CheckpointRestoreError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "tokenize"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
