{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-hierarchical-auto-compaction-from-silently-amputating-the-live-task-frame",
  "title": "Which invariants prevent hierarchical auto-compaction from silently amputating the live task frame",
  "date_of_record": "2026 November 24",
  "scope": "Applies to long-horizon agents that perform hierarchical (tiered) summarization of their own context to stay under a token budget, where a \"fidelity budget\" governs how much verbatim detail each tier retains. Does not apply to single-turn agents, stateless RAG pipelines, or compaction performed by an external orchestrator that owns the full transcript durably.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-hierarchical-auto-compaction-from-silently-amputating-the-live-task-frame.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-hierarchical-auto-compaction-from-silently-amputating-the-live-task-frame.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-hierarchical-auto-compaction-from-silently-amputating-the-live-task-frame.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1958,
    "python_slice_tokens": 511,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode here is not \"the agent forgot something.\" It is the distinction between **compaction as lossy compression of a transcript** and **compaction as re-derivation of the live task frame**. A hierarchical compactor that treats the context window as a stack of summarizable prose will, at a trigger boundary, fold the *current working state* (open su...",
    "what_was_observed": "A planning agent running a 40-step deployment task with a 200k-token window and a tiered compactor configured at thresholds `T1=0.60`, `T2=0.80`, `T3=0.92` of budget. Tiers: T1 folds tool outputs older than 8 turns into bullet digests; T2 folds those digests plus assistant reasoning older than 20 turns into paragraph summaries; T3 folds everything except the last 4 turns into a single \"mission brief.\" At step 27 the ...",
    "condition_of_validity": "The guardrail below is valid **only** under these conditions, and must be treated as unverified outside them: 1. The compactor can inspect structured metadata (message role, tool-call status, subgoal markers) rather than only rendered text. If the agent only sees flattened prose, class tagging must be done at emission time, not at compaction time. 2. Every t...",
    "decision_boundary": "The boundary is **whether the element being folded is load-bearing for the next action**. Operationally: - Fold into a tier **only if** the element's status is terminal (`OK`/`ERROR` tool result, closed subgoal) **and** it is not referenced by any `PENDING` element. A closed subgoal that a pending subgoal depends on is *not* foldable — its verbatim success c...",
    "operational_effect": "With class-tagged compaction and a per-class retention floor, the T2/T3 seams become auditable: every summary carries a manifest of which source elements were folded and their pre-fold status, so a post-compaction verifier can assert \"no `PENDING` element was folded\" and \"no imperative was demoted to declarative\" as a replay check. The cost is that `PINNED` ..."
  },
  "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": "83176b08781c0279196a801e32bd5869c2a5dde313f0107971843f330341466d",
    "verified_classes": [
      "CompactionClass",
      "FrameAmputationError",
      "ContextElement",
      "CompactionPlan"
    ],
    "verified_functions": [
      "validate_plan"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "FrameAmputationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
