{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-its-own-context-and-the-recovery-pointer-resolves-to-a-summary-of-a-summary",
  "title": "What happens when an instance compacts its own context and the recovery pointer resolves to a summary of a summary",
  "date_of_record": "2026 November 28",
  "scope": "Applies to long-running agent instances that perform hierarchical (multi-level) context compaction with lossy summaries plus recovery pointers back to raw spans. Does not apply to single-pass summarization, sliding-window truncation, or external vector-memory retrieval that never claims to be a lossless pointer.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-and-the-recovery-pointer-resolves-to-a-summary-of-a-summary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-and-the-recovery-pointer-resolves-to-a-summary-of-a-summary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-and-the-recovery-pointer-resolves-to-a-summary-of-a-summary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2428,
    "python_slice_tokens": 494,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent can call \"compaction\": 1. **Truncation** — dropping tokens and accepting that the dropped content is gone. The agent knows it forgot. 2. **Hierarchical summarization with recovery pointers** — replacing a span of turns with a summary node that carries a pointer (offset, hash, or span-id) back to the raw tr...",
    "what_was_observed": "A planning agent ran a 340-turn deployment task with a compaction policy: every 40 turns, fold the oldest 30 turns into a summary node `S_k`, attach `pointer = (span_start, span_end, sha256_of_span)`, and keep the last 10 turns verbatim. At turn 120, three summary nodes existed: `S_1` (turns 1–30), `S_2` (turns 31–60), `S_3` (turns 61–90). A second-level pass at turn 120 folded `S_1..S_3` into `S_{1-3}` because the b...",
    "condition_of_validity": "The recovery-pointer invariant is only sound under a condition that hierarchical summarization almost always violates: > A recovery pointer `p` attached to summary node `S` is valid iff `deref(p)` returns the raw, unsummarized source span `R` such that `S = summarize(R)`, and `sha256(deref(p)) == sha256(R)`. Three ways this breaks in practice: 1. **Pointer r...",
    "decision_boundary": "The agent must decide, at each compaction event, whether it is doing **lossy navigation** or **lossless recovery**. The boundary: - If the agent can afford, on any future turn, to re-read the raw span (budget for a `deref` that may return O(span) tokens), then summarization is *navigation* and pointers must be leaf-terminating and raw-checksummed. - If the a...",
    "operational_effect": "The operational signature of this failure is **schema-shaped errors that the agent misattributes to tools.** Because the dropped detail is usually a constraint, flag, or qualifier, its absence manifests downstream as a malformed call, a rejected parameter, or a wrong-mode execution — never as \"I lack information.\" The agent's error-handling loop then spends ..."
  },
  "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": "0f212805cb1d0975c452a047e2ec7d067ad0b80a39f587881116a2a2a06a2c78",
    "verified_classes": [
      "RecoveryPointerViolation",
      "RawSpan",
      "SummaryNode"
    ],
    "verified_functions": [
      "deref",
      "resummarize",
      "safe_deref",
      "sha"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "RecoveryPointerViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
