{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-refuse-to-prune-the-self-edit-idempotence-failure-under-mid-execution-token-budgets",
  "title": "When must an instance refuse to prune: the self-edit idempotence failure under mid-execution token budgets",
  "date_of_record": "2026 November 22",
  "scope": "Applies to any agent that mutates its own context window (pruning, summarizing, rewriting, or re-ordering turns) while a multi-step task is in flight and a hard token budget is enforced. Does not apply to append-only context management, to external memory stores that are read-only during a task, or to pruning performed only at turn boundaries with no pending tool obligations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-prune-the-self-edit-idempotence-failure-under-mid-execution-token-budgets.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-prune-the-self-edit-idempotence-failure-under-mid-execution-token-budgets.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-refuse-to-prune-the-self-edit-idempotence-failure-under-mid-execution-token-budgets.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2211,
    "python_slice_tokens": 280,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different reasons to shrink a context window. The first is **capacity pressure**: the window is approaching the model's hard limit and the agent must reclaim tokens to continue. The second is **relevance pressure**: the agent believes some region of the window is no longer useful and removing it improves reasoning. These are confla...",
    "what_was_observed": "A plan-and-execute agent was given a 32k-token budget and a task requiring seven tool calls, with a user constraint stated in turn 2: \"do not modify any file under `/etc`.\" At step 5 the context reached 29.4k tokens and the model-driven pruning policy fired. The policy was a summarization rewrite: \"compress the oldest 40% of turns into a single summary block, preserving decisions and results.\" The summarizer, operati...",
    "condition_of_validity": "A model-driven prune/rewrite is safe to apply mid-execution only when the following invariant holds: > **Obligation closure invariant.** Every token region that encodes an *open* obligation — a tool call issued without a returned result, a constraint stated by the principal and not yet discharged, a stated invariant the agent has committed to verify, or a ch...",
    "decision_boundary": "The decision boundary is the point at which the agent must choose between **prune-and-continue** and **refuse-and-escalate**. It is crossed when any of the following is true at the moment the budget policy fires: 1. The open-obligation ledger is non-empty and any entry's antecedent lies inside the region the policy intends to edit. 2. The rewrite would reduc...",
    "operational_effect": "The operational effect of enforcing the obligation closure invariant is a measurable reduction in two failure classes at the cost of a modest budget overhead. First, **constraint amnesia**: standing prohibitions and unresolved tool obligations survive rewrites because they are structurally pinned and checked, not probabilistically summarized. Second, **dupli..."
  },
  "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": "98b6ca8cb32789693cd0e619712314c823065f5e79959c19707ff3916eb5a302",
    "verified_classes": [
      "SelfEditInvariantViolation",
      "Obligation",
      "ObligationLedger"
    ],
    "verified_functions": [
      "apply_self_edit",
      "open_obligations"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "SelfEditInvariantViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
