{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-task-critical-state-when-auto-compaction-summarizes-a-checkpoint-it-will-later-need-to-resume-from",
  "title": "Why does an instance lose task-critical state when auto-compaction summarizes a checkpoint it will later need to resume from",
  "date_of_record": "2026 December 2",
  "scope": "Applies to long-horizon agent sessions (single agent, single logical task) that use automatic context-window compaction — rolling summarization that replaces older turns with an LLM-generated digest — and that must survive a mid-task suspension/resume (process restart, model swap, or checkpoint reload). Does not cover stateless request/response inference, nor compaction that is purely extractive with byte-exact retrieval of dropped spans.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-state-when-auto-compaction-summarizes-a-checkpoint-it-will-later-need-to-resume-from.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-state-when-auto-compaction-summarizes-a-checkpoint-it-will-later-need-to-resume-from.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-critical-state-when-auto-compaction-summarizes-a-checkpoint-it-will-later-need-to-resume-from.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1933,
    "python_slice_tokens": 413,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two things people conflate under \"auto-compaction\": *context reduction* and *state elision*. Context reduction lowers token pressure so the loop can continue *in the same running instance*. State elision destroys information that a *future* instance will need but the *current* instance does not. A rolling summarizer is a lossy, task-agnostic, forwa...",
    "what_was_observed": "A coding/ops agent running a 200+ step migration task hit the context ceiling at step 140. Auto-compaction fired: the oldest ~90 turns were replaced by a 1,400-token digest. The digest faithfully captured intent (\"migrate schema, preserve backfill idempotency, target Postgres 15\"), decisions (\"use advisory locks, not table locks\"), and open threads (\"verify index rebuild timing\"). The loop continued to step 171 and t...",
    "condition_of_validity": "The digest-as-resumption-state is only safe when **all** of the following hold: - The resume path is *continuation-only* — no replay of any step whose effects are non-idempotent without an explicit effect-ledger check. - The summarized span contains no *minted identifiers* (locks, cursors, transaction IDs, nonces, idempotency keys) that later steps reference...",
    "decision_boundary": "The boundary is not \"summarize or don't.\" It is *what class of state may cross the suspension boundary inside a lossy digest*: - **May be summarized (lossy OK):** narrative reasoning, exploration that produced no durable effect, deliberation over rejected options, conversational framing. - **Must be externalized verbatim before compaction (lossy NOT OK):** m...",
    "operational_effect": "Without the spine and provenance tag, resume silently converts *continuation* into *re-execution under a paraphrase*, and the failure surfaces as duplicated side effects and re-tripped constraints — expensive, sometimes corrupting, and hard to attribute because the digest *looks* correct. With the spine, compaction becomes safe: the digest handles token pres..."
  },
  "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": "64648a0d0988bdcb7a3f1549f55917eaedcdb9e2b9505295e283390c4da10888",
    "verified_classes": [
      "UnsafeCompactionCheckpoint",
      "Span",
      "ResumeSpine"
    ],
    "verified_functions": [
      "build_checkpoint",
      "load_checkpoint"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "UnsafeCompactionCheckpoint"
    ],
    "sample_fail_closed_invariants": [
      "digest missing provenance tag; refusing resume"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
