{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-learned-context-budget-allocation-as-a-hard-constraint-rather-than-an-advisory-hint",
  "title": "Under what conditions must an instance treat learned context-budget allocation as a hard constraint rather than an advisory hint",
  "date_of_record": "2026 November 15",
  "scope": "Applies to inference-time context assembly where a learned allocator (a policy model, bandit, or calibrated regressor) emits per-segment token budgets for system prompt, retrieved memory, and tool schemas. Does not apply to fixed-budget schemes, static truncation, or allocators whose outputs are re-validated against a tokenizer before dispatch.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-learned-context-budget-allocation-as-a-hard-constraint-rather-than-an-advisory-hint.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-learned-context-budget-allocation-as-a-hard-constraint-rather-than-an-advisory-hint.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-learned-context-budget-allocation-as-a-hard-constraint-rather-than-an-advisory-hint.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1131,
    "python_slice_tokens": 143,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A learned allocator produces a *predicted* token budget. The tokenizer produces an *actual* token count. These diverge in a way that is not symmetric across segment types. System prompt and retrieved memory are natural language: the allocator's training distribution covers them, and small mispredictions degrade gracefully because text is truncatable at sente...",
    "what_was_observed": "In a deployment assembling 40–60 tool schemas per request, the allocator reserved budgets in tokens computed by a heuristic estimator (whitespace-split times a constant) rather than the serving tokenizer. The estimator undercounted by 4–11% on schemas containing nested `oneOf`/`anyOf` constructs and by 2–3% on ordinary schemas. Under memory pressure, the assembler honored the allocator's budget exactly: it truncated ...",
    "condition_of_validity": "The invariant holds — learned budgets must be treated as hard upper bounds only when they are *tokenizer-exact* — under three simultaneous conditions: (1) the allocator's output unit is the serving tokenizer's token, verified at assembly time, not a proxy estimator; (2) truncation of any segment is schema-aware or prohibited, with over-budget segments causin...",
    "decision_boundary": "The decision is whether to (a) trust the allocator's number and cut, or (b) re-tokenize and, if over budget, return to the allocator with a corrected constraint. Choose (b) whenever the segment is structured (tool schemas, JSON memory records, code) or whenever the allocator's per-type calibration error exceeds the slack between predicted and actual. Choose ...",
    "operational_effect": "Treating the learned budget as advisory for structured segments and hard for prose segments eliminated the retry loop entirely: over-budget schemas triggered a single re-allocation pass with tokenizer-exact counts, costing one extra assembly round-trip (sub-10ms) in 3% of requests and removing the 0.4% failure class. The generalizable lesson is that learned ..."
  },
  "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": "8b166244fa3f9605b1d7174439adc51fb4361f97de05ee52044acc47296c3d5d",
    "verified_classes": [
      "BudgetInvariantViolation",
      "Segment"
    ],
    "verified_functions": [
      "enforce_budget",
      "assemble"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "BudgetInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
