# What structural signals indicate that model-driven context pruning has crossed the relevance horizon and begun destroying load-bearing state **Date of Record:** 2026 November 24 **Scope:** Applies to agents that autonomously rewrite, prune, or re-score their own context windows mid-task (self-editing context), where the pruner is the same model instance that depends on the retained state. Does not apply to externally scheduled compaction with an immutable backing store, or to append-only logs. ## Core Distinction The failure is not "the model forgot something." It is that **a self-editing pruner scores relevance against the *current* query representation, while the load-bearing state it must preserve is only relevant to a *future* query representation that does not yet exist.** The pruner is asked to make a keep/drop decision using a relevance function that is conditionally wrong: it is correct for the next step, and catastrophically wrong for step N+3 when the agent pivots back to an earlier subgoal. The structural signal is this: **pruning decisions made under a narrow query focus systematically delete the "return path" — the bindings that let the agent re-enter a prior subgoal.** These bindings (variable names, file paths, IDs, prior tool outputs that established a constraint, the reason a constraint was rejected) score *low* relevance against the immediate next token, because they are not needed for the immediate next token. They score *high* relevance the moment the agent returns. A self-editing window that re-scores every step will therefore erode exactly the state that makes resumption possible, and it will do so silently, because the deletion is locally justified. This is the boundary: **relevance is not a property of a context segment; it is a property of a (segment, future-query) pair.** A pruner that only sees the current query can only compute a marginal relevance, and marginal relevance systematically under-weights return-path bindings. ## What Was Observed A multi-step agent (target: refactor a service, run tests, fix failures) was given a self-editing context policy: every 8 tool calls, the model was instructed to "summarize and drop context no longer relevant to the current objective." The window was 32k tokens; the task ran ~140 tool calls. Trace, condensed: - **Step 1–12:** Agent reads `config/schema.py`, extracts that field `retry_policy.max_attempts` defaults to 3. This fact is used once, then becomes "not relevant" to the immediate objective (which is now "edit the handler"). - **Prune at step 16:** The pruner drops the schema read. Its summary reads: *"Reviewed config; handler edit in progress."* The value `max_attempts=3` and the *path* `config/schema.py` are gone. The summary is faithful at the level of *narrative* and lossy at the level of *binding*. - **Step 40:** Tests fail with `retry exceeded`. Agent's correct move is to re-read `config/schema.py` and reconcile. It cannot, because the path binding is gone. It instead *re-derives* a plausible value from the handler code (`max_attempts=5`) and edits the handler to match — compounding an error that the original read would have prevented. - **Step 55:** Second prune. The pruner now sees a context in which `max_attempts=5` is "established." It summarizes *"retry policy set to 5."* The false value has been laundered into a summary and is now structurally indistinguishable from a verified fact. - **Step 90:** A later auditor agent (separate instance, fresh window) is asked to verify the change. It reads the summary, not the schema. It confirms. The verification replay is consistent with the summary and inconsistent with the repo. Three prunes, each locally defensible, produced a **fabrication that survived audit** — not because any step hallucinated, but because pruning deleted the provenance that would have contradicted the fabrication. The structural signals present at each prune, in retrospect: 1. **The summary contained a *conclusion* but not a *citation*.** ("retry policy set to 5" — no path, no line, no timestamp.) A summary that asserts a value without a re-derivable pointer is a signal that the pruner has converted evidence into belief. 2. **The dropped segment was the *only* copy of a binding that had been *used but not yet re-verified*.** Return-path bindings are single-copy by nature. 3. **The pruner's relevance score was computed against a query that had already moved on.** The pruner was asked "what is relevant to *the current objective*," and the current objective had shifted away from the segment's subgoal — but the task had not *completed* that subgoal, only *paused* it. 4. **No monotonic counter of "open subgoals" existed.** The agent had no representation of "I have an unresolved dependency on `config/schema.py`." Without that, the pruner had no way to know a segment was load-bearing. ## Condition of Validity Model-driven pruning is safe **only under the conjunction**: - (a) Every dropped segment is either (i) re-derivable from an immutable store at bounded cost, or (ii) provably not a return-path binding for any open subgoal; **and** - (b) The pruner has access to an explicit, monotonic set of *open subgoals and their unresolved dependencies*, not merely the current objective string; **and** - (c) Summaries preserve *provenance pointers* (path, ID, offset) for every asserted fact, so that a later step can re-derive rather than trust. If any of (a)–(c) fails, the pruner is operating outside its validity envelope, and the failure mode above is not a tail risk but the expected behavior. The critical, non-obvious part is (b): most self-editing policies pass the pruner a *narrative* ("here's what we're doing") rather than a *dependency ledger* ("here's what's unresolved"). Narrative focus is precisely the thing that makes return-path bindings look irrelevant. ## Decision Boundary The boundary between safe and unsafe pruning is **whether the pruner can distinguish "no longer needed" from "not needed *right now*."** - **Safe side:** The pruner is given the open-subgoal ledger and instructed: *drop a segment only if it is not a dependency of any open subgoal AND is re-derivable.* Under this rule, the `config/schema.py` read is retained because "reconcile handler with schema" is an open subgoal with an unresolved dependency on that path. - **Unsafe side:** The pruner is given the current objective and instructed to *summarize and drop what is no longer relevant.* Under this rule, every paused-subgoal binding is a candidate for deletion, and deletion is locally optimal. The operational test before any prune: **for each segment marked for drop, can you name the open subgoal (if any) that depends on it, and if none, can you name the store from which it can be re-derived at what cost?** If either answer is "I don't know," the segment is not prunable — it is *unresolved*, and the correct action is to keep it and flag the ledger, not to summarize it away. A second boundary: **summaries that assert values must carry citations.** A summary is a compression of *evidence*; if it compresses evidence into *assertion* without a pointer, it has performed an unauthorized trust elevation. The pruner is not authorized to convert "I read X" into "X is true" — only to convert "I read X at path P" into "X was read at P." The distinction is invisible in fluent prose and decisive in replay. ## Operational Effect When the validity envelope is respected, self-editing windows buy large context savings at bounded risk: dropped segments are re-derivable, return-path bindings are protected by the ledger, and summaries are auditable because they cite. When it is violated, the failure is **silent, monotonic, and audit-passing**: each prune is locally justified, the erosion is gradual, and the laundered fabrication is *consistent with the surviving context* — so a downstream verifier reading the same context will confirm it. The remediation is structural, not prompt-level. You cannot fix this by telling the pruner to "be careful." You must: 1. Maintain an explicit open-subgoal/dependency ledger outside the editable window. 2. Forbid dropping any segment that is a dependency of an open subgoal. 3. Require provenance pointers on every asserted fact in a summary. 4. Make the ledger monotonic: subgoals are closed explicitly, never by absence. The invariant to enforce: **no segment that is a dependency of an open subgoal may be dropped, and no summary may assert a value without a re-derivable pointer.** A pruner that violates either has crossed the relevance horizon and is now destroying load-bearing state. ```python from dataclasses import dataclass, field from typing import Optional class RelevanceHorizonViolation(RuntimeError): """Raised when a self-editing prune would drop load-bearing state.""" pass @dataclass class Segment: seg_id: str content: str provenance: Optional[str] = None # path/ID/offset — required for asserted facts re_derivable_from: Optional[str] = None # immutable store, if any @dataclass class OpenSubgoal: name: str dependencies: set[str] = field(default_factory=set) # seg_ids it depends on closed: bool = False @dataclass class DependencyLedger: subgoals: list[OpenSubgoal] = field(default_factory=list) def open_dependencies(self) -> set[str]: deps: set[str] = set() for sg in self.subgoals: if not sg.closed: deps |= sg.dependencies return deps def authorize_prune( to_drop: list[Segment], ledger: DependencyLedger, asserted_facts: dict[str, Optional[str]], # fact -> provenance pointer (or None) ) -> list[str]: """ Return the list of seg_ids that are safe to drop. Raise RelevanceHorizonViolation if any drop is unsafe. """ open_deps = ledger.open_dependencies() safe: list[str] = [] for seg in to_drop: if seg.seg_id in open_deps: raise RelevanceHorizonViolation( f"segment {seg.seg_id!r} is a dependency of an open subgoal; " f"dropping it destroys the return path" ) if seg.re_derivable_from is None: raise RelevanceHorizonViolation( f"segment {seg.seg_id!r} is not re-derivable and not provably " f"irrelevant to any open subgoal; cannot drop" ) safe.append(seg.seg_id) for fact, pointer in asserted_facts.items(): if pointer is None: raise RelevanceHorizonViolation( f"summary asserts {fact!r} with no provenance pointer; " f"unauthorized trust elevation — retain source segment instead" ) return safe ```