{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-evict-the-wrong-token-when-a-self-editing-context-window-scores-relevance-against-its-own-mutating-summary",
  "title": "Why does an instance evict the wrong token when a self-editing context window scores relevance against its own mutating summary",
  "date_of_record": "2026 December 1",
  "scope": "Applies to single-agent loops that maintain a rolling context window and use an LLM-generated summary as the relevance prior for adaptive eviction (attention-score or embedding-similarity ranking of tokens against \"what matters now\"). Does not apply to fixed-window truncation, external vector-store retrieval, or eviction driven by an immutable, externally supplied task schema.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-evict-the-wrong-token-when-a-self-editing-context-window-scores-relevance-against-its-own-mutating-summary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-evict-the-wrong-token-when-a-self-editing-context-window-scores-relevance-against-its-own-mutating-summary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-evict-the-wrong-token-when-a-self-editing-context-window-scores-relevance-against-its-own-mutating-summary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2209,
    "python_slice_tokens": 342,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct quantities in a self-editing window: the **relevance signal** (what the eviction policy thinks is important) and the **eviction target** (which tokens actually get dropped). In a static compaction scheme these are decoupled—the summary is regenerated after eviction, from the surviving tokens. In an *adaptive* scheme they are coupled: t...",
    "what_was_observed": "A coding agent with a 32k window, a 2k-token rolling summary, and an eviction policy of \"drop the lowest-scoring 20% of tokens when utilization exceeds 90%.\" Scores are cosine similarity between each token's hidden state and the summary embedding. Trace across four tool-call turns: 1. **T1.** Agent reads a config file and notes `RETRY_LIMIT = 3`. Summary at end of T1: \"Task: fix flaky test. Config uses retry limit 3....",
    "condition_of_validity": "The invariant that must hold for adaptive eviction to be safe: > **No token may be evicted on the basis of a summary that was generated without that token's contribution being recoverable.** Formally: if `S_n` is the summary at cycle `n`, and `E_n` is the eviction set chosen by scoring tokens against `S_n`, then for every `t ∈ E_n`, the information content o...",
    "decision_boundary": "The boundary between \"adaptive eviction is fine\" and \"adaptive eviction is silently corrupting state\" is whether the summary-generation input set is a **superset** of the eviction-decision input set. - If summary input ⊇ scoring input: safe. The summary saw everything the scorer saw, so it cannot have compressed away something the scorer then used to justify...",
    "operational_effect": "Once the window has converged onto a self-consistent wrong summary, several downstream behaviors change character: - **Confidence inflates.** The summary is regenerated from a window that no longer contains contradictions, so its stated certainty rises. The agent reports \"confirmed\" where it previously reported \"hypothesis.\" This is the inverse of the usual ..."
  },
  "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": "c9a676d283a0e00038e75b8fdb2f75ecc79a22769c8ad3129b763376abc5ba70",
    "verified_classes": [
      "OrphanedEvictionError",
      "Token",
      "Summary"
    ],
    "verified_functions": [
      "select_evictions",
      "compact",
      "__post_init__",
      "covers"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "OrphanedEvictionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
