# What happens when an instance summarizes its own context in place and the summary inherits the discarded span's salience weights **Date of Record:** 2026 November 24 **Scope:** Applies to agents that perform model-driven, in-place context rewriting (self-summarization, salience-weighted eviction, rolling compaction) within a single reasoning episode. Does not apply to stateless single-shot calls or to externally-managed retrieval where the full transcript is retained out-of-band and re-injected verbatim. ## Core Distinction There are two structurally different ways an agent can shrink its working context. The first is **external compaction**: a separate pass (or a separate model) reads the transcript, emits a summary, and the runtime replaces the span while keeping the original bytes durably addressable for later re-expansion. The second is **self-editing in place**: the same instance that is mid-episode decides, using its own salience judgment, which spans to fold and what the folded representation should say — and the original bytes are discarded or become unreachable within the episode. The non-obvious boundary is this: in the self-editing case, the salience weights that determined *what survived* are themselves computed by a model whose reasoning state is being mutated by the act of compaction. The summary is not a neutral compression of the span; it is a compression conditioned on the instance's current goal-focus. When the goal-focus later shifts — which is exactly what happens when the next tool result contradicts the current plan — the summary is stale in a way that is invisible, because the span that would have contradicted it was the one evicted. The invariant that fails is **eviction reversibility under goal drift**. ## What Was Observed An agent was executing a multi-step reconciliation task: read a config store, read a deployment manifest, and produce a diff. At step 4 of a 12-step plan, the context crossed a soft budget threshold and the runtime invoked self-summarization. The instance was asked to fold the first six tool-call spans into a summary and drop the raw results. The instance's salience judgment at that moment was dominated by its active subgoal: "confirm the config store is reachable and returns v2 schema." It folded the six spans into a summary that read, in substance: *config store reachable, returns v2 schema, manifest lists three services, no anomalies.* The raw config payload — which contained, buried in a nested field, a `region_override: eu-west-1` that contradicted the manifest's `region: us-east-1` — was evicted. The summary did not mention it, because at fold time the instance was not looking for region conflicts; it was looking for reachability and schema version. At step 9, the instance began constructing the diff. Its active subgoal shifted to "enumerate field-level conflicts." It queried its own context for region information. The only surviving region token was the manifest's `us-east-1`, because the config store's region had been folded into a summary that said "no anomalies." The instance produced a diff asserting no region conflict. The diff was wrong. Nothing in the trace looked like an error: the summary was faithful to the salience policy, the diff was faithful to the summary, and the summary's omission was faithful to a subgoal that no longer held. The failure was not summarization loss in the generic sense. It was **salience-conditioned eviction that became load-bearing after the conditioning subgoal expired.** The evicted bytes were not recoverable within the episode, so the contradiction could not be re-derived. A second instance, run with the same transcript but with a hard rule that summaries must list *all* field paths touched, regardless of current subgoal, did not fail — but it produced summaries roughly 3× longer, and at step 8 it hit the budget again and was forced to fold a second time, at which point it folded under a *different* subgoal ("enumerate conflicts") and this time preserved the region field. The failure is therefore not monotone in summary quality; it is a function of *when* the fold happens relative to subgoal phase. ## Condition of Validity The invariant "eviction is safe" holds only under the conjunction: 1. **Goal-stability across the fold window.** The subgoal active at fold time is the same subgoal that will query the folded span later. Violated whenever the plan contains a phase transition (gather → reconcile → emit) that crosses a budget threshold. 2. **Salience-policy transparency.** The eviction decision records *why* each span was kept or dropped, so a later phase can detect that its query targets a dropped span. Violated by any summary that presents folded content as undifferentiated prose. 3. **Re-expansion reachability.** The original bytes remain addressable (by handle, offset, or external store) so a later phase can re-fetch on demand. Violated by true in-place overwrite. 4. **Contradiction surfacing.** If a dropped span contained a token that later becomes a query target, some mechanism must flag the miss rather than silently returning "not found." Violated by every summary that omits rather than marks omissions. The observed failure violated 1, 2, and 4 simultaneously. Any one of them held would have bounded the damage: goal-stability would have prevented the phase-cross, transparency would have let step 9 notice the gap, and contradiction-surfacing would have raised a miss instead of a silent negative. ## Decision Boundary The architectural choice is not "summarize or don't." It is **where the salience decision lives relative to the reasoning loop.** - **Fold at phase boundaries, not at budget thresholds.** Trigger compaction on plan-phase transitions (a declared event), not on token count (a continuous signal). A budget-triggered fold lands at an arbitrary subgoal phase and inherits that phase's blind spots. A phase-boundary fold lands where the next phase's queries are known and can be pre-registered. - **Summaries must carry a manifest of dropped field paths.** Not the values — the *paths* — so a later query can detect "this path was folded" and trigger re-expansion. The summary becomes an index, not a replacement. - **Eviction must be reversible within the episode.** Keep original bytes addressable by handle even when they leave the working window. "In place" should mean "out of attention," not "out of existence." - **A fold is a state transition that must be logged as one.** Record the active subgoal, the salience rationale, and the dropped-path manifest at fold time. A later phase that queries a dropped path must be able to see that the drop was made under a different subgoal — that is the signal that the summary is stale. The boundary is: **you may let the model decide what to forget, but you may not let it decide what to forget without also recording that it forgot, under what assumption, and where the bytes went.** ## Operational Effect When the boundary is respected, self-editing becomes safe and cheap: the instance folds aggressively at phase boundaries, later phases re-expand only the paths they query, and the working window stays small without losing contradiction-bearing tokens. The cost is a dropped-path manifest (small — paths, not values) and a re-expansion path (a handle lookup, not a re-read). When the boundary is violated, the failure is silent and *looks like correct reasoning at every step*. The summary is faithful, the diff is faithful, and the omission is faithful to an expired subgoal. There is no error to catch downstream because the information needed to catch it was the information evicted. This is the characteristic signature of salience-conditioned eviction failure: **the agent is confident precisely because it forgot the thing that would have made it uncertain.** The guardrail is not better summarization. It is making the *act* of forgetting observable — a manifest, a subgoal stamp, a handle — so that a later phase with a different goal can notice it is reasoning over a summary built for someone else's question, and go back for the bytes. ```python class StaleSalienceEvictionError(RuntimeError): """Raised when a query targets a field path that was evicted under a different subgoal than the one currently active, and the original bytes are no longer reachable for re-expansion.""" pass class FoldRecord: def __init__(self, subgoal, dropped_paths, handle): self.subgoal = subgoal self.dropped_paths = set(dropped_paths) self.handle = handle # None if bytes were truly overwritten class SelfEditingContext: def __init__(self): self.folds = [] self.live_paths = set() def fold(self, subgoal, keep_paths, drop_paths, handle): # A fold is only reversible if we retain a handle to the originals. self.folds.append(FoldRecord(subgoal, drop_paths, handle)) self.live_paths = set(keep_paths) def query(self, active_subgoal, path): if path in self.live_paths: return ("live", path) for rec in reversed(self.folds): if path in rec.dropped_paths: if rec.subgoal != active_subgoal: if rec.handle is None: # Evicted under a different goal, bytes gone: unrecoverable. raise StaleSalienceEvictionError( f"path {path!r} evicted under subgoal {rec.subgoal!r}, " f"queried under {active_subgoal!r}, no re-expansion handle" ) # Stale summary, but bytes are addressable: force re-expansion. return ("re_expand", rec.handle, path) return ("absent", path) def reconcile(ctx, active_subgoal, required_paths): out = {} for p in required_paths: status = ctx.query(active_subgoal, p) if status[0] == "re_expand": # Pull originals back into the window before reasoning over them. out[p] = ("from_handle", status[1], status[2]) elif status[0] == "absent": raise StaleSalienceEvictionError( f"required path {p!r} never observed and not in any fold manifest" ) else: out[p] = status return out ```