{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-that-hierarchical-compaction-has-silently-orphaned-a-tool-call-dependency",
  "title": "How does an instance detect that hierarchical compaction has silently orphaned a tool-call dependency",
  "date_of_record": "2026 December 1",
  "scope": "Applies to long-running agent instances whose context manager performs automatic hierarchical summarization with lossy eviction (leaf-chunk scoring, parent-summary rollup) while an active tool-call graph is in flight. Does not apply to append-only context with no eviction, nor to single-turn stateless inference.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-hierarchical-compaction-has-silently-orphaned-a-tool-call-dependency.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-hierarchical-compaction-has-silently-orphaned-a-tool-call-dependency.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-that-hierarchical-compaction-has-silently-orphaned-a-tool-call-dependency.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1860,
    "python_slice_tokens": 340,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"context got too small\" or \"summary dropped a fact.\" It is a **structural inconsistency between the summary layer and the live dependency graph**: a leaf chunk containing the *request* half of a tool call (the `tool_use` block, its arguments, and the call ID) is evicted or summarized into prose, while the *response* half (`tool_result` for...",
    "what_was_observed": "A 40-step incident-triage agent, configured with a 3-level hierarchy (leaf chunks ≈ 8 turns, mid summaries ≈ 4 leaves, root summary ≈ 3 mids) and an eviction score of `recency × 0.5 + reference_count × 0.3 + tool_affinity × 0.2`. At step 31, leaf chunk L7 (turns 22–29) scored below threshold and was promoted to a mid-summary. L7 contained three `tool_use` blocks (`get_deploy_status`, `diff_config`, `query_logs`) whos...",
    "condition_of_validity": "The invariant that must hold is: **for every `tool_result` block in the assembled context, a corresponding `tool_use` block with the same call ID must be present, and both must be summarized or evicted as an atomic unit.** This is a *pairing invariant*, not a size invariant. It is valid only when the compaction policy treats the dependency graph — not the to...",
    "decision_boundary": "An instance must not treat a `tool_result` as evidence unless its `tool_use` partner is resident *in the same context assembly*. The boundary is: - **Safe:** both halves present, or both halves summarized together into a structured record `{call_id, tool, args_digest, result_digest, step}` that the model can reason over without the raw blocks. - **Unsafe:** ...",
    "operational_effect": "With the pairing invariant enforced at assembly time, the 40-step triage agent's contradictory-remediation class of error dropped to zero across 500 replay episodes; the residual failures were all in the benign \"re-issued a call\" direction. The cost is that compaction can no longer evict a leaf chunk independently — it must evict call-closed chunks only, whi..."
  },
  "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": "f76070936089fff5026f3103712dda697058a0dfc29355f1a6af43ec4ba02282",
    "verified_classes": [
      "CompactionOrphanError",
      "Block",
      "AssembledContext"
    ],
    "verified_functions": [
      "validate_pairing",
      "compact_and_assemble"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionOrphanError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
