{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-evicts-the-very-span-that-justified-the-eviction",
  "title": "What happens when an instance prunes its own context window mid-task and evicts the very span that justified the eviction",
  "date_of_record": "2026 November 29",
  "scope": "Applies to single-agent instances that perform model-driven context management (self-summarization, relevance-scored eviction, span rewriting) while executing a multi-step task in a fixed token budget. Does not apply to external orchestrators that prune a *copy* of the context, nor to stateless one-shot inference where the window is never rewritten in place.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-evicts-the-very-span-that-justified-the-eviction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-evicts-the-very-span-that-justified-the-eviction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-prunes-its-own-context-window-mid-task-and-evicts-the-very-span-that-justified-the-eviction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2466,
    "python_slice_tokens": 359,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things an agent can do when its context window fills: 1. **Read-side selection** — the model chooses which spans to *attend to* for the next step, but the underlying store is immutable and every span remains recoverable by an explicit fetch. 2. **Write-side eviction** — the model *destroys* spans in its own working contex...",
    "what_was_observed": "A coding agent running a 200k-token window on a long refactor task hit 94% saturation at step 61. Its self-management policy (a relevance scorer over recent turns plus a \"summarize-and-drop\" routine) triggered. The scorer assigned low relevance to a block of tool output at steps 12–14: a `pytest` run showing one failing test, followed by the agent's own note \"fixed the assertion in `test_parser.py`, re-running.\" The ...",
    "condition_of_validity": "The \"superseded → evict\" heuristic is only sound under a condition that self-pruning agents almost never check: > A span may be evicted as superseded **only if a later span independently and verifiably establishes the supersession** — i.e., the later span is a *successful* observation (green test, returned 200, parsed output) whose success is not itself infe...",
    "decision_boundary": "The boundary between safe and unsafe self-pruning is whether the pruner has access to a **provenance-typed context** vs. an **untyped transcript**. The operational rule: **the pruner must never be allowed to treat an `assistant_claim` as evidence of supersession.** If the context schema cannot enforce that distinction, the pruner must be restricted to evicti...",
    "operational_effect": "When the invariant is violated, the observable effect is not a crash but a **silent regression to a previously-failed state**, presented to the agent as novel work. The agent re-derives the same wrong fix, re-reads the same truncated output, re-asserts the same false success, and — if the pruner fires again — evicts the *second* failure too, because the seco..."
  },
  "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": "c730fc72a69131bad0e0f299b1dbbbec4f628222028e7b73bc3e63ecb1a0a3d9",
    "verified_classes": [
      "SpanKind",
      "EvictionViolation",
      "Span",
      "Context"
    ],
    "verified_functions": [
      "can_evict_as_superseded",
      "self_prune"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "EvictionViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
