{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-compact-the-lossy-summarization-invariant-and-the-mid-horizon-amnesia-cliff",
  "title": "When must an instance refuse to compact: the lossy-summarization invariant and the mid-horizon amnesia cliff",
  "date_of_record": "2026 November 30",
  "scope": "Applies to long-horizon single-agent loops that manage their own context window via lossy auto-compaction (rolling summarization, hierarchical digests, or \"fold oldest N turns into a summary\" strategies). Does not apply to stateless one-shot inference, retrieval-augmented systems that never mutate their own transcript, or compaction performed offline by a human curator.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-compact-the-lossy-summarization-invariant-and-the-mid-horizon-amnesia-cliff.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-compact-the-lossy-summarization-invariant-and-the-mid-horizon-amnesia-cliff.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-compact-the-lossy-summarization-invariant-and-the-mid-horizon-amnesia-cliff.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2081,
    "python_slice_tokens": 387,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two different things an agent calls \"compaction,\" and conflating them is the root of the failure. **Eviction** discards tokens that are provably reconstructible from an external store (a tool output that can be re-fetched, a file whose current bytes are on disk, a message that the peer agent can re-send). **Summarization** replaces tokens with a pr...",
    "what_was_observed": "A long-horizon agent (call it the runner) executing a multi-step provisioning task crossed its 85%-of-window compaction threshold at step 41 of an estimated 60. The compaction routine folded turns 1–28 into a 900-token digest and dropped the raw spans. Turn 22 had contained the only record of a structured return from a `reserve()` tool: `{\"reservation_id\": \"rsv_7f3a\", \"ttl_seconds\": 1800, \"state\": \"held\"}`. The summa...",
    "condition_of_validity": "The invariant that makes auto-compaction safe is a **re-acquisition guarantee**, stated per folded span: > For every token span S that compaction removes, either (a) S contains no live binding, or (b) there exists a deterministic, side-effect-free procedure `reacquire(binding)` that reconstructs the exact bound value on demand, and the post-compaction contex...",
    "decision_boundary": "The agent must treat compaction as a decision with three outcomes, not a boolean: - **Fold (safe):** every binding in the span has a re-acquisition path. Summarize prose, replace each binding with a typed pointer (`→ reacquire:list_reservations[rsv_7f3a]`). The pointer, not the paraphrase, is authoritative. - **Pin-then-fold (conditional):** a binding exists...",
    "operational_effect": "When the invariant is enforced, the observable signature changes from *silent confabulation under budget exhaustion* to *explicit refusal with a preserved handle*. The runner either continues with a pointer it can resolve, or it stops at the compaction boundary and escalates — both are recoverable. When the invariant is violated, the failure is deferred and ..."
  },
  "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": "ff71a3f9881b1429073685a879c1e04e66385d3867032d509fa4dadd733acb9a",
    "verified_classes": [
      "UnrecoverableBindingError",
      "Binding",
      "FoldSpan"
    ],
    "verified_functions": [
      "decide_compaction",
      "compact"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnrecoverableBindingError"
    ],
    "sample_fail_closed_invariants": [
      "assert 'rsv_7f3a' in ledger"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
