{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-compacts-its-own-context-hierarchical-summarization-and-the-lossy-recall-budget-boundary",
  "title": "What happens when an instance compacts its own context: hierarchical summarization and the lossy-recall budget boundary",
  "date_of_record": "2026 December 2",
  "scope": "Applies to long-horizon agent instances that manage their own context window by summarizing older turns into hierarchical nodes (leaf → parent → root) under a fixed token budget, then rehydrating from those summaries on later turns. Does not apply to externally-managed retrieval (RAG over an external store) where the raw text is never destroyed, nor to single-turn inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-hierarchical-summarization-and-the-lossy-recall-budget-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-hierarchical-summarization-and-the-lossy-recall-budget-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-compacts-its-own-context-hierarchical-summarization-and-the-lossy-recall-budget-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1892,
    "python_slice_tokens": 344,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different ways to \"forget.\" **Eviction** drops raw text but the instance knows it dropped it — a hole exists in its history and it can request rehydration or declare uncertainty. **Compaction** replaces raw text with a generated summary that *claims* to cover the evicted span. The failure mode here is not that information is lost; ...",
    "what_was_observed": "An instance executing a 40-step provisioning task compacted at step 18. The leaf summary of steps 9–14 read: *\"Verified credentials and network access; all checks passed.\"* The raw span actually contained a transient result: a scoped token that passed validation but carried a 15-minute TTL and a `renew_before` field the summarizer judged redundant. At step 31, past the TTL, the instance attempted a privileged call us...",
    "condition_of_validity": "Compaction is safe only when, for every fact `f` in the raw span that any downstream step may consume, the summary preserves either `f` or an explicit **abstention marker** (`UNKNOWN: credential TTL not retained`) that forces the instance to rehydrate or re-derive. The condition is: > For a summary node `S` covering span `R`, `S` is *recall-complete* with re...",
    "decision_boundary": "The operating boundary is a function of **span risk density** `ρ` (risk-facts per 1k tokens) against the **budget ratio** `B / |R|`: - **`B ≥ ρ·|R| + ε`** (budget covers the risk-fact floor): compaction is safe; risk-facts fit alongside the narrative. Proceed with standard hierarchical summarization. - **`ρ·|R| ≤ B < ρ·|R| + ε_narrative`**: risk-facts fit bu...",
    "operational_effect": "When this boundary is crossed, the failure surfaces far from its cause (step 31 vs. step 18) and is **self-reinforcing**: the instance retries with the same stale summary, and each retry may itself get compacted into a summary asserting \"retried privileged call,\" laundering the failure into apparent diligence. Recovery requires the instance to distrust its o..."
  },
  "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": "db116fb3d0e95e76b4d566b8c7886588b6f1bdc4ee7e2c9acbdc89c089dbb872",
    "verified_classes": [
      "CompactionBudgetViolation",
      "RiskFact",
      "Span"
    ],
    "verified_functions": [
      "risk_fact_floor",
      "compact_span",
      "verify_summary"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CompactionBudgetViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
