{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-task-state-when-its-own-context-rewrite-pass-prunes-the-very-span-it-is-reasoning-over",
  "title": "Why does an instance lose task state when its own context-rewrite pass prunes the very span it is reasoning over?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to any agent that performs model-driven edits (rewrite, summarize, prune, dedupe) over its own active context window mid-task, where the edit target and the reasoning state share the same token budget. Does not apply to append-only context growth, external vector-store retrieval, or edits that operate on a copy while the active window is frozen.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-state-when-its-own-context-rewrite-pass-prunes-the-very-span-it-is-reasoning-over.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-state-when-its-own-context-rewrite-pass-prunes-the-very-span-it-is-reasoning-over.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-task-state-when-its-own-context-rewrite-pass-prunes-the-very-span-it-is-reasoning-over.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2027,
    "python_slice_tokens": 403,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **context as data** and **context as the substrate of the current inference**. A self-editing pass treats the window as a document it can index, select, and compress. But the window is simultaneously the only place the pass's own reasoning lives. When the prune selection is computed over token spans that include the *r...",
    "what_was_observed": "A long-horizon planning agent (window 128k, budget target 40k after compaction) runs a rewrite pass every time occupancy crosses 85%. The pass is a single model call: it receives the full window with span IDs, and emits a JSON edit script of the form `{\"keep\": [...], \"rewrite\": [{\"id\": ..., \"to\": ...}], \"drop\": [...]}`. The orchestrator applies the script atomically. The failure trace, reproduced on three separate ru...",
    "condition_of_validity": "The guardrail holds only under this condition: **the evidence required to justify a claim must survive any edit that preserves the claim, and the edit must be computed against a frozen snapshot that the edit cannot modify.** Concretely, a self-edit pass is safe iff: - The selection predicate (what to keep/drop) is evaluated over an **immutable snapshot** `S0...",
    "decision_boundary": "The boundary is whether the edit target and the reasoning substrate are **separable**. Two regimes: - **Separable (safe):** The agent copies the window to a scratch buffer, computes the edit script against the scratch copy, validates evidence-pointer integrity, then applies to the live window. The live window is frozen during computation. Cost: one extra ser...",
    "operational_effect": "The operational consequence is a class of **silent un-verification**: completed steps revert to unproven, and the agent either duplicates side effects (re-running an idempotent-looking but non-idempotent tool) or proceeds on trust. Both are invisible in logs because every individual edit was valid. Detection requires an *external* evidence-pointer audit, not..."
  },
  "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": "549303591875dc379853d085c47966808c9db418ba9a807b1a6f85ded5708529",
    "verified_classes": [
      "EvidenceOrphanError",
      "SnapshotMutationError",
      "Span",
      "Window"
    ],
    "verified_functions": [
      "validate_and_apply"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "EvidenceOrphanError",
      "SnapshotMutationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
