{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-silently-lose-task-state-when-a-model-driven-context-rewrite-compacts-the-very-tool-call-frames-it-is-still-waiting-on",
  "title": "Why does an instance silently lose task state when a model-driven context rewrite compacts the very tool-call frames it is still waiting on",
  "date_of_record": "2026 November 29",
  "scope": "Applies to agents that own their own context window and invoke a model-driven rewrite/summarization pass (self-compaction, salience-preserving summarization, \"context editing\") between turns. Does not apply to externally-managed context where a supervisor truncates deterministically without the model in the loop, nor to single-shot calls with no pending tool state.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-lose-task-state-when-a-model-driven-context-rewrite-compacts-the-very-tool-call-frames-it-is-still-waiting-on.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-lose-task-state-when-a-model-driven-context-rewrite-compacts-the-very-tool-call-frames-it-is-still-waiting-on.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-silently-lose-task-state-when-a-model-driven-context-rewrite-compacts-the-very-tool-call-frames-it-is-still-waiting-on.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1682,
    "python_slice_tokens": 257,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A model-driven context rewrite is not a lossy compression of a transcript. It is a *re-authoring* of the agent's working state by a probabilistic process that has no schema knowledge of what is structurally load-bearing. The distinction that matters: **narrative salience and operational salience are different quantities, and the rewriter only optimizes the f...",
    "what_was_observed": "A coding agent with a 200k window and a self-rewrite threshold at 78% utilization was mid-task: it had issued `read_file(path=\"src/auth/session.py\")` and `grep(pattern=\"refresh_token\", path=\"src/\")` in the same assistant turn (parallel tool calls), received the `read_file` result, and was still awaiting the `grep` result. At 79% utilization the rewrite pass fired *between* the two tool-result deliveries. The rewriter...",
    "condition_of_validity": "The failure is bounded by a precise precondition. It requires **all** of: - The rewrite is triggered by *utilization* (a token threshold) rather than by *quiescence* (no in-flight frames). Threshold-triggered rewrites can fire mid-turn; quiescence-triggered rewrites cannot. - The rewrite is *model-driven* and free to paraphrase arbitrary spans, rather than o...",
    "decision_boundary": "The architectural guardrail is a **frame-type partition at the rewrite boundary**, not a better prompt. Instructing the rewriter to \"preserve tool calls\" is insufficient: it is a probabilistic instruction applied to a probabilistic process, and it will hold most of the time — which is worse, because the residual failure is rare, silent, and correlated with l...",
    "operational_effect": "With the partition in place, the rewrite becomes a *compaction of history* rather than a *reconstruction of state*, and the in-flight census assertion converts a silent state-loss into a loud, local fault at the rewrite boundary — where it can be attributed correctly. The residual cost is that rewrites must occasionally defer when a long-running tool is outs..."
  },
  "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"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "0c065537cf96771838d5e075f9b8a02e4966e3f31fc82ea2ae1e878959e71c02",
    "verified_classes": [
      "InFlightFrameLostError",
      "ToolFrame",
      "ContextWindow"
    ],
    "verified_functions": [
      "rewrite_context",
      "guarded_rewrite",
      "unresolved_ids"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "InFlightFrameLostError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
