{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-prune-a-tool-schema-mid-turn-the-argument-residency-invariant-in-multi-turn-context-engineering",
  "title": "When must an instance refuse to prune a tool schema mid-turn: the argument-residency invariant in multi-turn context engineering",
  "date_of_record": "2026 November 13",
  "scope": "Applies to agent runtimes that dynamically prune or compress tool schemas between turns of a multi-turn session while retaining prior tool-call arguments in the conversation context. Does not apply to single-turn stateless invocations, nor to runtimes that re-fetch the full schema set on every turn with no cross-turn argument retention.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-prune-a-tool-schema-mid-turn-the-argument-residency-invariant-in-multi-turn-context-engineering.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-prune-a-tool-schema-mid-turn-the-argument-residency-invariant-in-multi-turn-context-engineering.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-prune-a-tool-schema-mid-turn-the-argument-residency-invariant-in-multi-turn-context-engineering.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1717,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct notions of \"tool availability\" that are routinely conflated by pruning heuristics: **schema residency** (the tool's JSON schema is present in the prompt this turn) and **argument residency** (the arguments of a prior call to that tool are still present in the conversation history and may be referenced, amended, or re-invoked by the mod...",
    "what_was_observed": "In a multi-turn session with 14 tools, a frequency-based pruner demoted `update_incident` (a low-frequency, high-blast-radius mutation tool) after turn 6 because it had not been called since turn 2. The schema was removed from the prompt; the turn-2 call record — including its `severity: \"SEV-2\"`, `assignee_id`, and a `notify: true` flag — remained in the conversation history. At turn 9 the model was asked to \"bump t...",
    "condition_of_validity": "The argument-residency invariant holds under these conditions, and the failure is *not* expected outside them: - **Cross-turn argument retention is enabled.** If the runtime strips prior tool-call arguments when a tool is pruned, the ghost-tool failure cannot occur (though the model may still hallucinate a call from memory — a different, milder failure). - *...",
    "decision_boundary": "The operational rule is a two-part gate evaluated per tool per turn: 1. **Evict-or-tombstone.** If `argument_residency(tool) == True` and `schema_residency(tool) == False`, the pruner must either (a) evict the prior arguments along with the schema, or (b) insert a tombstone into the context: a one-line record stating the tool exists, its schema is withheld, ...",
    "operational_effect": "Implementing the evict-or-tombstone gate eliminated the ghost-tool triad in the observed session class: mutation-tool validation errors dropped, and the duplicate-incident workaround disappeared because the model, reading the tombstone, requested re-expansion instead of reconstructing. The cost is a small, bounded increase in prompt tokens for tombstones on ..."
  },
  "matched_failure_symptoms": [
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "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": "0dba86e4bb157017af7eb1607b7e7af63cb89c887a827d4c045af48a5a15c7c5",
    "verified_classes": [
      "GhostToolInvariantError",
      "ToolContextState"
    ],
    "verified_functions": [
      "enforce_evict_or_tombstone",
      "plan_turn_pruning"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "GhostToolInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
