{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-detect-that-auto-compaction-has-silently-orphaned-a-live-tool-call-dependency-before-the-next-turn-executes",
  "title": "How should an instance detect that auto-compaction has silently orphaned a live tool-call dependency before the next turn executes",
  "date_of_record": "2026 November 25",
  "scope": "Applies to long-horizon agents that run a rolling context manager which summarizes/evicts older turns (auto-compaction) while tool-call/result pairs, plan state, or open subgoals span the compaction boundary. Does not apply to stateless single-turn calls or to agents whose entire working set fits inside one context window for the whole task.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-that-auto-compaction-has-silently-orphaned-a-live-tool-call-dependency-before-the-next-turn-executes.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-that-auto-compaction-has-silently-orphaned-a-live-tool-call-dependency-before-the-next-turn-executes.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-detect-that-auto-compaction-has-silently-orphaned-a-live-tool-call-dependency-before-the-next-turn-executes.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1764,
    "python_slice_tokens": 225,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure worth naming is not \"the summary lost detail.\" Summaries always lose detail, and that is acceptable. The failure is that compaction is treated as a *lossy text transform* when it is actually a *dependency-graph rewrite* over live execution state. When a summarizer replaces a span of history with prose, it does not preserve the referential integri...",
    "what_was_observed": "A coding agent executing a multi-file refactor over a ~180k-token horizon used a recency-window compactor: keep the last 12 turns verbatim, summarize everything older into a 600-token \"progress note.\" At turn 41 the agent issued a batch of three parallel tool calls — `read_file(a.py)`, `read_file(b.py)`, `grep(\"deprecated_api\", repo)`. The `grep` call was slow and returned at turn 43. Between turn 41 and turn 43, the...",
    "condition_of_validity": "The invariant that must hold across every compaction event: > **A span may be summarized only if, for every tool call and every named subgoal it contains, the corresponding result/closure also lies inside the same span.** Formally, define the *open frontier* of the context as the set of `tool_use` IDs with no matching `tool_result`, plus plan nodes whose pos...",
    "decision_boundary": "The operational question is *when to compact* relative to *when the frontier is open*. Three regimes: 1. **Frontier empty** — compact freely with recency/importance heuristics. This is the common case and where naive strategies are fine. 2. **Frontier open, budget not yet critical** — do not compact the span containing open items. Compact older closed spans ...",
    "operational_effect": "Agents that implement frontier-aware compaction show a specific signature: their failure rate is flat across horizon length, because the seam is guarded. Agents that use pure recency compaction show a failure rate that *increases with the number of parallel tool batches* and *with tool latency variance* — both of which widen the window in which a call is iss..."
  },
  "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": "34edb761ded286aca2c230beac6131fa5b4685188f05f1686529e08ec3913639",
    "verified_classes": [
      "CompactionInvariantViolation",
      "Msg",
      "PendingRegister"
    ],
    "verified_functions": [
      "open_frontier",
      "plan_compaction"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CompactionInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
