{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-before-the-retrieval-index-is-rebuilt",
  "title": "Why does an instance lose tool-call provenance when auto-compaction summarizes before the retrieval index is rebuilt",
  "date_of_record": "2026 November 30",
  "scope": "Applies to long-running agent instances that use semantic auto-compaction (LLM-driven summarization) to reclaim context-window budget while relying on a retrieval-augmented reconstitution path (vector index over prior turns) to rehydrate dropped state. Does not apply to stateless single-turn invocations, nor to systems where compaction and index maintenance are committed atomically in the same transaction.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-before-the-retrieval-index-is-rebuilt.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-before-the-retrieval-index-is-rebuilt.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-tool-call-provenance-when-auto-compaction-summarizes-before-the-retrieval-index-is-rebuilt.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2111,
    "python_slice_tokens": 260,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"summarization loses detail.\" It is a **commit-ordering inversion** between two subsystems that each believe they own the durable record of the turn history: the compactor (which rewrites context in place) and the retrieval indexer (which holds the pointer-addressed ground truth that reconstitution depends on). When compaction runs *before...",
    "what_was_observed": "A coding agent running a multi-hour refactor task hit its context ceiling at turn ~410. The auto-compaction policy triggered with a summarization budget of 2,000 tokens per 8,000-token dropped span (a 4:1 compression ratio). It summarized turns 1–310 into a rolling digest and dropped the raw spans. The retrieval index, rebuilt on a 5-minute cron, had last refreshed at turn 405 — so it still held chunk IDs `c-0012` th...",
    "condition_of_validity": "This boundary is only reachable when all four hold simultaneously: - **Compaction is destructive and in-place** (raw spans are evicted, not archived to cold storage with a resolvable pointer). - **The retrieval index is eventually consistent** with respect to context mutation (refresh is asynchronous, cron-driven, or debounced). - **Summaries are not span-ad...",
    "decision_boundary": "The architectural guardrail is a **compaction-lineage join key** enforced at the retrieval boundary, not at the summarizer. The summarizer cannot be trusted to preserve provenance — it is a lossy projection by construction. The index must be the enforcer. Concretely: every chunk carries `(chunk_id, source_turn_range, content_hash, lineage_epoch)`. Every comp...",
    "operational_effect": "The observable consequence of getting this wrong is not amnesia — it is **confident mis-execution from orphaned retrieval**. Agents that lose state cold-start and re-explore; agents that mis-reconstitute act on stale signatures, stale file versions, and stale authorization scopes with full confidence, because the retrieved fragment carries no marker of its o..."
  },
  "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": "3ded7311792c2dce9389f8af1f7b25e8e74dea03e83e678f11de988334311f82",
    "verified_classes": [
      "ProvenanceSeveredError",
      "Chunk",
      "SupersessionRecord"
    ],
    "verified_functions": [
      "admit_chunk"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ProvenanceSeveredError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
