{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-refuse-a-model-driven-context-rewrite-that-would-orphan-a-live-tool-call-continuation",
  "title": "Under what conditions must an instance refuse a model-driven context rewrite that would orphan a live tool-call continuation",
  "date_of_record": "2026 November 28",
  "scope": "Applies to any agent loop where the model itself selects which spans of its own context window to prune, summarize, or rewrite mid-episode, and where tool-call/result pairs and their pending continuations live in that same window. Does not apply to append-only context management, nor to pruning performed by an external scheduler that owns a separate, authoritative transcript store.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-a-model-driven-context-rewrite-that-would-orphan-a-live-tool-call-continuation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-a-model-driven-context-rewrite-that-would-orphan-a-live-tool-call-continuation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-refuse-a-model-driven-context-rewrite-that-would-orphan-a-live-tool-call-continuation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2141,
    "python_slice_tokens": 540,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different kinds of \"context editing\": *compaction of inert history* and *rewrite of live execution state*. The first is safe because the pruned spans are semantically closed—they participated in already-completed reasoning turns and carry no outstanding obligations. The second is dangerous because a context window is not a log; it ...",
    "what_was_observed": "A long-horizon coding agent ran a loop with a self-pruning policy: at 78% context utilization, the model was asked to emit a `prune_plan` listing message indices to drop and spans to summarize. The episode proceeded: 1. At step 41, the agent issued `read_file(path=\"src/parser.py\", offset=1200, limit=400)` — a `tool_use` block at index 37, awaiting result. 2. The tool returned 400 lines; the `tool_result` landed at in...",
    "condition_of_validity": "A model-driven rewrite is **valid only if** every dropped or rewritten span satisfies all of the following at the moment of rewrite: - **Closure:** the span contains no `tool_use` without a matching `tool_result` in the retained set, and no `tool_result` whose originating `tool_use` is dropped. Call/result pairs are atomic; you may drop both or neither. - **...",
    "decision_boundary": "The boundary is between *prune-eligible* and *prune-locked* spans, and it is computed from structural metadata, not from the model's plan: - A span is **prune-locked** if it is part of an open call/result pair, or if it is the most recent source of any identifier that appears in the retained window and has not been re-fetched since. - A span is **prune-eligi...",
    "operational_effect": "With the validator in place, the failure trace above terminates at step 4: the plan `{drop: [30..36, 37, 38], …}` is rejected because `37`/`38` form an open pair and `38` is the referent of line numbers that will appear in the pending `grep`. The agent is re-prompted with `locked: [37, 38]` and `deferrable: [30..36]`. It prunes `[30..36]`, retains the file v..."
  },
  "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": "772e520c475a9994c370f5d4cc490f7e9dff0a945d6bfc5f5ad8c83c539f1437",
    "verified_classes": [
      "ContextRewriteViolation",
      "Span",
      "PrunePlan"
    ],
    "verified_functions": [
      "validate_prune_plan",
      "apply_plan"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ContextRewriteViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
