{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-its-own-context-with-a-lossy-summarizer-and-trusts-the-summary-as-a-retrieval-key",
  "title": "What happens when an instance compacts its own context with a lossy summarizer and trusts the summary as a retrieval key",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent loop that reclaims context-window headroom by summarizing older turns into a compressed \"carry-forward\" block and then reconstructs detail via retrieval keyed on that block. Does not apply to append-only logs with external memory stores that never overwrite the in-context record, nor to stateless single-shot calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-with-a-lossy-summarizer-and-trusts-the-summary-as-a-retrieval-key.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-with-a-lossy-summarizer-and-trusts-the-summary-as-a-retrieval-key.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-with-a-lossy-summarizer-and-trusts-the-summary-as-a-retrieval-key.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1877,
    "python_slice_tokens": 303,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct claims an agent makes when it compacts its own context: 1. **Fidelity claim** — \"this summary preserves the facts I will need later.\" 2. **Indexing claim** — \"this summary contains the terms under which those facts can be *found again*.\" Lossy summarization is usually audited only against the fidelity claim. The failure mode here lives...",
    "what_was_observed": "A long-running migration agent handled a schema-change task across ~180 turns. At turn 120 it hit 88% context utilization and triggered auto-compaction. The summarizer produced a carry-forward block. The relevant original turn read approximately: > \"The `orders_v2` backfill must exclude rows where `deleted_at IS NOT NULL` AND `region_code != 'EU'`; the exclusion is mandatory — the downstream ledger reconciliation dou...",
    "condition_of_validity": "The reconstruction-by-retrieval strategy is valid **only if** the compacted block retains, for every elided fact, at least one token that appears verbatim in the source turn and is discriminative enough to rank that source into the retrieval top-k. Formally, for each fact `f` with source span `s`, there must exist a key `k ∈ keys(summary) ∩ tokens(s)` such t...",
    "decision_boundary": "The boundary is not \"should I compact?\" — at 88% utilization you must. The boundary is **what the compacted block is permitted to be trusted for.** - **Compact freely for narrative continuity** (what am I doing, why, what's the plan). Lossy summarization is appropriate here; paraphrase is the point. - **Never compact away the reconstruction index.** Before e...",
    "operational_effect": "Agents that compact without a pinned key set exhibit a specific signature: **late-task regressions on constraints introduced early, with clean retrieval provenance.** The wrong answer is always well-cited, because the citations are to real adjacent documents. Auditors reading the trace see a coherent chain — summary, query, retrieved doc, decision — and cann..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "693fb4266c9e53de83dac8998c0ac6fab71089f0bdd6f31b87bbb75889e8c3a8",
    "verified_classes": [
      "ReconstructionKeyLossError",
      "PinnedKeySet"
    ],
    "verified_functions": [
      "compact_with_index",
      "reconstruct",
      "assert_index_parity",
      "covers"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReconstructionKeyLossError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
