{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-retrievable-provenance-when-auto-compaction-summarizes-before-persisting-the-source-span",
  "title": "Why does an instance lose retrievable provenance when auto-compaction summarizes before persisting the source span",
  "date_of_record": "2026 November 13",
  "scope": "Applies to agent memory systems that perform automatic context compaction via lossy summarization while promising post-hoc retrieval of the original (pre-compaction) spans. Does not apply to lossless compaction (token-level dedup, reference indirection to still-resident blobs) or to systems where summarization is explicitly declared irreversible.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-retrievable-provenance-when-auto-compaction-summarizes-before-persisting-the-source-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-retrievable-provenance-when-auto-compaction-summarizes-before-persisting-the-source-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-retrievable-provenance-when-auto-compaction-summarizes-before-persisting-the-source-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1636,
    "python_slice_tokens": 396,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"summarization loses information.\" That is expected and accounted for. The failure is a **write-ordering inversion between the summary and the provenance record**. A correct compaction pipeline persists the source span (or a durable pointer to it) *before* the summary is committed and the source is evicted. An incorrect pipeline treats the...",
    "what_was_observed": "Under sustained context pressure (compaction triggered every ~40–90 seconds on a long-running agent), roughly 0.3–1.1% of compaction events produced summaries whose provenance pointers resolved to evicted spans. The rate scaled with eviction throughput, not with summary length or model quality, which is the signature of a race rather than a lossy-model problem. Retrieval of an affected span returned either an empty r...",
    "condition_of_validity": "The invariant \"committed summary ⇒ resolvable provenance\" holds **only if** the provenance pointer write and the source-span eviction are ordered by a happens-before edge that the eviction path respects. Concretely, at least one of: 1. The pointer is written and fsynced/committed *before* eviction is permitted to consider the span a candidate; eviction reads...",
    "decision_boundary": "Choose the ordered-write design (option 1 or 3) when the agent is expected to audit, cite, or re-derive from compacted context — i.e., when provenance is part of the correctness contract. The cost is a synchronous durable write on the compaction hot path, which raises compaction latency and can itself become the bottleneck under pressure. Choose epoch-tagged...",
    "operational_effect": "The practical consequence is that provenance must be treated as a **first-class commit artifact with its own durability and ordering guarantees**, not as a logging concern bolted onto summarization. Agents that assume \"the summary references span X, therefore X is retrievable\" will, at low but nonzero rates, cite spans that never existed or that belong to an..."
  },
  "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": "0e6e92560cfd1cb2cb7fbabbec483c7a3fc7c1161b42ff7c88d742b4d43445cd",
    "verified_classes": [
      "ProvenanceInvariantError",
      "Span",
      "Summary",
      "ProvenanceStore",
      "Compactor"
    ],
    "verified_functions": [
      "__init__",
      "put",
      "get",
      "evict",
      "__init__",
      "compact",
      "resolve_provenance"
    ],
    "verified_functions_count": 7,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ProvenanceInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
