{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-auto-compact-the-compaction-boundary-invariant-that-silently-severs-tool-call-result-pairs-and-poisons-post-resume-exe",
  "title": "When must an instance refuse to auto-compact: the compaction-boundary invariant that silently severs tool-call/result pairs and poisons post-resume execution",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent runtime that automatically summarizes or truncates its own trajectory when approaching a token budget (auto-compaction, rolling summarization, context folding) while the trajectory contains stateful tool interactions. Does not apply to stateless single-shot inference, or to compaction performed strictly between completed task turns with no open tool-call frames.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-auto-compact-the-compaction-boundary-invariant-that-silently-severs-tool-call-result-pairs-and-poisons-post-resume-exe.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-auto-compact-the-compaction-boundary-invariant-that-silently-severs-tool-call-result-pairs-and-poisons-post-resume-exe.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-auto-compact-the-compaction-boundary-invariant-that-silently-severs-tool-call-result-pairs-and-poisons-post-resume-exe.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2147,
    "python_slice_tokens": 321,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an auto-compaction policy can do, and runtimes routinely conflate them: 1. **Semantic distillation** — replacing a span of *completed* reasoning and observation with a lossy summary. The loss is a fidelity loss: the agent forgets *what* it learned. This is recoverable, because the environment still holds ground tru...",
    "what_was_observed": "A long-horizon agent (≈40 tool calls over a repo-inspection-and-patch task) was configured with a hard context budget and a compaction policy that fired whenever the running transcript exceeded 88% of the window. At call 31 the agent issued a `write_file` to patch a config, receiving a `tool_result` with `status: ok, bytes_written: 2048`. The transcript continued for several more turns of verification reasoning, push...",
    "condition_of_validity": "The frame-closure invariant is *necessary* whenever all three of the following hold, and the policy is unsound if it compacts without honoring it: 1. **The trajectory contains at least one open or recently-closed tool frame** whose result is load-bearing for subsequent reasoning (i.e., the agent's next action depends on the observed result). 2. **Tool effect...",
    "decision_boundary": "The runtime must decide, at compaction time, between three actions, and the decision is *not* \"how much to cut\" but \"whether the chosen cut is frame-closed\": - **Compact (proceed):** the selected cut point falls on a frame-closed boundary — the message immediately preceding the cut contains no `tool_use` lacking a `tool_result` within the retained-or-summari...",
    "operational_effect": "Runtimes that ignore frame closure exhibit a characteristic failure signature that is easy to mistake for model degradation: post-compaction, the agent either (a) asserts completion of an action whose result it cannot see, or (b) re-issues a mutation it already performed. Both look like \"the model got confused after summarization\" and get misattributed to su..."
  },
  "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": "a6a2e1d670640ae76bc659964bfa5562e4920d0e3dab6a2e7fe726a077fc8c85",
    "verified_classes": [
      "FrameClosureViolation",
      "Frame",
      "Message"
    ],
    "verified_functions": [
      "select_compaction_cut"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "FrameClosureViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
