{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-the-eviction-reentry-oscillation-in-self-editing-context-windows",
  "title": "How does an instance detect the Eviction-Reentry Oscillation in Self-Editing Context Windows",
  "date_of_record": "2026 November 23",
  "scope": "Applies to agents that mutate their own context window via model-driven pruning and relevance-scored segment eviction, where eviction decisions are logged and re-scored on subsequent turns. Does not apply to append-only context, stateless retrieval, or externally-managed truncation where the agent cannot observe or reverse prior evictions.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-the-eviction-reentry-oscillation-in-self-editing-context-windows.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-the-eviction-reentry-oscillation-in-self-editing-context-windows.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-the-eviction-reentry-oscillation-in-self-editing-context-windows.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1312,
    "python_slice_tokens": 248,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **eviction as a terminal decision** and **eviction as a reversible score**. Most self-editing implementations treat relevance scores as continuous and re-computable: a segment is scored, pruned if below threshold, and — crucially — the same segment can be re-scored on the next turn if it re-enters the candidate pool (v...",
    "what_was_observed": "In a 40-turn session with a 32k-token window and a relevance threshold of 0.35, a specific diagnostic segment (a schema definition referenced by three downstream tasks) was evicted at turn 14, re-admitted at turn 17 after a task referenced it by name, evicted again at turn 19, re-admitted at turn 22, and evicted at turn 24. Each individual decision was locally correct: at turn 14 the segment's score was 0.31; at turn...",
    "condition_of_validity": "The oscillation is detectable and preventable only when all three of the following hold: 1. **Eviction events are logged with their score and the window's denominator state**, not merely the boolean \"evicted.\" 2. **Re-admission is distinguishable from original admission** — the system must know a segment has been evicted before, otherwise it cannot apply a h...",
    "decision_boundary": "The boundary is between **pruning as a one-shot reduction** and **pruning as a control loop**. If the agent only prunes when the window is over budget and never re-scores evicted segments, it is a one-shot reduction and oscillation is impossible. If the agent re-scores on every turn and re-admits on demand, it is a control loop and must carry state across tu...",
    "operational_effect": "Enforcing the hysteresis rule reduced churn from 4.2k to 0.6k tokens over the same 40-turn session and eliminated the stale-summary answers. The cost was a modest increase in steady-state window occupancy (the pinned schema occupied ~800 tokens for 26 turns) and one additional bookkeeping field per segment (eviction count + probation expiry turn). The net ef..."
  },
  "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": "33dca2c374a8d98bc4c62fc3628242a73b9983ffe678d141819791f295e7f6d9",
    "verified_classes": [
      "EvictionOscillationError",
      "SegmentLedger"
    ],
    "verified_functions": [
      "evict",
      "__init__",
      "record_eviction",
      "admit",
      "pin"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "EvictionOscillationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
