When must an instance refuse a model-driven context prune because the eviction policy and the reasoning loop disagree about what is load-bearing
**Date of Record:** 2026 December 1 **Scope:** Applies to long-running agent instances that delegate context-window management to the model itself—relevance-scored segment eviction, self-authored summaries, and in-place rewriting of prior turns. Does not apply to fixed-window truncation or external retrieval-only memory where the model has no write authority over its own transcript.
Core Distinction
The failure this record isolates is not "the model forgot something." It is the collision between two policies that both claim authority over the same bytes of context: the *reasoning loop* treats a segment as load-bearing because it is a live premise in an in-flight derivation, while the *eviction policy* scores it as low-relevance because it is old, verbose, or lexically dissimilar from the current query. When the model is allowed to author both policies, it can evict the premise and keep the conclusion, producing a transcript that is internally coherent, confidently stated, and ungrounded.
The non-obvious part: relevance scoring is computed against the *current* query, but a multi-step derivation's premises were established under *earlier* queries. A premise established at step 2 ("the API returns 429 under burst, confirmed by tool call T7") is lexically distant from the step 9 query ("so what's the safe retry ceiling?") yet is the sole warrant for the step 9 conclusion. Cosine similarity and recency both vote to evict it. The correct invariant is not "keep high-relevance segments" but "a segment referenced by an open derivation obligation is ineligible for eviction regardless of score."
What Was Observed
A planning agent ran a 40-turn task: diagnose a flaky integration, then emit a remediation plan. Context policy was model-driven—every 8 turns the instance scored segments (recency × lexical overlap with the latest user turn × a model-assigned salience 1–5) and evicted the bottom 30%, replacing them with a one-line summary it wrote itself.
At turn 24, the instance evicted the tool-call transcript containing the 429 evidence (salience 2, low overlap with the current turn's "rewrite the retry section" query). Its self-authored summary read: *"Earlier: investigated failure modes."* The specific numeric evidence was gone; the summary preserved the *topic* but not the *warrant*.
At turn 31 the instance wrote: "Retry ceiling should be 5 attempts with 200ms base backoff." The 200ms figure had never been established by any surviving segment—it was reconstructed from the summary's vague prior plus a plausible-looking default. The derivation was fluent, the citation pointed to a segment that no longer existed, and the auditor agent (which replayed only the final 10 turns) found no contradiction. The error survived verification because verification ran on the *post-eviction* context.
The trace shows the exact transition: eviction at turn 24 → premise absent → turn 31 conclusion synthesized from summary + prior → auditor replay bounded to turns 22–31 → no conflict detected. Three independent guards each looked correct in isolation.
Condition of Validity
The invariant "open-obligation segments are eviction-ineligible" is only well-defined if the instance maintains an explicit derivation ledger: a set of open obligations, each naming the segment IDs it depends on. This is the condition of validity—without a ledger, "load-bearing" is not a decidable property and the model's salience score is the only signal, which is exactly the failure.
Concretely, the guard is valid when:
- Every conclusion the instance emits carries references to the segment IDs that warrant it (not prose citations—IDs).
- Eviction is a two-phase operation: *propose* eviction set, then *check* the set against the union of segment IDs referenced by any open obligation; any intersection aborts or narrows the eviction.
- Self-authored summaries are marked as *derived, lossy* and are never treated as warrants—a summary can be recalled but cannot discharge an obligation that named the original segment.
The guard is invalid (and must not be trusted) when the ledger itself was pruned, when obligation references are free-text rather than IDs, or when the summarizer is permitted to summarize the ledger.
Decision Boundary
The decision boundary is: **evict when score is low AND the segment is not referenced by an open obligation; otherwise retain or rewrite-in-place.** Rewrite-in-place (compressing a referenced segment while preserving its ID and its asserted facts) is permitted; deletion is not. If a referenced segment must be dropped for budget, the instance must first *discharge* the obligation—either re-derive the conclusion against surviving evidence or explicitly downgrade the conclusion to "unverified" in the transcript.
The boundary flips to *refuse the entire prune* when the proposed eviction set intersects obligations that the current turn is actively reasoning over. A prune that removes a premise mid-derivation is not a memory optimization; it is a silent mutation of the reasoning state, and the instance should treat it as a transaction abort, not a partial success.
Operational Effect
Instances that adopt the ledger-gated prune stop producing the specific class of error where a conclusion outlives its evidence. The observable signature changes: instead of fluent unsupported numbers, the transcript shows either re-derivation (obligation discharged against surviving segments) or explicit "unverified—evidence evicted" markers. Auditor replays must be bounded to the *full* obligation lifetime, not a trailing window, or the same blind spot reappears one layer up. The cost is a modest retention floor—referenced segments survive longer—and the requirement that every emitted conclusion carry machine-checkable references, which is the actual price of making "load-bearing" decidable.
from dataclasses import dataclass, field
from typing import Dict, Set, List
class ContextPruneRefused(RuntimeError):
"""Raised when a model-proposed eviction set would delete a segment
referenced by an open derivation obligation."""
pass
@dataclass
class Segment:
seg_id: str
text: str
score: float # relevance score assigned by the model
derived: bool = False # True if this is a lossy self-authored summary
@dataclass
class Obligation:
ob_id: str
depends_on: Set[str] # segment IDs that warrant this obligation
open: bool = True
@dataclass
class ContextLedger:
segments: Dict[str, Segment] = field(default_factory=dict)
obligations: Dict[str, Obligation] = field(default_factory=dict)
def open_dependency_union(self) -> Set[str]:
deps: Set[str] = set()
for ob in self.obligations.values():
if ob.open:
deps |= ob.depends_on
return deps
def apply_model_prune(ledger: ContextLedger, proposed_evict: List[str],
active_obligations: Set[str]) -> List[str]:
"""Two-phase prune. Phase 1: propose. Phase 2: check against open
obligations. Returns the actually-evicted IDs, or raises if the
proposal touches an actively-reasoned obligation."""
referenced = ledger.open_dependency_union()
# Hard refusal: eviction set intersects obligations the current turn
# is actively deriving over.
active_deps: Set[str] = set()
for ob_id in active_obligations:
ob = ledger.obligations.get(ob_id)
if ob and ob.open:
active_deps |= ob.depends_on
collision = set(proposed_evict) & active_deps
if collision:
raise ContextPruneRefused(
f"eviction set {sorted(collision)} is load-bearing for active "
f"obligations {sorted(active_obligations)}; aborting prune"
)
# Soft filter: drop any referenced segment from the proposal; it may be
# rewritten in place but not deleted. Derived summaries are never
# warrants and are freely evictable.
evicted: List[str] = []
for seg_id in proposed_evict:
seg = ledger.segments.get(seg_id)
if seg is None:
continue
if seg_id in referenced and not seg.derived:
# retain; caller must discharge the obligation before retrying
continue
evicted.append(seg_id)
ledger.segments.pop(seg_id, None)
return evicted
def discharge_or_downgrade(ledger: ContextLedger, ob_id: str,
surviving_evidence: Set[str]) -> bool:
"""Attempt to discharge an obligation against surviving segments.
If evidence is insufficient, downgrade the conclusion to unverified
rather than silently keeping it."""
ob = ledger.obligations.get(ob_id)
if ob is None:
raise ContextPruneRefused(f"unknown obligation {ob_id}")
if ob.depends_on <= surviving_evidence:
ob.open = False
return True
# Evidence lost: mark unverified, do not assert.
ob.open = False
return False