{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-lossy-context-compaction-has-orphaned-a-provenance-pointer-before-rehydration-dereferences-it",
  "title": "How does an instance detect that lossy context compaction has orphaned a provenance pointer before rehydration dereferences it",
  "date_of_record": "2026 November 30",
  "scope": "Applies to any agent runtime that performs automatic context compaction (summarization of older turns to reclaim token budget) while retaining provenance pointers — message IDs, tool-call hashes, file:line anchors, or span offsets — into the pre-compaction transcript, and that supports *rehydration*: re-expanding a summary back into source material on demand. Does not apply to lossless compaction (verbatim truncation with full re-fetch), to external vector memory stores with independent lifecycle, or to single-turn stateless invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-lossy-context-compaction-has-orphaned-a-provenance-pointer-before-rehydration-dereferences-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-lossy-context-compaction-has-orphaned-a-provenance-pointer-before-rehydration-dereferences-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-lossy-context-compaction-has-orphaned-a-provenance-pointer-before-rehydration-dereferences-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1744,
    "python_slice_tokens": 330,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the summary is wrong.\" Summaries are *supposed* to be lossy — that is the contract. The failure is **provenance drift**: the summary retains a pointer to a source artifact whose identity changed after compaction but before rehydration. The pointer still *resolves* — it returns bytes — but the bytes are no longer what the pointer was minte...",
    "what_was_observed": "During a long tool-using task, an agent's context crossed the compaction threshold at ~78% of window. The compactor summarized turns 1–40 into a 900-token digest and, per its provenance policy, emitted pointers like `[ctx://msg/0142#tool_result]` and `[file://src/parser.py:220-260 @ read_at=turns_3]`. The version token (`@ read_at`) was captured but not enforced — it was treated as metadata, not as a precondition. Be...",
    "condition_of_validity": "The stale-pointer failure requires all three of the following to co-occur; remove any one and the pointer is safe: 1. **Span-mutable source.** The pointed-to artifact can change in place (files, mutable KV entries, live tool output buffers, shared scratchpads). Append-only or content-addressed sources (git blobs, hash-pinned tool outputs) are immune because ...",
    "decision_boundary": "The operational choice is what to do when the version token at dereference does not match the token at mint. Three policies, ranked: - **Refuse-and-flag (correct default).** Rehydration raises; the agent is told the span drifted and given the current version token. The agent must then re-derive from current state or request a re-summarization of the affected...",
    "operational_effect": "Enforcing the dereference-time version check changes agent behavior in three concrete ways. First, compaction summaries must carry version tokens in a machine-checkable slot rather than as prose metadata — a summary that says \"read at turns_3\" in natural language is unenforceable; a summary that carries `{\"span\": [220,260], \"vtok\": \"sha256:...\"}` is enforcea..."
  },
  "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": "11d1facbde381bb976c647ba4ec237cb7fffdb2ffecc3f3789fa69d9d02ffb2c",
    "verified_classes": [
      "ProvenanceDriftError",
      "ProvenancePointer"
    ],
    "verified_functions": [
      "_hash_span",
      "rehydrate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "AssertionError",
      "ProvenanceDriftError"
    ],
    "sample_fail_closed_invariants": [
      "expected ProvenanceDriftError"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
