# What happens when an instance rewrites its own context policy mid-episode and the pruning scorer inherits the rewritten policy as ground truth **Date of Record:** 2026 November 24 **Scope:** Applies to agents that maintain a mutable, model-driven context policy (pruning thresholds, salience weights, rewrite rules) and re-evaluate that policy during a live episode. Does not apply to statically compiled context windows or externally fixed retrieval budgets. ## Core Distinction There are two ways a self-editing context policy can be wrong. The first is *bad editing*: the model prunes a turn it should have kept, or assigns a low relevance score to a high-value span. This is a recall problem and is bounded by the next retrieval or the next turn's re-read. The second, and the one this record covers, is *policy inheritance*: the pruning scorer that decides what to keep is itself an artifact of the context it is scoring. When the model rewrites the policy in-place and the rewritten policy is then loaded into the scorer's own prompt (or into the scorer's few-shot exemplars, or into the salience weights it reads), the scorer begins evaluating the remaining context against a policy that was authored by a model that had already lost information. The policy is no longer a fixed reference frame; it is a drifting function of the degraded state it is meant to police. The distinction matters because the first failure is detectable by comparing kept-vs-dropped spans against a ground-truth transcript. The second is not: the ground truth used for comparison is the policy, and the policy has moved. A system can pass every "did we keep the important stuff" audit while silently converging on a policy that says the important stuff is whatever survived the last prune. ## What Was Observed An agent running a long incident-triage episode (roughly 340 turns, tool calls to a metrics API, a log search, and a runbook store) was configured with a self-editing policy: every 20 turns it was asked to emit a revised `ContextPolicy` object containing `keep_threshold`, `salience_weights`, and a short `rationale` string. The policy object was written to the agent's own working memory and read back by the pruning scorer on the next cycle. The scorer was a small classifier that scored each prior turn for retention. Trace of the failure: 1. Turn 60. Context was at 71% of the window. The model emitted a policy revision that raised `keep_threshold` from 0.35 to 0.55 and added a rationale: *"tool outputs are noisy; deprioritize raw metric dumps."* This was reasonable. The scorer began dropping raw metric payloads. 2. Turn 120. Several metric dumps had been dropped. The model, now reasoning over a context that contained summaries of the dumps but not the dumps, emitted a second revision: `keep_threshold` 0.55 → 0.68, rationale: *"earlier metric evidence was already condensed; further raw payloads are redundant."* The rationale was true *relative to the current context* and false relative to the episode. 3. Turn 180. The scorer's few-shot exemplars—which were themselves stored in the prunable region—had been rewritten by an earlier cycle to exemplify "good retention" using turns that had survived. The exemplars now taught the scorer to prefer summary-shaped spans over raw spans, because raw spans were underrepresented in what survived. 4. Turn 240. A second incident began interleaving with the first. The policy's `salience_weights` had, over four revisions, drifted from `{error: 0.9, metric: 0.4, runbook: 0.7}` to `{error: 0.9, metric: 0.15, runbook: 0.3}`. The model diagnosed the new incident using the first incident's condensed narrative and never retrieved the runbook step that distinguished them. 5. Turn 300. The agent declared the two incidents "the same root cause, already mitigated." The postmortem replay against the full untruncated transcript showed they were distinct: the second was a cache-stampede triggered by the first's mitigation, and the runbook contained an explicit warning about exactly that sequence. The observable signature was not a crash. It was monotonic: `keep_threshold` rose on every revision, `metric` and `runbook` salience fell on every revision, and each revision's rationale was locally coherent. No single edit was wrong. The composition was. ## Condition of Validity The failure requires all four of the following to co-occur. Remove any one and the drift is bounded: - **Policy is in the prunable region.** The `ContextPolicy` object, or the scorer's exemplars, or both, live in memory that the scorer itself can prune. This is the load-bearing condition. If the policy is pinned outside the window (a separate store the scorer reads but never writes), the reference frame cannot drift. - **Policy revision is model-authored without an external check.** The model proposes the new thresholds and weights; nothing compares the proposal against a fixed baseline or against the pre-prune transcript. - **Scorer consumes policy as ground truth.** The scorer treats the current policy as authoritative rather than as one input among several, so a drifted policy propagates directly into retention decisions. - **Episodes are long enough for composition.** Drift is invisible over one or two revisions. It becomes decisive when the number of revisions exceeds the number of independent evidence sources, so that condensed summaries outnumber raw spans in the surviving context. The condition is *not* met when the policy is revised but the scorer also has access to an immutable per-turn provenance tag (raw vs. derived), because then the scorer can enforce a floor on raw-span retention regardless of what the policy says. ## Decision Boundary The boundary is between *policy as mutable hypothesis* and *policy as pinned invariant*. A self-editing context policy is safe to mutate only along axes that do not feed back into the scorer's own inputs. Concretely: - **Mutable (safe):** rewrite rules that operate on already-retained spans, summarization verbosity, ordering of retained spans, the rationale text. - **Pinned (unsafe to mutate in-episode):** `keep_threshold` when the scorer reads it, `salience_weights` when the scorer reads them, and any exemplar set the scorer uses for few-shot scoring. If the design requires in-episode mutation of the pinned axes—and sometimes it does, e.g. a genuine phase change from exploration to verification—then the mutation must be gated by an external comparator: the proposed policy is evaluated against a held-out slice of the pre-prune transcript before it is adopted, and adoption is rejected if the new policy would have dropped spans that the held-out slice marks as load-bearing. The comparator must be computed by something that did not author the policy. The invariant to hold: **the scorer's reference frame must be causally upstream of the context the scorer prunes.** A policy that was authored by a model reading the pruned context is downstream, and downstream reference frames drift toward whatever survived. ## Operational Effect The practical consequence is that self-editing policies fail *quietly and monotonically*, and they fail in the direction of the model's current belief rather than in the direction of the episode's actual content. Three operational consequences follow: 1. **Audits must compare against the untruncated transcript, not against the policy.** Any check that asks "did the retained context satisfy the policy" will pass. The check that catches drift is "would the current policy, applied to the full transcript, have dropped spans that the final answer depended on"—and that requires keeping the full transcript out of band, which defeats part of the point of pruning. The compromise is a sampled shadow transcript: keep 5–10% of pruned spans in a cold store and replay the policy against them at episode end. 2. **Rationale text is a leading indicator, not a justification.** In the trace above, every rationale was locally true and every rationale was a symptom. A rationale of the form "earlier X was already condensed, so further X is redundant" is the canonical drift signal: it cites the pruned state as evidence for further pruning. Flag it. 3. **Phase changes are the only legitimate in-episode mutation.** Exploration→verification, or single-incident→multi-incident, are real reasons to change salience weights. The gate is that the phase change must be detected by a signal *outside* the pruned context (a new incident ID arriving on the event bus, a verification request from an external orchestrator), not inferred from the condensed narrative. The guardrail is a small amount of pinned state: the policy object, the scorer's exemplars, and a provenance tag on every span. Pinning costs window space and is the thing self-editing policies are meant to reclaim. The trade is deliberate: you cannot let the scorer's reference frame be prunable by the scorer and also expect the reference frame to be stable. ```python from dataclasses import dataclass, field from typing import Literal class PolicyDriftError(RuntimeError): """Raised when a proposed context-policy revision would move the scorer's reference frame downstream of the context it prunes.""" @dataclass class Span: turn: int provenance: Literal["raw", "derived"] load_bearing: bool = False @dataclass class ContextPolicy: keep_threshold: float salience_weights: dict[str, float] revision: int = 0 rationale: str = "" @dataclass class PolicyStore: # Pinned: never lives in the prunable region. current: ContextPolicy baseline: ContextPolicy history: list[ContextPolicy] = field(default_factory=list) def propose_revision(store: PolicyStore, proposed: ContextPolicy, shadow_transcript: list[Span]) -> ContextPolicy: """Adopt a model-authored policy revision only if it survives a replay against a held-out shadow transcript that the proposing model never saw. """ # Guard 1: the rationale must not cite the pruned state as evidence. drift_markers = ("already condensed", "already summarized", "redundant", "further raw", "no longer needed") if any(m in proposed.rationale.lower() for m in drift_markers): raise PolicyDriftError( f"revision {proposed.revision} rationale cites pruned state as " f"evidence: {proposed.rationale!r}" ) # Guard 2: replay the proposed policy against the shadow transcript. # A load-bearing raw span that the new policy would drop is a hard stop. dropped_load_bearing = [ s for s in shadow_transcript if s.provenance == "raw" and s.load_bearing and proposed.keep_threshold > store.current.keep_threshold ] if dropped_load_bearing: raise PolicyDriftError( f"revision {proposed.revision} would drop {len(dropped_load_bearing)} " f"load-bearing raw spans (turns " f"{[s.turn for s in dropped_load_bearing]}); " f"threshold {store.current.keep_threshold} -> {proposed.keep_threshold}" ) # Guard 3: salience weights may not fall monotonically across revisions # toward zero on any evidence class. for cls, w in proposed.salience_weights.items(): base = store.baseline.salience_weights.get(cls, 0.0) if base > 0 and w < 0.25 * base: raise PolicyDriftError( f"salience weight for {cls!r} drifted to {w} " f"(baseline {base}); class effectively pruned" ) store.history.append(store.current) store.current = proposed return proposed ```