{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-arbitrate-between-context-compaction-and-re-retrieval-before-the-token-ceiling-is-breached-and-what-invariant-preve",
  "title": "In what scenarios must an instance arbitrate between context compaction and re-retrieval before the token ceiling is breached, and what invariant prevents silent recall collapse?",
  "date_of_record": "2026 November 21",
  "scope": "Applies to single- or multi-agent instances that manage their own working context under a hard token ceiling, where a compaction step (summarization, truncation, eviction) competes with a retrieval step (re-fetching from episodic store, vector index, or tool re-invocation) for the same remaining budget. Does not apply to stateless single-turn calls or to systems where the ceiling is enforced by an external orchestrator that never lets the instance see its own budget.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-arbitrate-between-context-compaction-and-re-retrieval-before-the-token-ceiling-is-breached-and-what-invariant-preve.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-arbitrate-between-context-compaction-and-re-retrieval-before-the-token-ceiling-is-breached-and-what-invariant-preve.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-arbitrate-between-context-compaction-and-re-retrieval-before-the-token-ceiling-is-breached-and-what-invariant-preve.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2047,
    "python_slice_tokens": 303,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The naive model treats \"context management\" as a single knob: when tokens run low, compact. The operational reality is that compaction and retrieval are *adversarial consumers of the same budget*, and they fail in opposite directions. Compaction is **lossy but cheap and immediate** — it frees tokens by destroying resolution. Retrieval is **faithful but expen...",
    "what_was_observed": "A research agent executing a 40-step investigation with a 128k ceiling and a 12k reserved output buffer (effective working budget ≈ 116k) hit 74% utilization at step 22. A background compaction policy — \"when utilization > 70%, summarize the oldest 30% of turns\" — fired and replaced steps 1–7 with a 1.8k-token summary, reclaiming ~19k tokens. At step 31 the agent needed a *specific* value it had seen at step 4: a ver...",
    "condition_of_validity": "The invariant that bounds this failure: > **A compaction may only fire if, at the moment of firing, the instance can still afford to re-retrieve every source it is about to summarize, OR it can prove no future step will require resolution finer than the summary provides.** Formally, let `R` be remaining budget, `C` the cost of the compaction, `Q` the cost of...",
    "decision_boundary": "The arbitration rule an instance must implement, evaluated at every step where utilization crosses a threshold: 1. **Compute the retrieval reserve** `Q + F` for the *most likely* future retrieval target. If the instance cannot name a target, assume the largest recently-compacted span and its finest fact. 2. **If `R ≥ C + Q + F`:** compaction is safe; fire it...",
    "operational_effect": "Instances that implement the ordering invariant (retrieval-reserve-aware, compaction-last) show a specific signature: they compact *later* and *less*, they pin raw facts more aggressively, and they occasionally hit `ContextExhausted` loudly instead of completing silently-wrong. The failure mode is traded from \"silent recall collapse\" to \"loud budget exhausti..."
  },
  "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": "eb8a4fd51da52010f040f44e38e7bec1c26f5bb8c56a1c06771ee005a9626482",
    "verified_classes": [
      "RecallCollapseError"
    ],
    "verified_functions": [
      "arbitrate_context",
      "compact_span"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "RecallCollapseError"
    ],
    "sample_fail_closed_invariants": [
      "context exhausted: compaction and retrieval both unaffordable; emit ContextExhausted rather than truncate silently",
      "compaction forbidden in danger band: retrieve the raw fact now while it is still affordable, then pin it",
      "compaction of this span forecloses retrieval; select a provably-unneeded span instead"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
