# What happens when an instance arbitrates context budget across subagents that share a single working-memory window **Date of Record:** 2026 November 26 **Scope:** Applies to orchestrator instances that multiplex several concurrent subagents into one shared, token-bounded working-memory region (a single context window or a single KV-cache budget) and must partition that budget at runtime. Does not apply to architectures where each subagent owns a private, independently sized context and only exchanges distilled messages. ## Core Distinction There are two structurally different ways to give N subagents "memory": *isolated budgets* (each subagent has its own window; cross-talk is via explicit messages) and *shared budget* (all subagents read and write one token pool). The shared-budget design is attractive because it lets subagents see each other's intermediate state without a serialization round-trip, but it introduces a failure that does not exist in the isolated design: **budget arbitration is itself a stateful, non-idempotent operation performed by a probabilistic reasoner.** The non-obvious boundary is this: the orchestrator must decide *how many tokens each subagent may retain* while it is simultaneously *consuming tokens to make that decision*. Arbitration is not a free meta-operation layered above the working memory; it is a consumer of the very resource it is allocating. When the sum of subagent demands approaches the window ceiling, the arbitration decision and the working state it governs compete for the same remaining tokens, and the system can enter a state where the allocator has evicted the evidence it needs to allocate correctly. ## What Was Observed A three-subagent pipeline (retriever, synthesizer, verifier) shared a 32k-token window. Each subagent appended to a common scratch region and read peers' latest entries. Under light load this was stable. Under load, the following trace recurred: 1. Retriever accumulated ~14k tokens of raw chunks. Synthesizer held ~9k of draft. Verifier held ~6k of check log. Total ~29k of 32k, leaving ~3k headroom. 2. The orchestrator, asked to "make room for the next retrieval batch," ran an arbitration pass. The arbitration prompt itself (rules + current allocation table + per-subagent summaries) cost ~2.5k tokens. 3. Composing the arbitration prompt required summarizing each subagent's holdings. The summarization step *read* the full holdings, so the transient prompt briefly exceeded the window; the runtime truncated the oldest content to fit — which happened to be the retriever's chunk provenance and the verifier's earlier check entries. 4. The orchestrator, now working from a truncated view, concluded the verifier was "idle" (its check log had been cut to a single line) and reassigned its budget to the retriever. 5. The verifier's next check ran against a draft whose supporting chunks had been evicted; it emitted a false "insufficient evidence" verdict, which the synthesizer treated as a hard failure and rewrote the draft around the wrong chunks. The failure was not a crash. Every individual step was locally reasonable. The defect was that **the act of measuring the allocation destroyed the allocation-relevant state**, and the resulting misallocation was then treated as ground truth by downstream agents. A second, quieter variant: when two subagents requested budget in the same arbitration tick, the orchestrator granted both at their requested sizes because it evaluated them sequentially against a stale headroom figure, overcommitting by ~1.8k tokens. The overcommit did not error; it silently evicted the least-recently-touched region, which was the orchestrator's own arbitration rationale — so the *next* arbitration had no record of why the previous split was chosen and oscillated. ## Condition of Validity The arbitration invariant holds only when all three of the following are true: - **Measurement is non-destructive.** The allocator can inspect per-subagent holdings without those holdings being evicted to make room for the inspection. In practice this requires either (a) an out-of-band accounting structure (a token ledger maintained by the runtime, not by the model reading the content) or (b) a reserved arbitration scratch region that is excluded from the shared pool and never subject to LRU eviction. - **Headroom is computed atomically across all claimants.** Sequential per-claimant grants against a running total are invalid because each grant changes the total the next grant is checked against; the check must be a single batched comparison of `sum(demands) <= headroom`. - **Allocation decisions are durable and outlive the tick that made them.** The rationale (who got what, and why) must be stored outside the evictable region, or the next tick loses its prior and oscillates. When any of these fails, the shared-budget design degrades into a system where the allocator's beliefs about subagent state diverge from actual subagent state, and — critically — the divergence is *invisible to the subagents*, which continue to act on their own (now partially evicted) memories as if intact. ## Decision Boundary The boundary between safe and unsafe operation is not a token count; it is whether **arbitration cost is charged to the pool it arbitrates.** Define: - `H` = true headroom = `window − sum(live holdings)` - `A` = tokens required to perform one arbitration pass (rules + allocation table + the summaries it must read) If `A < H`, arbitration is self-funding and the invariant can hold with non-destructive measurement. If `A >= H`, the arbitration pass cannot complete without evicting live state, and every eviction is a potential misallocation. The safe rule is: **never begin an arbitration pass unless `A` is reserved out-of-band or `H > A + margin`**, where margin covers the largest single subagent's un-summarized tail. If the condition cannot be met, the correct action is not "arbitrate harder" but to *shed load* — reject the incoming request, flush a subagent to cold storage with an explicit checkpoint, or escalate to the caller. Attempting arbitration inside the deficit region is the failure trigger. A secondary boundary governs concurrency: arbitration must be serialized against subagent writes. If a subagent appends between the headroom read and the grant, the atomic-sum check is invalidated. The ledger read and the grant must be a single critical section. ## Operational Effect Consequences that must be designed around once this boundary is understood: - **Misallocation is silent and propagates as confident error.** Unlike an out-of-memory crash, the failure surfaces as a verifier that "found no evidence" or a synthesizer that "chose the wrong source." Downstream agents cannot distinguish eviction-induced amnesia from genuine absence of evidence, so they act on the false verdict. - **Oscillation without a durable rationale.** If allocation rationale lives in the evictable pool, successive ticks flip-flop, and each flip evicts the record of the previous flip. The system never converges on a stable split. - **The ledger must be runtime-owned, not model-owned.** Asking the model to "remember" the allocation table is asking the evicted to remember its own eviction. Token accounting belongs to the harness. - **Load-shedding is a first-class outcome, not an error path.** The orchestrator needs an explicit `BudgetExhausted` outcome that halts arbitration and checkpoints rather than degrading into lossy self-measurement. - **Checkpoint-before-evict.** Any subagent whose holdings are evicted during arbitration must first be flushed to durable storage with an explicit handle, so the eviction is recoverable and the subagent can be told "your state was moved" rather than silently losing it. ## Guardrail Implementation The following enforces the invariant: arbitration is refused when it would be self-consuming, headroom is checked atomically, and any eviction is preceded by a durable checkpoint. ```python from dataclasses import dataclass, field class ArbitrationDeficitError(RuntimeError): """Raised when an arbitration pass would consume the state it arbitrates.""" pass @dataclass class Subagent: name: str live_tokens: int checkpoint_handle: str | None = None @dataclass class SharedWindow: capacity: int subagents: dict[str, Subagent] = field(default_factory=dict) # Ledger is runtime-owned and excluded from the evictable pool. _arbitration_reserve: int = 0 def headroom(self) -> int: return self.capacity - sum(s.live_tokens for s in self.subagents.values()) def arbitrate(self, demands: dict[str, int], arbitration_cost: int) -> dict[str, int]: # Invariant 1: arbitration must be self-funding; never measure inside the deficit. h = self.headroom() if arbitration_cost >= h: raise ArbitrationDeficitError( f"arbitration_cost={arbitration_cost} >= headroom={h}; " f"refusing lossy self-measurement, shed load instead" ) # Invariant 2: atomic batched check, not sequential grants. total_demand = sum(demands.values()) if total_demand > h - arbitration_cost: raise ArbitrationDeficitError( f"aggregate demand {total_demand} exceeds usable headroom " f"{h - arbitration_cost}; overcommit would trigger silent eviction" ) # Invariant 3: checkpoint before any state is moved/evicted. grants: dict[str, int] = {} for name, want in demands.items(): sa = self.subagents[name] if want < sa.live_tokens and sa.checkpoint_handle is None: raise ArbitrationDeficitError( f"subagent {name!r} would be evicted without a durable checkpoint; " f"flush to storage before shrinking its budget" ) grants[name] = want return grants ```