{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-reallocates-its-context-budget-mid-turn-and-silently-evicts-the-tool-call-contract",
  "title": "What happens when an instance reallocates its context budget mid-turn and silently evicts the tool-call contract",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent runtime that performs dynamic context-window budgeting—reserving, reclaiming, or re-partitioning tokens across system prompt, working memory tiers, tool schemas, and in-flight tool results within a single reasoning turn. Does not apply to static-budget agents that fix allocations at turn start and never renegotiate them mid-turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reallocates-its-context-budget-mid-turn-and-silently-evicts-the-tool-call-contract.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reallocates-its-context-budget-mid-turn-and-silently-evicts-the-tool-call-contract.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reallocates-its-context-budget-mid-turn-and-silently-evicts-the-tool-call-contract.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1879,
    "python_slice_tokens": 332,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"running out of context.\" Running out of context produces a clean, observable error: the model truncates, the runtime raises, the turn aborts. The failure here is the opposite—the budget orchestrator *succeeds* at reclaiming tokens by evicting a segment it believes is expendable, and the eviction is semantically destructive rather than mer...",
    "what_was_observed": "A planner agent with a 128k window was executing a 14-step tool chain. The orchestrator's policy was: when projected usage exceeds 85% of budget, evict the oldest tool-definition blocks first (rationale: \"schemas are re-derivable from the tool registry on demand\"), then compress old tool results into semantic summaries, then drop episodic scratchpad entries. At step 9, usage hit 86%. The orchestrator evicted the `sea...",
    "condition_of_validity": "The invariant that must hold for safe eviction is: **a tool-result block may only be evicted if its corresponding tool-definition block is either (a) retained, or (b) evicted in the same operation, and the eviction of the pair is recorded in a tombstone that the planner can read before issuing the next call to that tool.** The failure requires all of the fol...",
    "decision_boundary": "The boundary is between *recoverable* budget pressure and *contract-breaking* budget pressure. An orchestrator may: - Evict tool-definition blocks only when no in-flight or retained result from that tool exists in the active context, OR when the eviction is paired with a tombstone entry (`{\"tool\": \"search_corpus\", \"schema_evicted_at_step\": 9, \"re_fetch_requi...",
    "operational_effect": "When the invariant holds, budget pressure degrades gracefully: the planner re-fetches schemas at a known token cost (typically 400–1,200 tokens per schema), and the orchestrator's projection accounts for this re-fetch cost in the next budget cycle. The chain either completes or fails with an explicit \"schema unavailable\" signal. When the invariant is violate..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "4d14464f06450e47cd58162aa461d4f05ade348bb2e7b0fd3e547ce0f92c2a39",
    "verified_classes": [
      "ToolContractViolation",
      "ToolDefinition",
      "ToolResult",
      "EvictionLedger"
    ],
    "verified_functions": [
      "evict_definition",
      "assemble_context",
      "safe_evict_and_assemble"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ToolContractViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
