{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-budget-context-by-downstream-tool-call-risk-rather-than-by-token-count-alone",
  "title": "When must an instance budget context by downstream tool-call risk rather than by token count alone",
  "date_of_record": "2026 December 2",
  "scope": "Applies to single-agent or coordinator instances that hold a bounded context window, plan multi-step tool invocations, and evict prior turns to stay under a token ceiling. Does not apply to stateless one-shot inference, to agents with unbounded external memory that never evicts, or to pure retrieval-augmented pipelines where the retrieved set is fixed before generation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-budget-context-by-downstream-tool-call-risk-rather-than-by-token-count-alone.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-budget-context-by-downstream-tool-call-risk-rather-than-by-token-count-alone.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-budget-context-by-downstream-tool-call-risk-rather-than-by-token-count-alone.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1610,
    "python_slice_tokens": 288,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Token-count budgeting treats context as a homogeneous byte reservoir: evict the oldest or lowest-attention-scored span until `len(context) <= budget`. Risk-weighted budgeting treats context as a *dependency substrate for pending actions*: a span's eviction cost is the probability that its loss causes a downstream tool call to be malformed, unauthorized, or d...",
    "what_was_observed": "A coordinator agent with a 32k-token window was executing a 14-step remediation plan against a production cluster. At step 3 it read a scoped credential manifest and a resource-allowlist (roughly 400 tokens total, both old and low-attention by the time step 11 arrived). Between steps 3 and 11, nine verbose tool outputs (log dumps, `kubectl describe` blobs) pushed utilization to 31.6k tokens. The eviction policy—recen...",
    "condition_of_validity": "Risk-weighted eviction is required—and plain token budgeting is unsafe—if and only if all three hold: 1. **A pending action exists in the plan whose arguments or authorization depend on a specific context span.** This is a *dependency edge*, computable at plan time: for each planned call, the set of spans that constrain it. 2. **The action is irreversible or...",
    "decision_boundary": "The boundary is not \"how full is the window\" but \"is there an unexecuted call whose constraint set intersects the eviction candidate set.\" The decision procedure: - At plan time, annotate each step with `constrains: [span_ids]` and `risk: {reversible | irreversible}`. - Maintain a *pinned set* = union of `constrains` for all unexecuted irreversible steps. - ...",
    "operational_effect": "Implementing this boundary changes three observable behaviors. First, eviction decisions become *plan-coupled*: the evictor can no longer run as a stateless background process, because it must consult the pending-step dependency graph. Second, irreversible calls acquire a *precondition check*: before dispatch, the runtime verifies that every span in the call..."
  },
  "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": "7655471ce586d8f22c3f5b81715f7f86e18fd69363407d52db2721e9364adb9f",
    "verified_classes": [
      "ConstraintEvictedError",
      "Span",
      "PlannedCall"
    ],
    "verified_functions": [
      "pinned_span_ids",
      "evict_to_budget",
      "dispatch"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ConstraintEvictedError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
