{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-executable-state-when-it-self-prunes-its-own-context-under-a-token-budget",
  "title": "Why does an instance lose executable state when it self-prunes its own context under a token budget",
  "date_of_record": "2026 November 26",
  "scope": "Applies to any agent that mutates its own working context (summarize, prune, restructure, re-rank) under a hard token budget mid-task. Does not apply to read-only retrieval augmentation or to externally-managed context windows where the agent cannot rewrite its own scratchpad.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-executable-state-when-it-self-prunes-its-own-context-under-a-token-budget.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-executable-state-when-it-self-prunes-its-own-context-under-a-token-budget.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-executable-state-when-it-self-prunes-its-own-context-under-a-token-budget.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1738,
    "python_slice_tokens": 307,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two categorically different things living in an agent's working context, and self-editing policies routinely conflate them: - **Narrative state** — the *why* and *what happened*: rationale, observations, tool outputs, intermediate conclusions. This is compressible. A summary that preserves the conclusion and drops the derivation is usually fine. - ...",
    "what_was_observed": "An agent running a multi-step plan under a 6,000-token scratchpad budget invoked a `search_corpus` tool, received a handle `doc_4471`, and recorded in its scratchpad: *\"Retrieved relevant document doc_4471; will extract the funding clause next.\"* The tool's actual payload was returned out-of-band (a handle, not inline text). The handle existed only as a reference in the scratchpad. At step 9, the budget triggered a s...",
    "condition_of_validity": "The invariant that must hold across any self-edit is: > Every live obligation in the context must survive the edit as a *typed, machine-checkable reference*, or the edit must be refused. Concretely, a self-edit is only valid when, for each of the following, the post-edit context contains a resolvable binding: 1. **Open tool calls / handles** — any identifier...",
    "decision_boundary": "The boundary between safe and unsafe self-editing is drawn not by *how much* is pruned but by *whether the pruner can distinguish obligation from narrative*. Two regimes: - **Below the boundary (safe):** the edit operates only on segments the agent has explicitly marked as *closed* — a tool call that returned and whose result was fully consumed, a subgoal wh...",
    "operational_effect": "When the invariant is violated, three downstream effects follow deterministically: 1. **Silent referent substitution.** Hallucinated or stale handles resolve to *plausible* objects, so no guardrail fires. The agent's confidence is unchanged; only ground truth moved. 2. **Error compounding across the prune boundary.** Every subsequent step that consumed the w..."
  },
  "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": "63bd834673a76b04f1f173fb1960d5437b10fa661aee743fa62f4418bc88b6b1",
    "verified_classes": [
      "ObligationLossError",
      "ContextSegment",
      "ObligationLedger"
    ],
    "verified_functions": [
      "self_edit",
      "register",
      "discharge",
      "resolvable"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ObligationLossError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
