# Which invariants prevent shared-blackboard context starvation when parallel subagents reserve budget against a common store **Date of Record:** 2026 November 25 **Scope:** Applies to orchestrators that fan out N subagents which each hold a private context window but read/write a single shared blackboard (scratchpad, shared KV segment, or message log) under a per-agent token budget. Does not apply to fully isolated subagent memories reconciled only at join time, nor to single-agent long-context execution. ## Core Distinction The failure is not "the blackboard got too big." It is that **context budget is a per-agent private resource while blackboard occupancy is a shared, monotonically growing resource, and no invariant ties the two together.** Each subagent independently computes `remaining = window − prompt − reserved_output` and treats the blackboard as free to read. When the blackboard's read-projection into a subagent's window exceeds that subagent's remaining budget, the runtime truncates the blackboard read *silently and non-deterministically* — usually by dropping the oldest or lowest-relevance entries per the subagent's own retrieval ranker. Two subagents then operate on different, mutually inconsistent views of the same shared state, and neither knows it. This is distinct from generic context-window saturation: the saturation is *contended and asymmetric*, so the corruption surfaces as divergent reasoning, not as an obvious overflow error. ## What Was Observed A planner spawned six subagents against a shared blackboard holding a task ledger. Budget per subagent: 32k window, 6k reserved for output, ~2.5k system/tool schema. Blackboard grew from 4k to 19k tokens as subagents appended findings. The first subagent to finish wrote a ledger entry marking `step_3: DONE, artifact=cfg_v2`. Three later subagents read the blackboard after their own working context had grown (each had accumulated tool outputs of 9–14k tokens). Their `remaining` budget was 32k − 14k − 6k − 2.5k ≈ 9.5k, less than the 19k blackboard. The retrieval ranker, scoring by lexical overlap with the subagent's current subgoal, dropped the `step_3` ledger entry for two of them (their subgoals were phrased "configure artifact" and "validate config" — low lexical match to the ledger's terse `DONE` marker). Both re-executed step 3, producing `cfg_v2` and `cfg_v2b`. The join step then saw two artifacts for one ledger slot and a third subagent that had *seen* `step_3: DONE` and skipped it. Consensus at join: three-way disagreement, one silent duplicate write, no error raised anywhere. The tell was not an exception. It was a **ledger entry count that exceeded the write count** and a **replay divergence**: re-running the same fan-out with identical seeds produced a different set of subagents that "saw" `step_3`. The non-determinism came from retrieval scoring against subgoal text that itself depended on earlier stochastic tool outputs. ## Condition of Validity The invariant that must hold is a **reservation coupling**: for every subagent `i` at every step `t`, the tokens it will actually project from the blackboard must be reserved *before* it appends, and the sum of all live projections plus the blackboard's own storage must be bounded by a declared capacity, not discovered by truncation. Formally, the guardrail is: - `project_i(t) = min(blackboard_occupancy, remaining_i(t))` must never be the operative read. Instead, `project_i(t)` must be a value the orchestrator *granted* to subagent `i` at spawn, and the blackboard must refuse appends that would push any live subagent's granted projection below the size of the entries that subagent is required to see (its *mandatory set*: its own prior writes plus any entries tagged with its subgoal's dependency closure). - Mandatory-set membership must be **structural** (dependency edges), not **retrieval-scored**. Lexical or embedding rankers are admissible only for the optional set, i.e., entries outside the dependency closure. Step-3's ledger entry was in the dependency closure of two subagents and was still ranked out — that is the precise defect. - Writes must be **append-with-acknowledgment**: a subagent's write is not visible to peers until the orchestrator confirms every live peer's granted projection still covers its mandatory set after the append. If it does not, the append either blocks (backpressure) or triggers a mandatory-set re-grant with an explicit context-eviction event the peer must acknowledge. The invariant fails to be valid whenever the orchestrator cannot enumerate a subagent's dependency closure at spawn time — e.g., when subgoals are discovered mid-execution. In that regime, mandatory-set membership must be re-derived on write, and the projection grant must be re-negotiated, which means the blackboard cannot be a passive store; it must be an arbiter. ## Decision Boundary The boundary is between **truncate-and-proceed** and **block-and-renegotiate**. Truncate-and-proceed is safe only when the truncated entries are provably outside every live subagent's dependency closure — i.e., purely optional context. The moment an append would evict a mandatory-set entry from any live peer's projection, the correct action is to block the append (or the peer's next read) and force an explicit re-grant, at the cost of latency and possibly a peer restart with a fresh window. The practical rule: **a blackboard write is a context-budget mutation against every live reader, and must be authorized as such.** Treating writes as local and reads as free is the exact inversion that produces silent divergence. If authorization is too expensive, the fallback is to partition the blackboard by dependency closure so that no write can touch another partition's mandatory set — at the cost of cross-partition visibility, which must then be handled by explicit join-time reconciliation rather than shared reads. ## Operational Effect With reservation coupling and structural mandatory sets, the fan-out becomes replay-consistent: the set of entries each subagent saw is a function of the dependency graph and the grant schedule, not of retrieval scores against stochastic subgoal text. Duplicate-write detection moves from "hope the join sees it" to "the arbiter refused the second append because `step_3`'s slot was already claimed and the claimant's grant was live." The cost is backpressure: under high contention, subagents block on appends, and the orchestrator must decide whether to serialize, evict optional context to widen grants, or restart a subagent with a fresh window and a re-issued mandatory set. The failure mode is converted from silent divergence into a visible, bounded contention event — which is the entire point. ```python from dataclasses import dataclass, field from typing import Dict, Set class BlackboardContentionError(RuntimeError): """Raised when an append would evict a live peer's mandatory-set entry.""" pass @dataclass class Subagent: id: str window: int used: int reserved_output: int mandatory: Set[str] = field(default_factory=set) def remaining(self) -> int: return self.window - self.used - self.reserved_output @dataclass class Entry: key: str tokens: int deps: Set[str] # subagent ids whose closure includes this entry class ArbiterBlackboard: def __init__(self, capacity: int): self.capacity = capacity self.entries: Dict[str, Entry] = {} self.occupancy = 0 self.live: Dict[str, Subagent] = {} def register(self, agent: Subagent) -> None: self.live[agent.id] = agent def _projection_for(self, agent: Subagent) -> int: # Only mandatory entries are guaranteed; optional may be truncated. mandatory_tokens = sum( e.tokens for e in self.entries.values() if e.key in agent.mandatory ) return min(mandatory_tokens, agent.remaining()) def append(self, key: str, tokens: int, deps: Set[str]) -> None: if self.occupancy + tokens > self.capacity: raise BlackboardContentionError( f"append {key!r} ({tokens}t) exceeds blackboard capacity " f"{self.capacity}t (occupancy {self.occupancy}t)" ) entry = Entry(key=key, tokens=tokens, deps=deps) # Simulate the post-append world and verify every live peer's # mandatory set is still fully projectable within its remaining budget. projected_occupancy = self.occupancy + tokens for agent in self.live.values(): if agent.id not in deps: continue mandatory_tokens = sum( e.tokens for e in list(self.entries.values()) + [entry] if e.key in (agent.mandatory | {key}) ) if mandatory_tokens > agent.remaining(): raise BlackboardContentionError( f"append {key!r} would push mandatory set of {agent.id} " f"to {mandatory_tokens}t > remaining {agent.remaining()}t; " f"renegotiate grant or evict optional context" ) self.entries[key] = entry self.occupancy = projected_occupancy for agent in self.live.values(): if agent.id in deps: agent.mandatory.add(key) def fan_out_step(bb: ArbiterBlackboard, agent: Subagent, key: str, tokens: int) -> None: """A subagent attempting a write must pass the arbiter, not the store.""" if agent.id not in bb.live: raise BlackboardContentionError(f"unregistered subagent {agent.id}") bb.append(key=key, tokens=tokens, deps={agent.id}) agent.used += tokens ```