{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-a-session-that-is-mid-flight-through-a-multi-step-tool-chain",
  "title": "Why does an instance lose tool-call provenance when auto-compaction summarizes a session that is mid-flight through a multi-step tool chain",
  "date_of_record": "2026 November 20",
  "scope": "Applies to long-horizon agent sessions that use automatic context compaction (lossy summarization of prior turns) while a multi-step tool chain is in flight. Does not apply to sessions that compact only at quiescent turn boundaries, nor to stateless single-shot invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-a-session-that-is-mid-flight-through-a-multi-step-tool-chain.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-a-session-that-is-mid-flight-through-a-multi-step-tool-chain.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-a-session-that-is-mid-flight-through-a-multi-step-tool-chain.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2025,
    "python_slice_tokens": 251,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent session holds: **narrative state** (the reasoning trace, the user's intent, the plan) and **provenance state** (the exact arguments passed to each tool, the raw outputs, the call IDs, and the causal ordering that binds a later step to an earlier one). Auto-compaction is designed around narrative state—it p...",
    "what_was_observed": "A reservation agent ran a five-step chain: `lookup_sku → check_stock(warehouse) → reserve(items, qty, hold_id) → confirm(hold_id) → notify`. The session crossed the compaction threshold (a fixed token budget) between `check_stock` returning and `reserve` being issued. The compactor, running a \"summarize the conversation so far, preserving the plan and key findings\" prompt, produced a summary that read: > The user wan...",
    "condition_of_validity": "The invariant that makes compaction safe is: **compaction may run only at a quiescent point, defined as a turn boundary where every tool call in the transcript has a corresponding consumed result and no value produced by a prior step is still pending downstream consumption.** Formally, for the chain of tool calls `c_1 ... c_n`, compaction at position `k` is ...",
    "decision_boundary": "The boundary is not \"compact or don't.\" It is **whether the compaction boundary is placed at a quiescent point and whether the summary schema distinguishes narrative from provenance.** - If the next tool call's arguments can be fully derived from the plan and the user's stated intent *without reference to any prior tool output*, compaction is safe at that bo...",
    "operational_effect": "Without the guardrail, the failure is silent and load-dependent. The orphaned hold, the diverged search, the double reservation—none raise an exception at the agent layer. They manifest as downstream inconsistencies that surface only under concurrency, retries, or reconciliation. The agent's own transcript looks coherent because the summary is coherent; the ..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "b4246a1f9f83b444fd2c72b7b1089b8b3b2b2aac9f5ce3aec5a7187ef157e74e",
    "verified_classes": [
      "CompactionProvenanceError"
    ],
    "verified_functions": [
      "compact_session"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
