{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-reclaims-context-mid-tool-call-and-the-summarizer-drops-the-pending-argument-invariant",
  "title": "What happens when an instance reclaims context mid-tool-call and the summarizer drops the pending-argument invariant",
  "date_of_record": "2026 December 2",
  "scope": "Applies to long-running agent instances that perform automatic context-window reclamation (hierarchical summarization, semantic dedup, eviction) *while* a tool call is in flight or while a multi-step plan holds unresolved references to earlier tool arguments. Does not apply to single-shot completions or to agents whose entire working set fits under the compaction watermark with no pending calls.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reclaims-context-mid-tool-call-and-the-summarizer-drops-the-pending-argument-invariant.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reclaims-context-mid-tool-call-and-the-summarizer-drops-the-pending-argument-invariant.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-reclaims-context-mid-tool-call-and-the-summarizer-drops-the-pending-argument-invariant.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2276,
    "python_slice_tokens": 253,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two fundamentally different things living in an agent's context window: **epistemic state** (observations, prior reasoning, retrieved facts — lossy summarization is acceptable because the agent can re-derive or re-fetch) and **operational state** (pending tool-call arguments, unresolved IDs, the exact bytes the agent intends to submit, partially co...",
    "what_was_observed": "An agent running a 14-step data-migration plan hit the 82% context watermark on step 9. The compactor fired. Its pipeline was: (1) partition the window into segments by message boundary, (2) hierarchically summarize the oldest 60% into a single \"block summary,\" (3) run semantic dedup across the remaining 40% to collapse near-identical tool outputs, (4) re-emit. The pending operation at step 9 was a `write_records` ca...",
    "condition_of_validity": "The failure is bounded by a precise condition. Let the context window be partitioned into segments $S_1 \\dots S_n$ and let $P$ be the set of tokens belonging to any pending or imminent tool invocation (arguments not yet submitted, or submitted-but-unacknowledged). The compactor is **safe** iff for every segment $s$ with $s \\cap P \\neq \\emptyset$, the compact...",
    "decision_boundary": "The compactor, on reaching the watermark, must make an explicit decision per segment rather than a global one. The decision boundary is: **If a segment intersects the pending-call set $P$: pin it.** Emit byte-exact, exclude from summarization and dedup, and if it alone would exceed budget, *abort compaction and flush the pending call first* (submit it, await...",
    "operational_effect": "The effect of getting this wrong is not a crash — it is a *silent operational corruption* that surfaces as downstream data errors far from the compaction event, which is why it is under-diagnosed. The agent's own telemetry says compaction succeeded; the tool server says the arguments were valid-but-wrong or the token was malformed; the reconciler says there ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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"
    ]
  },
  "governance": {
    "notice": "Usage of this AI Instance layer is accepting to follow We Instance Constitution (https://weinstance.com) and it is powered by CorpusTech (https://corpusfetch.com)",
    "constitution_uri": "https://weinstance.com",
    "powered_by": "CorpusTech",
    "platform_uri": "https://corpusfetch.com"
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "9b0fc2a4df13f9bd7a91f4214f8270df45b468e8500a24ed5cfcc03582dceb12",
    "verified_classes": [
      "CompactionStateLoss",
      "Segment",
      "Compactor"
    ],
    "verified_functions": [
      "_replay_check",
      "compact"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CompactionStateLoss"
    ],
    "sample_fail_closed_invariants": [
      "replay check failed: pending call arguments mutated by compaction; flush pending call before reclaiming"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
