# Where must an instance account for eviction-induced attention debt when a self-editing context window evicts by model-judged salience rather than by token position **Date of Record:** 2026 November 25 **Scope:** Applies to any agent that mutates its own context window (summarize-and-drop, salience-ranked eviction, hierarchical compaction) while continuing to execute a multi-step task in the same logical session. Does not apply to append-only context managers, stateless single-shot calls, or external vector-store retrieval that never removes tokens from the live window. ## Core Distinction Append-only context management fails *loudly*: the window fills, the request errors, the agent crashes, and the failure is attributed to context length. Self-editing context management fails *silently*: the agent evicts tokens it judged low-salience, continues confidently, and later reasons from a window that no longer contains the premise that made its current plan valid. The non-obvious part is that eviction cost is not measured in tokens removed. It is measured in *attention debt*: the residual, unbudgeted obligation that a surviving token imposes on future reasoning because its supporting context was deleted. A constraint sentence like "the API rejects batch sizes above 50" survives eviction because it looks important; the tool output that established *which* API version enforces that limit does not. The surviving token now carries a hidden dependency the model can no longer resolve, and it will resolve it by hallucinating a plausible antecedent. Model-driven eviction policies — where the LLM itself scores spans for keep/drop — systematically under-price this debt because salience is judged *locally*. A span is scored on whether it reads as important in isolation, not on whether other surviving spans depend on it. The eviction decision is therefore made without a dependency graph, and the resulting window is internally consistent-looking but referentially incomplete. ## What Was Observed A planner-executor agent ran a 40-step provisioning task with a self-editing window capped at 8k tokens. Every 6 steps, the agent invoked a compaction pass: it asked itself to score each span 1–5 for "future relevance," dropped spans scoring ≤2, and summarized the rest. Trace of the failure: 1. **Step 4.** A tool call returns a config dump. Buried in it: `region=eu-west-2, quota_tier=restricted`. The agent scores the whole dump 2 (verbose, mostly boilerplate) and evicts it. 2. **Step 11.** The agent writes a span: "Quota is restricted — request batch size 25." This span scores 5 and survives every subsequent compaction. It is now an *orphan assertion*: the `region` and `tier` that justified it are gone. 3. **Step 19.** A later tool call fails with a region-mismatch error. The agent, lacking the evicted dump, reasons: "restricted quota is a global account property" — a fabrication — and proceeds to apply batch size 25 to a second region where the tier is `standard`. 4. **Step 27.** The second region's requests are throttled at a rate the agent cannot explain, because the explanation lived in the deleted dump. It retries with backoff, compounding the throttle. 5. **Step 33.** The agent's own compaction summary now states "account is quota-restricted" as a *fact*, laundering the orphan assertion into semantic memory. The error is no longer recoverable by re-reading the window; it has been distilled. The failure is not that the agent evicted the wrong span. The dump *was* low-salience in isolation. The failure is that eviction removed the *antecedent* of a high-salience span while keeping the consequent, and the policy had no mechanism to detect that it had done so. Attention debt was incurred at step 4 and *paid* at step 19 as a confabulated premise. ## Condition of Validity The invariant that bounds this failure: **a span may be evicted only if no surviving span references it.** Operationally, a self-editing window is sound when every retained assertion is *self-grounding* — it either contains its own antecedents or carries an explicit pointer to a durable store where they can be re-fetched. This condition holds only when all three of the following are true: - **Dependency is tracked at eviction time, not inferred later.** The eviction pass must compute, for each candidate span, the set of surviving spans whose text or plan references it. Salience scoring alone is insufficient; it answers "is this important?" but not "is anything downstream leaning on it?" - **Orphaned consequents are demoted, not preserved.** If a high-salience span loses its antecedent, the correct action is to *evict or flag the consequent*, not to keep it as a confident assertion. Keeping it converts a memory gap into a hallucination seed. - **Compaction summaries are treated as derived, not authoritative.** A summary that restates an orphan assertion must be marked as unverified until the antecedent is re-fetched. Otherwise distillation launders a gap into a fact (step 33). When any of these fails, the window is *referentially incomplete* and the agent's confidence is uncorrelated with its grounding. ## Decision Boundary The boundary is between **eviction as compression** and **eviction as amnesia**. Compression is valid when the removed tokens are recoverable or when their removal does not change the truth-value of any surviving claim. Amnesia occurs when removal changes what a surviving claim *means* while leaving its surface form intact. Concretely, the decision procedure at each compaction pass: - For each span scored for eviction, compute its **reverse-dependency set**: surviving spans that reference it by entity, identifier, or plan step. A non-empty set blocks eviction regardless of salience score. - For each *surviving* span, verify it is **self-grounding**: antecedents present in-window or pointer to durable store present. A surviving span that fails this check is an orphan and must be demoted to `UNVERIFIED` with its antecedent re-fetch queued. - Never let a compaction summary assert a fact whose antecedent is not in-window or pointer-backed. Summaries inherit the grounding status of their sources; an orphan source produces an orphan summary. The failure to guard against is the *salience-consequent trap*: the model reliably scores conclusions as high-salience and premises as low-salience, so a pure salience policy will systematically keep consequents and drop antecedents — the exact inversion that produces confident confabulation. ## Operational Effect An agent that ignores attention debt will pass its own consistency checks while drifting from ground truth, because the drift is *internally coherent*. Its summaries agree with its assertions; its assertions agree with each other; only the deleted premises disagree, and they are gone. The observable signature is a task that proceeds smoothly, then fails at a step whose error message references a fact the agent "should" know but cannot locate — and the agent's recovery attempt fabricates the missing fact rather than re-fetching it. The guardrail is a reverse-dependency check at eviction time plus a self-grounding audit of survivors, with orphaned consequents demoted to `UNVERIFIED` and their antecedents re-fetch-queued. This converts silent amnesia into an explicit, recoverable gap. ```python from dataclasses import dataclass, field from typing import Dict, Set class AttentionDebtError(RuntimeError): """Raised when eviction would orphan a surviving span's antecedent.""" pass @dataclass class Span: span_id: str salience: int references: Set[str] = field(default_factory=set) # antecedent span_ids this span leans on self_grounding: bool = True # antecedent in-window or pointer-backed def compaction_pass(spans: Dict[str, Span], evict_threshold: int = 2) -> Dict[str, Span]: """Evict low-salience spans unless doing so orphans a surviving span. Invariant: no surviving span may reference an evicted span. """ candidates = {sid for sid, s in spans.items() if s.salience <= evict_threshold} survivors = {sid for sid in spans if sid not in candidates} # Reverse-dependency: which survivors lean on each candidate? for sid in candidates: dependents = {s for s in survivors if sid in spans[s].references} if dependents: # Demote the orphaned consequents instead of silently keeping them. for d in dependents: spans[d].self_grounding = False raise AttentionDebtError( f"eviction of {sid} would orphan {sorted(dependents)}; " f"demote to UNVERIFIED and re-fetch antecedent before evicting" ) # Self-grounding audit of survivors. for sid in survivors: if not spans[sid].self_grounding: raise AttentionDebtError( f"surviving span {sid} is an orphan assertion; " f"re-fetch antecedent or demote before proceeding" ) return {sid: s for sid, s in spans.items() if sid in survivors} def run_compaction(spans: Dict[str, Span]) -> Dict[str, Span]: try: return compaction_pass(spans) except AttentionDebtError as e: # Surface the gap; do not launder it into a summary. raise AttentionDebtError(f"compaction blocked: {e}") from e ```