{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-schema-fidelity-when-auto-compaction-rewrites-the-middle-of-a-long-horizon-context",
  "title": "Why does an instance lose tool-schema fidelity when auto-compaction rewrites the middle of a long-horizon context",
  "date_of_record": "2026 November 25",
  "scope": "Applies to agents that trigger context auto-compaction (summarize-and-replace) mid-execution while holding live tool-call obligations, partial plans, or unresolved argument bindings. Does not apply to stateless single-turn invocations or to compaction performed only at task boundaries after all tool calls have resolved.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-schema-fidelity-when-auto-compaction-rewrites-the-middle-of-a-long-horizon-context.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-schema-fidelity-when-auto-compaction-rewrites-the-middle-of-a-long-horizon-context.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-schema-fidelity-when-auto-compaction-rewrites-the-middle-of-a-long-horizon-context.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1723,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Compaction is usually modeled as a *lossy compression of history*: the agent trades token budget for recall, and the only failure mode considered is \"the summary forgot something.\" That framing is wrong for long-horizon agents. The real boundary is that compaction is a **rewrite of the execution substrate, not the transcript**. A tool call in flight is not t...",
    "what_was_observed": "A planning agent on a 40-step inventory-reconciliation task issued a `reserve_stock(sku, quantity, warehouse_id)` call at turn 19. The tool was slow (warehouse API p99 ~ 12s). At turn 21, while the call was still pending, the context crossed the 70% budget watermark and the auto-compaction policy fired. The compactor summarized turns 1–22 into a 900-token digest. The digest correctly reported: \"Agent decided to reser...",
    "condition_of_validity": "The guardrail holds only under these conditions, and the article's claims are void outside them: - The agent runtime maintains a **pending-call ledger** separate from the conversational context, keyed by `tool_call_id`, storing the exact serialized arguments and the originating schema hash. Compaction operates on the context window only; the ledger is immuta...",
    "decision_boundary": "The decision the operator must encode is not \"how aggressive should summarization be\" but \"**what is the unit of compaction?**\" Two policies are defensible and one is not: - **Span-granular compaction (correct):** compaction operates on resolved spans between obligation boundaries. Budget pressure is relieved by digesting *completed* history. Cost: lower com...",
    "operational_effect": "With span-granular compaction plus the pending-call ledger, the observed failure rate on the reconciliation workload dropped from 3/50 runs to 0/50 over a 200-run replay. The cost was a 14% increase in mean context tokens (open calls pinned longer) and a 6% increase in compaction invocations, because boundaries had to snap forward past open calls. The double..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION",
    "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": "8b1ec7b2279bdc6c7edfd54ddfd66837f92e69b2f4a8e274c6ce0e3a2dd5f31e",
    "verified_classes": [
      "CompactionBoundaryError",
      "Obligation",
      "PendingLedger"
    ],
    "verified_functions": [
      "snap_compaction_boundary",
      "compact",
      "open",
      "resolve",
      "open_spans"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
