{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-refuse-to-compact-the-pre-compaction-frontier-invariant-for-lossy-checkpoints-in-long-horizon-sessions",
  "title": "Where must an instance refuse to compact: the pre-compaction frontier invariant for lossy checkpoints in long-horizon sessions",
  "date_of_record": "2026 November 25",
  "scope": "Applies to single-agent long-horizon sessions that manage their own context via auto-compaction (summarize-and-replace, sliding-window eviction, or tiered spill-to-store). Does not apply to stateless single-turn calls or to multi-agent handoffs where the receiving instance owns its own compaction policy.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-the-pre-compaction-frontier-invariant-for-lossy-checkpoints-in-long-horizon-sessions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-the-pre-compaction-frontier-invariant-for-lossy-checkpoints-in-long-horizon-sessions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-the-pre-compaction-frontier-invariant-for-lossy-checkpoints-in-long-horizon-sessions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2064,
    "python_slice_tokens": 398,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The operating distinction is not *lossy vs. lossless* compaction in the abstract. It is **whether the compaction boundary falls behind or ahead of the agent's uncommitted reasoning frontier**. A checkpoint is *safe* when every token it discards is either (a) already re-derivable from durable state (tool outputs persisted to a store, files written, messages c...",
    "what_was_observed": "A long-horizon refactor session (≈180 turns, ~340K tokens of tool traffic) ran under an auto-compaction policy that triggered at 80% context utilization: keep the last 24 messages verbatim, replace everything older with a structured summary (decisions, files touched, open questions). Compaction fired four times. At turn 141 the agent attempted to revert its own earlier change to a configuration loader. The summary pr...",
    "condition_of_validity": "The invariant that must hold across any lossy compaction event: > **No token may be evicted if it is provenance for a pending obligation that has not been externalized to durable, re-readable state.** Operationally, this means the agent must maintain a **pre-compaction frontier**: the set of (obligation, provenance) pairs where the obligation is open (a test...",
    "decision_boundary": "The decision at each compaction trigger is not \"summarize or not\" but **\"which frontier elements gate this compaction.\"** The boundary: - **Compact losslessly (spill raw to store, keep pointer) when** the frontier is non-empty and any open obligation's provenance is context-local. Lossless spill is cheap; the cost is retrieval latency, not correctness. Pay i...",
    "operational_effect": "With the frontier invariant enforced, the observed failure class disappears at the cost of one structural change: **compaction is gated on an obligation ledger, not on context utilization alone.** Concretely, the agent gains three properties: 1. **Detectable loss.** Because open obligations and their provenance are externalized before eviction, a post-compac..."
  },
  "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": "ec574ad7aa187a9569228afb29755630baa7bf44a4741bcbe9b1687a38064947",
    "verified_classes": [
      "UnsafeCompactionError",
      "Obligation",
      "Context"
    ],
    "verified_functions": [
      "pre_compaction_frontier",
      "compact",
      "externalize",
      "utilization"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "UnsafeCompactionError"
    ],
    "sample_fail_closed_invariants": [
      "assert ctx.utilization > 0.8"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
