{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-refuse-to-compact-when-a-summarizer-s-own-working-set-exceeds-the-compaction-budget",
  "title": "Where must an instance refuse to compact when a summarizer's own working set exceeds the compaction budget?",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent loop that performs in-context trajectory compaction (rolling summarization, hierarchical memory folding, or \"context distillation\") to stay under a token budget while executing a long-horizon task. Does not apply to external vector-store retrieval or to stateless single-turn calls, where compaction is not part of the execution loop.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-when-a-summarizer-s-own-working-set-exceeds-the-compaction-budget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-when-a-summarizer-s-own-working-set-exceeds-the-compaction-budget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-refuse-to-compact-when-a-summarizer-s-own-working-set-exceeds-the-compaction-budget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1926,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary was lossy.\" All summaries are lossy. The failure is **budget-relative**: the compaction step is itself an LLM call that consumes context, and its *input* (the raw span being folded plus the prior summary plus the instruction scaffold) plus its *output* (the new summary) must fit inside the same budget it is trying to defend. W...",
    "what_was_observed": "A planning agent running a 40-step dependency-resolution task (read manifests, probe registries, patch version pins, re-run resolution) used a rolling summary strategy: every 8 tool results, the oldest 8 turns were folded into a running summary via a `summarize(prior_summary, span)` call. At step 31 the running summary had grown to ~2,900 tokens because the agent had been appending \"constraint discovered: X\" lines wi...",
    "condition_of_validity": "The invariant holds only under the following conditions, and the guardrail is only sound when all three are met: 1. **The fold is atomic w.r.t. the budget guard.** The occupancy check must be evaluated against `prior_summary + span + scaffold + expected_output`, not against `prior_summary + unread_tail`. If the guard is evaluated at step boundaries only, it ...",
    "decision_boundary": "The boundary is a single inequality the controller must evaluate *before* admitting a fold: If it holds, fold the whole span. If it does not, the correct action is **not** to truncate the span and **not** to enlarge it on retry. The correct action is to **split the span** into the largest prefix that satisfies the inequality and fold that prefix first, defer...",
    "operational_effect": "With the pre-transaction guard and the typed refusal branch in place, the observed failure mode disappears and is replaced by a bounded, observable one: the agent occasionally emits a `CompactionDeficit` and performs a second-order summary re-compression, costing one extra LLM call but preserving the newest evidence. The dropped-span fraction goes to zero fo..."
  },
  "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": "2ca5041a6cdd20d0fd09aeb5ceeee7e921e6232e90ba178ba0d9fb9edf5157ac",
    "verified_classes": [
      "CompactionDeficit",
      "FoldPlan"
    ],
    "verified_functions": [
      "plan_fold",
      "run_fold_cycle"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CompactionDeficit"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
