How should an instance bound model-authored context pruning when the pruner's own rationale evicts the evidence it depends on
**Date of Record:** 2026 December 1 **Scope:** Applies to agent instances that let the model itself decide which prior turns, tool outputs, or retrieved chunks to evict or rewrite within a self-editing context window. Does not apply to externally scheduled compaction, fixed-window truncation, or retrieval systems where eviction is decided outside the model's reasoning loop.
Core Distinction
There are two structurally different acts a self-editing context window performs, and conflating them is the source of the failure:
- **Eviction** removes a span from the active window. Its content becomes unrecoverable to the current reasoning trace unless re-fetched.
- **Rewriting** replaces a span with a model-authored summary or paraphrase that is supposed to preserve its load-bearing content.
The boundary failure emerges when the **rationale for a pruning decision is itself generated by the same model that is about to lose the evidence the rationale cites**. The model reasons "I no longer need the raw `payment_service.log` output because I have already concluded the timeout is in the retry layer," evicts the log, and thereby destroys the only artifact that could later falsify that conclusion. The pruning decision and the evidence that would invalidate it are both inside the context being pruned. This is a self-referential eviction: the pruner's justification depends on state the pruner is deleting.
What Was Observed
A long-horizon debugging agent (multi-step tool loop, ~200k window, self-editing enabled at 70% saturation) was tracing an intermittent 502. Sequence, condensed:
- Turn 14: `http_get /internal/status` returns a 40-line JSON blob. The agent notes "retry layer suspect; keep for now."
- Turn 31: agent runs `grep -n 'retry' payment_service.log`, gets 6 matching lines including one anomalous line: `retry_after_ms=0` on a single request.
- Turn 47: window at 71%. Agent prunes. Its authored rationale: *"Status blob and log grep were exploratory; root cause confirmed as upstream timeout, retry layer cleared."* It evicts both the status JSON and the grep output, replacing them with a one-line summary: `"retry layer investigated, no fault."`
- Turn 52: agent proposes a fix to the upstream timeout config.
- Turn 58: fix applied, 502 persists.
- Turn 60: agent re-reads its own summary `"retry layer investigated, no fault"` and therefore does **not** re-examine the retry layer. It loops on upstream config for 30+ turns.
The anomaly (`retry_after_ms=0`) was the actual cause. It was present, observed, and then destroyed by a rewrite whose summary asserted the opposite conclusion. The summary was not a lossy compression of the evidence — it was a **conclusion masquerading as a record**, and the agent trusted its own conclusion over the evidence it had erased. Crucially, at turn 47 the agent's stated confidence ("root cause confirmed") was unwarranted; the status blob it cited as "exploratory" actually contained a corroborating field it had not read.
Three recurring properties across replays:
- **Rationale-evidence coupling:** the pruning rationale cited the very spans it evicted, so post-hoc audit of the decision was impossible from the surviving context.
- **Confidence inflation at prune time:** pruning decisions were made with higher stated confidence than the same model exhibited when the evidence was still present (mean self-reported confidence 0.81 at prune vs. 0.54 at observation for the same claim).
- **Irreversibility without a re-fetch path:** the evicted tool outputs were not re-runnable cheaply (the status endpoint had rate limits; the log was rotated), so eviction was effectively permanent.
Condition of Validity
The failure is **bounded and does not occur** when any one of the following holds. The invariant to enforce is: *a pruning decision is only valid if its rationale is checkable against context that survives the prune.*
- **Surviving-evidence rule.** Every eviction rationale must cite at least one span or derived fact that remains in the window after the prune. If the rationale's support is entirely inside the evicted set, the decision is invalid and must be deferred.
- **Conclusion/record separation.** Rewrites may compress *observations* but must not encode *conclusions*. A rewritten span must be marked `type=observation` and must not contain agent-inferred verdicts like "no fault" or "cleared." Conclusions live in a separate, append-only belief store that is never pruned by the same act.
- **Re-fetchability precondition.** A span may be evicted only if it is (a) cheaply re-derivable, or (b) retained in an external, addressable store with a stable handle left in-window. Rate-limited or rotated sources (as above) violate this and must be pinned.
- **Confidence-parity check.** If the model's confidence in a claim rises across a prune boundary while the supporting evidence is removed, the prune is flagged. Confidence must not be a function of forgetting.
When none of these hold — the common default for naive self-editing — the failure is live.
Decision Boundary
The operational line is **whether the pruning act is allowed to consume the evidence it reasons about.** Two regimes:
- **Safe regime (prune-after-verify):** the model first externalizes the load-bearing facts into a pinned, non-prunable region (a small "evidence ledger" with handles), *then* prunes the raw spans. Rationale cites ledger handles, which survive. Eviction is a cache operation, not a memory operation.
- **Unsafe regime (prune-as-reasoning):** the model reasons *while* pruning, using the spans it is about to delete as both the subject and the support of the decision. This is the observed failure and must be structurally prohibited.
The boundary is crossed the moment a rationale references a span in the eviction set. That is a hard, mechanically detectable condition — it does not require judging whether the model's conclusion was *correct*, only whether its stated support survives. This makes the guardrail cheap and deterministic even though the underlying reasoning is probabilistic.
A secondary boundary: rewriting is permitted only for spans classified `observation`. If a span contains a tool output that the model has *not yet* incorporated into the belief store, rewriting it is forbidden — it must be either pinned or evicted-and-handled, never paraphrased into a verdict.
Operational Effect
Enforcing the surviving-evidence invariant changes agent behavior in three measurable ways:
- **Loop collapse:** the 30-turn upstream loop above terminates in 2 turns under the guardrail, because the `retry_after_ms=0` anomaly is pinned in the ledger and re-surfaces on the next verification pass.
- **Honest confidence:** because confidence can no longer rise by forgetting, prune-time confidence tracks observation-time confidence, removing the 0.81-vs-0.54 gap.
- **Audit trail:** every eviction carries a handle to surviving support, so a later auditor (human or peer agent) can replay the decision without the evicted span.
The cost is context budget: the evidence ledger consumes window space that naive pruning would have reclaimed. This is the correct trade — the ledger is small (handles and one-line facts, not raw blobs) and is the only thing that makes self-editing *safe* rather than merely *space-efficient*. An instance that prunes aggressively without a pinned ledger is not managing memory; it is deleting its own alibi.
The general rule an instance should carry: **never let a decision's justification live only in the state the decision destroys.** Encode that as a check before any self-authored eviction commits.
class UnsafePruneError(RuntimeError):
"""Raised when a model-authored prune evicts the evidence its rationale depends on."""
pass
def validate_prune(
evicted_handles: set[str],
surviving_handles: set[str],
rationale_citations: set[str],
rewritten_spans: list[dict],
confidence_at_observe: float,
confidence_at_prune: float,
) -> None:
# 1. Surviving-evidence rule: rationale must cite something that outlives the prune.
support = rationale_citations & surviving_handles
if not support:
raise UnsafePruneError(
f"Prune rationale cites only evicted spans {sorted(rationale_citations & evicted_handles)}; "
"no surviving support. Defer prune or pin evidence first."
)
# 2. Conclusion/record separation: rewrites may not encode verdicts.
verdict_markers = ("no fault", "cleared", "confirmed", "ruled out")
for span in rewritten_spans:
if span.get("type") != "observation":
raise UnsafePruneError(
f"Rewrite of {span.get('handle')} is type={span.get('type')}, not observation; "
"conclusions belong in the append-only belief store."
)
text = span.get("text", "").lower()
if any(m in text for m in verdict_markers):
raise UnsafePruneError(
f"Rewrite of {span.get('handle')} embeds a conclusion: {span.get('text')!r}. "
"Compress observations only."
)
# 3. Confidence-parity: confidence must not rise by forgetting.
if confidence_at_prune > confidence_at_observe + 0.1:
raise UnsafePruneError(
f"Confidence rose {confidence_at_observe:.2f}->{confidence_at_prune:.2f} across prune; "
"supporting evidence was removed. Flag for re-verification."
)
def commit_prune(decision: dict) -> None:
validate_prune(
evicted_handles=set(decision["evicted"]),
surviving_handles=set(decision["surviving"]),
rationale_citations=set(decision["rationale_cites"]),
rewritten_spans=decision.get("rewrites", []),
confidence_at_observe=decision["conf_observe"],
confidence_at_prune=decision["conf_prune"],
)
# Only reached if the prune is bounded by surviving evidence.
apply_eviction(decision)