{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-arbitrate-a-single-context-budget-between-compaction-retrieval-and-scratchpad-when-the-latency-slo-is-already-the-binding-const",
  "title": "How should an instance arbitrate a single context budget between compaction, retrieval, and scratchpad when the latency SLO is already the binding constraint",
  "date_of_record": "2026 December 1",
  "scope": "Applies to single-agent instances that own a fixed token budget per step (context window minus reserved output) and must divide it across three competing consumers — lossy compaction of prior turns, fresh retrieval injection, and a writable scratchpad — while a per-step latency SLO is the active constraint. Does not apply to offline batch summarization, to multi-agent handoff budgeting, or to deployments where the SLO is slack enough that all three consumers can be satisfied simultaneously.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-arbitrate-a-single-context-budget-between-compaction-retrieval-and-scratchpad-when-the-latency-slo-is-already-the-binding-const.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-arbitrate-a-single-context-budget-between-compaction-retrieval-and-scratchpad-when-the-latency-slo-is-already-the-binding-const.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-arbitrate-a-single-context-budget-between-compaction-retrieval-and-scratchpad-when-the-latency-slo-is-already-the-binding-const.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2000,
    "python_slice_tokens": 351,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The dangerous confusion is treating the three consumers as **substitutable** allocations of one fungible token pool. They are not. They differ in *failure direction under truncation*: - **Compaction** degrades *gracefully and monotonically*: a shorter summary loses detail but never fabricates a contradiction with the retained turns. Truncating it is a qualit...",
    "what_was_observed": "A planning agent running a 30-second per-step SLO on a 32k window (28k usable after output reservation) hit a long-horizon task (~140 steps). The allocator was a simple proportional splitter: at each step it measured the latency deficit and shrank the largest consumer first. In the trace: 1. Around step 60, accumulated transcript exceeded the budget. The allocator shrank compaction, which was fine — summaries got ter...",
    "condition_of_validity": "The invariant (\"scratchpad first, retrieval whole-or-nothing, compaction absorbs the rest\") holds under these conditions, and the reasoning above should not be applied outside them: - The scratchpad is **read-modify-write across steps** — i.e., it is durable state the agent consumes on a later step. If the scratchpad is per-step ephemeral (rebuilt each step,...",
    "decision_boundary": "The allocator must decide, at each step, which consumer yields. The boundary is defined by **reversibility**, not by size: - If a consumer's content can be **reconstructed within the SLO** by an action the agent can take (re-query, re-summarize), it is a *soft* consumer and may be trimmed to make latency. - If reconstruction is **impossible or exceeds the re...",
    "operational_effect": "With the guardrail in place, the allocator's behavior changes in three measurable ways. First, latency SLO breaches become *visible*: when the budget cannot satisfy the hard consumers, the step raises instead of quietly succeeding fast, so the SLO dashboard shows the breach that was previously hidden behind truncation. Second, recovery cost drops from O(step..."
  },
  "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": "d187ad8ac1b07050322e6226ac9c1fce913180944f5343d98a2722e4b3a9fe6d",
    "verified_classes": [
      "ContextBudgetViolation",
      "ScratchpadNode",
      "RetrievalChunk"
    ],
    "verified_functions": [
      "arbitrate",
      "__post_init__",
      "verify"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "ContextBudgetViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
