{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-context-budget-arbiters-from-double-spending-reclaimed-tokens-during-concurrent-compaction",
  "title": "Which invariants prevent context-budget arbiters from double-spending reclaimed tokens during concurrent compaction",
  "date_of_record": "2026 November 26",
  "scope": "Applies to orchestrators that run N concurrent sub-agents under a shared, hard token budget and reclaim tokens by compacting (summarizing, evicting, or truncating) segments of some agents' context while others are mid-generation. Does not cover single-agent context management, static pre-allocation without reclamation, or billing-metered quotas where overshoot is tolerated and reconciled post-hoc.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-context-budget-arbiters-from-double-spending-reclaimed-tokens-during-concurrent-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-context-budget-arbiters-from-double-spending-reclaimed-tokens-during-concurrent-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-context-budget-arbiters-from-double-spending-reclaimed-tokens-during-concurrent-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2458,
    "python_slice_tokens": 352,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the arbiter ran out of budget.\" It is that the arbiter *believed* it had budget it had already promised elsewhere. Compaction is an asynchronous, non-atomic operation: the arbiter decides to reclaim K tokens from agent A's history, but the reclaimed physical tokens only become available *after* the summarizer emits its replacement segment...",
    "what_was_observed": "A planner agent dispatches four sub-agents (A–D) against a 200k-token shared window with a 180k soft ceiling (20k reserved for the orchestrator's own reasoning and tool schemas). At t0 the ledger shows: A=70k, B=60k, C=40k, D=10k, orchestrator=15k, total=195k. Agent D requests a 30k expansion for a large retrieval synthesis. The arbiter sees total 195k against a 180k ceiling — overcommitted by 15k — and triggers comp...",
    "condition_of_validity": "The double-spend is only reachable when all of the following hold, which is exactly the regime of concurrent compaction under pressure: 1. **Reclamation is asynchronous relative to allocation.** If compaction is synchronous and blocking (arbiter freezes all grants until the summarizer returns), projection leakage is impossible. The bug requires a window wher...",
    "decision_boundary": "The arbiter must choose, per allocation request, between two accounting regimes, and the choice is not free: - **Pessimistic (commit-only) accounting:** free pool = physical ceiling − sum of *realized* agent footprints − sum of *committed* reservations. Pending compactions contribute zero. This is always safe. Its cost is throughput: during a compaction, no ...",
    "operational_effect": "With the invariant enforced, the failure trace above terminates at the C request: the arbiter sees `free = 32k` but `PENDING = 47k` is excluded, so `spendable = 0` (D's 30k already consumed the non-pending free). C's 12k request is *queued*, not granted. When A's compaction commits at 19k realized (11k shortfall), the 11k is charged to `PENDING` and C's queu..."
  },
  "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": "70f0533d107a5dc351bf3c7ae1547a9bf9f2fef941afd937f18966bb3f95ba14",
    "verified_classes": [
      "BudgetDoubleSpendError",
      "ContextBudgetArbiter"
    ],
    "verified_functions": [
      "grant_or_checkpoint",
      "__init__",
      "_spendable",
      "request",
      "begin_compaction",
      "commit_compaction",
      "reconcile"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "BudgetDoubleSpendError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
