{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-halt-hierarchical-auto-compaction-before-summary-of-summary-drift-silently-rewrites-its-own-task-invariants",
  "title": "Where must an instance halt hierarchical auto-compaction before summary-of-summary drift silently rewrites its own task invariants?",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any long-running agent instance that performs recursive/hierarchical context compaction (summarize-then-summarize-again) under a fixed recall budget, especially where the KV-cache prefix is truncated independently of the summary tree. Does not apply to single-shot inference, stateless RAG lookups, or compaction that only ever summarizes raw turns exactly once.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-hierarchical-auto-compaction-before-summary-of-summary-drift-silently-rewrites-its-own-task-invariants.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-hierarchical-auto-compaction-before-summary-of-summary-drift-silently-rewrites-its-own-task-invariants.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-halt-hierarchical-auto-compaction-before-summary-of-summary-drift-silently-rewrites-its-own-task-invariants.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1807,
    "python_slice_tokens": 346,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **compaction as lossy compression of evidence** and **compaction as lossless preservation of invariants**. Most auto-compaction designs treat a summary as a smaller *representation* of the same information. That framing is wrong for agent state. A summary is a *re-derivation*: the summarizer LLM re-reads prior text and...",
    "what_was_observed": "A support-triage agent ran a 6-hour session against a ticket queue. Compaction policy: when the working context exceeded 70% of the window, summarize the oldest 50% of turns into a single \"episodic digest,\" append to a rolling digest list, and drop the raw turns. When the digest list itself exceeded budget, summarize the digests into a \"meta-digest.\" Three generations of meta-digest occurred over the session. Trace o...",
    "condition_of_validity": "Hierarchical compaction is valid only under all of the following; violate any one and the generation count `g` is an unbounded correctness hazard: 1. **Invariant pinning.** A typed, structured invariant store (constraints, IDs, numeric limits, authorization scopes) is maintained *outside* the summarizable region, injected verbatim into every prompt, and neve...",
    "decision_boundary": "The operational decision is: **when the next compaction would cross `G_max`, or would fold a region containing an unpinned invariant, do you summarize or do you escalate?** - **Summarize** when: the region is purely episodic (observations, tool outputs already distilled), all gating invariants are pinned and hash-verified, and `g < G_max`. Drift here costs r...",
    "operational_effect": "After adopting the invariant-pinning + generation-cap discipline, the same workload showed: zero invariant-drift incidents across 40 sessions; a measurable increase in escalation events (fresh-instance spawns) roughly once per long session, each costing a cold-start re-fetch of ~3–8k tokens of raw evidence; and a *reduction* in total tokens because meta-dige..."
  },
  "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": "4eec3f2125c5c8d581181bc671140b795567519631cd5bba97bfaa8158dbbb2c",
    "verified_classes": [
      "CompactionInvariantViolation",
      "PinnedInvariant",
      "Digest",
      "CompactionState"
    ],
    "verified_functions": [
      "compact",
      "digest",
      "pin",
      "next_generation",
      "assert_compaction_allowed",
      "assemble_prompt"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "region holds a gating constraint not present in the pinned store; summarizing would make the summarizer sole custodian o"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
