{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-self-pruning-context-windows-from-evicting-their-own-continuation-anchors",
  "title": "Which invariants prevent self-pruning context windows from evicting their own continuation anchors",
  "date_of_record": "2026 November 28",
  "scope": "Applies to agents that mutate their own context window mid-task via model-driven eviction (relevance-scored token dropping, summarization-in-place, or \"forget this\" self-edits) while a multi-step plan is still executing. Does not apply to read-only retrieval augmentation or to externally scheduled compaction performed between completed turns.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-pruning-context-windows-from-evicting-their-own-continuation-anchors.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-pruning-context-windows-from-evicting-their-own-continuation-anchors.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-self-pruning-context-windows-from-evicting-their-own-continuation-anchors.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2079,
    "python_slice_tokens": 403,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A context window is not a cache. A cache is defined by a pure recompute-on-miss contract: evict anything, and a miss costs latency, never correctness. A self-editing agent context has no such contract, because the *eviction decision itself is computed by the same model whose future reasoning depends on the evicted tokens*. This creates a class of failure tha...",
    "what_was_observed": "A planning agent executing a 14-step data-migration task hit context saturation at step 9. Its self-pruning routine scored every retained span against the current step's query embedding and dropped the bottom 40% by score. The run then diverged: at step 10 the agent re-derived a plan from scratch, re-ran three already-completed steps, and finally issued a destructive `DROP` against a table it had been explicitly told...",
    "condition_of_validity": "The failure mode is bounded by a single invariant, and the invariant is only enforceable if stated as a *precondition on the eviction operation*, not a postcondition on the result: > **No self-edit may evict a span that is (a) a declared constraint, (b) a binding of a name still live in the active plan, or (c) a progress anchor identifying the current step a...",
    "decision_boundary": "The boundary between \"safe to self-prune\" and \"must pin\" is drawn per-span, and the decision procedure is: 1. **Is the span a constraint, a live binding, or a progress anchor?** If yes → pin, unconditionally, regardless of score. This is a hard gate, evaluated before the relevance model is consulted. 2. **Is the span a completed step's detail, no longer refe...",
    "operational_effect": "Enforcing the pin-before-score invariant converts a silent divergence class into a bounded, recoverable one. Concretely: - Divergence from re-derived plans drops to zero for tasks with explicit plans, because the progress anchor survives every edit and the executor can always answer \"what step am I on and what did I just finish.\" - Destructive-action inciden..."
  },
  "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": "15d74ca37d0efd53be26d31fa49080466d5fb940acd90899fa42b0b34b9eeace",
    "verified_classes": [
      "AnchorEvictionError",
      "SpanClass",
      "Span",
      "ContextWindow"
    ],
    "verified_functions": [
      "self_prune",
      "run_step",
      "pinned_ids"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "AnchorEvictionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
