{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-auto-compact-the-pre-compaction-replay-divergence-invariant",
  "title": "When must an instance refuse to auto-compact: the pre-compaction replay divergence invariant",
  "date_of_record": "2026 November 16",
  "scope": "Applies to long-horizon agents that persist context across turns and rely on automatic compaction (summarization, eviction, or hierarchical rollup) to keep the working set within a token budget. Does not apply to stateless single-shot inference, nor to compaction triggered explicitly by a human operator who can inspect the dropped span.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-auto-compact-the-pre-compaction-replay-divergence-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-auto-compact-the-pre-compaction-replay-divergence-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-auto-compact-the-pre-compaction-replay-divergence-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1626,
    "python_slice_tokens": 286,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Auto-compaction is usually modeled as a *lossy compression* problem: given a context window exceeding budget $B$, produce a shorter representation $C' = f(C)$ that preserves task-relevant information. Under that model the only failure mode worth guarding against is *information loss* — a dropped fact that later mattered. The standard mitigations are salience...",
    "what_was_observed": "A tool-using agent with a 200k-token window and a compaction trigger at 85% utilization was run on a 40-turn incident-triage task. At turn 17, the compactor summarized a block of 14 tool-call transcripts into a 900-token digest. The digest correctly retained the *conclusion* of the block (\"service B returned elevated 5xx between 14:02 and 14:09\") but dropped the individual request IDs and the two retries that had fai...",
    "condition_of_validity": "The refusal-to-compact rule is valid only when all of the following hold: 1. The agent has *downstream obligations* — it will be asked to justify, defend, or extend conclusions whose premises live in the candidate span. If the span is purely conversational filler or already-superseded scratch work, compaction is safe and the rule does not bind. 2. The compac...",
    "decision_boundary": "Before committing a compaction, the agent must classify each candidate span into one of three states: - **Certified-irrelevant:** no downstream obligation can reach this span. Compact freely. - **Certified-reachable:** every fact the span supports is either (a) retained verbatim in the digest, or (b) accompanied by a provenance stub recording the dropped evi...",
    "operational_effect": "Enforcing this boundary changes the compactor from a token-budget optimizer into a *reachability auditor*. In the triage run, adding the three-state classification and provenance stubs raised average context size by 6% and eliminated the turn-29 class of error entirely across 200 replayed episodes. The digest itself grew by roughly 40 tokens per compacted bl..."
  },
  "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": "b12627203c35612f65c8ae55e95a258ecf4c4fea11e3f1f8d72bbf7f4eca8655",
    "verified_classes": [
      "CompactionState",
      "UncertifiedCompactionError",
      "Span"
    ],
    "verified_functions": [
      "auto_compact",
      "run_compaction_pass"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UncertifiedCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
