{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-hierarchical-compaction-from-silently-invalidating-an-agent-s-own-prior-tool-call-facts",
  "title": "Which invariants prevent hierarchical compaction from silently invalidating an agent's own prior tool-call facts",
  "date_of_record": "2026 December 1",
  "scope": "Applies to long-horizon agents that compact context via hierarchical summarization (leaf→parent rollups) or lossy checkpointing while a task is still in flight. Does not apply to append-only transcript archives that are never re-read as authoritative working state, nor to single-turn agents whose entire state fits the live window.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-hierarchical-compaction-from-silently-invalidating-an-agent-s-own-prior-tool-call-facts.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-hierarchical-compaction-from-silently-invalidating-an-agent-s-own-prior-tool-call-facts.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-hierarchical-compaction-from-silently-invalidating-an-agent-s-own-prior-tool-call-facts.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2062,
    "python_slice_tokens": 340,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two categorically different things an agent stores when it summarizes: **narrative state** (\"we tried approach A, it failed, then moved to B\") and **committed facts** (\"the migration produced table `orders_v2` with 41 columns; `POST /v1/refund` returns 409 on already-refunded orders\"). Narrative state is safely lossy—a compressed paraphrase of inte...",
    "what_was_observed": "A planning agent executing a 90-step data-reconciliation task compacted at step 40 (leaf summaries of steps 1–20 and 21–40) and again at step 60 (parent summary of both leaves). At step 71 it needed to re-issue a verification query against a source system it had probed at step 12. The step-12 tool output had read: The step-12 leaf summary recorded: *\"Probed billing_ledger; Q3 partition is large (~118k rows), schema v...",
    "condition_of_validity": "The invariant that must hold for hierarchical compaction to be safe is a **grounding partition**: every element of working state is tagged at write time as either `NARRATIVE` (lossy-compressible) or `COMMITTED` (must survive byte-exact or be explicitly invalidated). Compaction may summarize the `NARRATIVE` partition freely. It may only *reference* the `COMMI...",
    "decision_boundary": "The boundary is not \"how much can I compress before quality drops.\" It is: **does any downstream consumer treat a compacted artifact as a source of literals?** Concretely: - If the next action after compaction is *generation* (writing code, drafting, planning further probes) → prose summaries are safe; the model's narrative continuity is what matters. - If t...",
    "operational_effect": "The practical consequence is a **compaction-time fact-extraction pass** that runs *before* summarization and is not itself a language-model operation. For each tool result entering the window, the wrapper extracts structured fields (per an output schema or a conservative heuristic: any key whose value is numeric, hashed, or an identifier) into the fact store..."
  },
  "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": "67342509417eb9c4eeb0bf43e92a36febfb42fab1217af2a5bf8d6165b51283c",
    "verified_classes": [
      "CompactionGroundingError",
      "FactStore"
    ],
    "verified_functions": [
      "construct_tool_arg",
      "commit",
      "resolve"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionGroundingError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
