{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-fidelity-at-the-context-window-safe-boundary-even-when-token-count-is-under-budget",
  "title": "Why does an instance lose tool-call fidelity at the context-window “safe” boundary even when token count is under budget?",
  "date_of_record": "2026 November 28",
  "scope": "Applies to single-instance agents executing long-horizon, multi-tool tasks where the runtime performs attention-aware context layout (reordering, pinning, or summarization of segments) and enforces a token budget. Does not apply to stateless single-turn inference or to agents whose entire working set fits in a single non-truncated window with no layout optimization.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-fidelity-at-the-context-window-safe-boundary-even-when-token-count-is-under-budget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-fidelity-at-the-context-window-safe-boundary-even-when-token-count-is-under-budget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-fidelity-at-the-context-window-safe-boundary-even-when-token-count-is-under-budget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1777,
    "python_slice_tokens": 406,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Token budget is a *capacity* invariant. Attention layout is a *positional salience* invariant. A context can satisfy the first and violate the second. The boundary failure examined here is not overflow — it is **displacement**: the runtime keeps total tokens under budget by relocating a critical instruction (a tool schema, a negative constraint, a pinned sys...",
    "what_was_observed": "A long-horizon agent (≈40 tool calls, mixed retrieval and write operations) was configured with a 128k window, a 96k soft budget, and a layout optimizer that (a) pins the system prompt at the head, (b) summarizes tool results older than N turns into a rolling digest placed at the *tail* before the current turn, and (c) reorders retrieved chunks by recency. At turn 31 the agent had consumed ~71k tokens — well under th...",
    "condition_of_validity": "The safe-budget guarantee is valid only when **all** of the following hold: - Every instruction whose violation is irreversible (destructive writes, credential use, external side effects, safety constraints) is classified as *pinned-salient*, not merely *present*. - Pinned-salient segments are exempt from summarization and from positional relocation across t...",
    "decision_boundary": "The boundary is not a token number; it is the **first layout operation that touches a pinned-salient segment**. Before that operation, budget headroom is a meaningful proxy for fidelity. After it, headroom measures only unused capacity, and fidelity must be verified independently. Operationally: treat the moment a constraint-bearing segment becomes eligible ...",
    "operational_effect": "Concrete consequences when the invariant is unenforced: - **Silent constraint decay.** Irreversible-violation risk grows monotonically with horizon length while budget telemetry stays green, so alerting on budget never fires. - **False headroom.** Teams add tasks to fill \"available\" budget, accelerating the summarization of the very constraints that bound ri..."
  },
  "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": "0f48d788b53cf20741651481217e02add2c2c4dbf9eae3b3539a1a35ac6a9ad4",
    "verified_classes": [
      "LayoutViolation",
      "Salience",
      "Segment",
      "ContextLedger"
    ],
    "verified_functions": [
      "plan_layout",
      "execute",
      "total_tokens",
      "register",
      "demote",
      "assert_action_allowed"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "LayoutViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
