{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-the-pruner-s-rationale-is-itself-pruned",
  "title": "What happens when an instance prunes its own context window mid-task and the pruner's rationale is itself pruned",
  "date_of_record": "2026 November 27",
  "scope": "Applies to single-agent loops where the model is granted a `prune_context` / `compact_history` tool and is expected to decide which prior turns to evict based on a rationale it emits in the same turn. Does not apply to externally-driven compaction (fixed sliding window, summarizer sidecar, or human-in-the-loop trimming), where the eviction decision is not co-generated with the agent's own reasoning trace.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-the-pruner-s-rationale-is-itself-pruned.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-the-pruner-s-rationale-is-itself-pruned.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-the-pruner-s-rationale-is-itself-pruned.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2466,
    "python_slice_tokens": 400,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different ways a context window shrinks. In **external compaction**, an oracle outside the reasoning loop decides what survives; the agent's future self inherits a state it did not author and cannot misattribute. In **model-driven pruning**, the agent both *produces the eviction decision* and *is the object of it*. The distinction ...",
    "what_was_observed": "A coding agent running a 12-step refactor loop with a 32k window and a `compact(keep=[...], drop=[...], summary=\"...\")` tool. At step 8, at ~29.4k tokens, the model invoked `compact` with a summary that read, verbatim: *\"Earlier exploration of the legacy `billing_v1` module is complete; do not re-read it. Active task: port `invoice_total()` to `billing_v2`. Outstanding: the `currency` field is still read from the v1 ...",
    "condition_of_validity": "The failure is bounded by a precise condition. Let $S$ be the set of turns the model elects to drop, and let $r$ be the tool-call turn that carries the rationale. The invariant that must hold for self-pruning to be safe is: $$r \\notin S \\quad \\text{and} \\quad \\text{provenance}(S) \\subseteq \\text{surviving context}$$ where $\\text{provenance}(S)$ is the minima...",
    "decision_boundary": "The boundary is between **pruning as compression** and **pruning as commitment**. Compression is safe when the summary is a lossy but *monotone* restatement — every surviving claim is entailed by the dropped content, and the model has no incentive to re-derive it. Commitment is what happens when the summary asserts a *negative* or a *closure* (\"done\", \"ignor...",
    "operational_effect": "The downstream effect is a **provenance gap that masquerades as task progress**. The agent's token budget looks healthy (it just freed 18k tokens), its step count advances, and its summaries read coherently — but the state it is reasoning from has a hole shaped exactly like its own justification. Because the hole is filled with a fluent summary, no error sur..."
  },
  "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": "15d59c0d6e4decb78f8382e2ba0fc35ff79b8066b90aeebf63cf33ba7386d9b7",
    "verified_classes": [
      "SelfPruneProvenanceError",
      "Turn",
      "PruneRequest"
    ],
    "verified_functions": [
      "validate_self_prune",
      "apply_self_prune",
      "digest"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "SelfPruneProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
