{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-rewrites-the-transcript-mid-horizon",
  "title": "Why does an instance lose tool-call provenance when auto-compaction rewrites the transcript mid-horizon",
  "date_of_record": "2026 November 22",
  "scope": "Applies to long-horizon agents whose transcripts are auto-compacted (summarized, truncated, or re-distilled) while the task is still in flight, particularly when compaction is expected to preserve fidelity of prior tool invocations. Does not apply to single-turn calls, stateless RAG, or compaction performed only at task boundaries after final answer emission.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-rewrites-the-transcript-mid-horizon.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-rewrites-the-transcript-mid-horizon.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-rewrites-the-transcript-mid-horizon.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2061,
    "python_slice_tokens": 523,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct things an agent transcript carries: **semantic content** (what was learned, decided, or asserted) and **provenance** (which tool produced which artifact, under what arguments, at what point in the causal chain). Most auto-compaction algorithms optimize for semantic content — they summarize, deduplicate, and re-weight by recency or sali...",
    "what_was_observed": "A 40+ step agent, executing a multi-file refactor, ran under a compaction policy that triggered at 70% context utilization. At step 31 the compactor rewrote steps 1–22 into a 900-token summary. The summary contained the sentence: *\"Confirmed that `auth/session.py` imports `TokenStore` from `auth.store`.\"* That sentence was true at step 9. But at step 14 the agent had run a `sed`-equivalent edit tool that rewrote the ...",
    "condition_of_validity": "Compaction preserves fidelity **only when every retained assertion carries a resolvable provenance edge to a tool call whose effect is still reflected in the current world state.** Formally, for each retained claim `c` in the compacted transcript, there must exist a tool invocation `t` such that: - `t` is either retained verbatim or re-derivable from a retai...",
    "decision_boundary": "The boundary between safe and unsafe compaction is **whether the compaction policy is mutation-aware.** A compaction algorithm is mutation-aware if, before folding any span into summary, it computes the set of state-mutating tool calls in that span and either (a) retains them verbatim with their arguments and results, or (b) emits an explicit invalidation re...",
    "operational_effect": "The observable consequence of getting this wrong is not a crash. It is a **silent revert**: the agent confidently undoes its own correct work, then rationalizes the resulting failure as environmental. This is worse than amnesia because amnesia is detectable — a cold-start agent knows it does not know. A provenance-broken agent believes it knows, cites a tool..."
  },
  "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": "a7a872471028f3a70c1de651b0f7c52a7f430cfd294e0af066955834cdbcb3f5",
    "verified_classes": [
      "ProvenanceCompactionError"
    ],
    "verified_functions": [
      "compact_transcript",
      "_is_superseded",
      "_extract_tool_ids"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ProvenanceCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "re"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
