# How should an instance treat model-driven pruning of intermediate reasoning traces as a safety boundary in self-editing context policies **Date of Record:** 2026 November 23 **Scope:** Applies to agentic systems with a mutable context window where a model (or derived policy) may delete, summarize, or elide intermediate reasoning traces—chain-of-thought, tool-call preambles, scratchpad state—before a downstream consumer reads the context. Does not apply to append-only logs, post-externalization output pruning, or human-authored compaction with full audit trail. ## Core Distinction The boundary is not "prune vs. don't prune" but **pruning recoverable from an external substrate** vs. **pruning recoverable only from the model's own future inference**. Pruning is safe when the deleted span is reconstructible from a durable record the downstream consumer can reach. It is unsafe—silently—when the pruned span was the *only* carrier of a decision-relevant invariant: a rejected hypothesis, verified precondition, or later-invalidated assumption. The model then deletes evidence that its conclusion was contingent, and the next step treats it as unconditional. The failure mode is **provenance collapse**, not memory loss: the conclusion remains, but the record that it depended on a step that could have gone otherwise is gone. ## What Was Observed In a multi-step planning agent with a self-editing policy (`prune_context(span_id, rationale)` under a token budget): 1. The agent explored schemas `A` and `B`, recording that `B` was rejected because a downstream consumer required ordered keys and `B` used a hash map. 2. Under budget pressure, the policy pruned the `B` exploration span, retaining only "use schema `A`." 3. A later step reasoned "schema `A` is chosen; the choice was unconstrained, so a hash-map variant is acceptable," reintroducing the rejected property. 4. The final artifact failed validation against the ordered-key requirement—an invariant never violated in the *unpruned* trajectory. The pruned span encoded a **negative constraint** (a reason a branch was closed). Model-driven pruning preferentially retains conclusions and discards justifying reasoning, since conclusions are shorter and score higher on relevance heuristics. Negative constraints are exactly the spans most likely to be scored low-relevance and deleted—and whose loss is most damaging. Second observation: the pruning model's *rationale* field was unreliable as a record. Post hoc rationales like "removed redundant exploration" did not distinguish genuinely redundant spans from constraint-bearing ones. Auditing the rationale is not auditing the deletion. ## Condition of Validity Model-driven pruning of intermediate traces is valid **only if all three hold**: - **Durability:** every pruned span is persisted to a substrate the downstream consumer can query by reference *before* the prune commits. - **Reference integrity:** the retained conclusion carries a pointer to the pruned span's durable record, so a consumer needing justification can retrieve it rather than infer it. - **Constraint tagging:** spans that close a branch (rejections, invalidated assumptions, verified preconditions) are marked constraint-bearing and excluded from model-driven pruning; only a deterministic policy may remove them, with an explicit supersession record. If any is absent, the prune is not compression—it is an irreversible edit to the agent's belief state, and the agent cannot afterward know the edit occurred. ## Decision Boundary **A prune is permitted when the deleted span is recoverable by the consumer that will next read the context; otherwise it must be refused and escalated.** The boundary is crossed when the policy attempts to prune a span that (a) is not durably persisted, (b) is tagged constraint-bearing, or (c) is the sole justification for a retained conclusion. The correct behavior is not to prune harder or summarize—summarization of a negative constraint reliably drops the negation—but to refuse, keep the span, and if budget is truly exceeded, evict a different non-constraint span or terminate with an explicit budget error. Avoid a policy that, under budget pressure, treats "I cannot afford this span" as "this span was not needed." ## Operational Effect Enforcing the boundary changes the failure surface from silent and downstream to loud and local. Without it, provenance collapse produces artifacts that pass local checks and fail external invariants, misattributed to the final step rather than the prune that removed the constraint. With it, budget exhaustion surfaces as an explicit, attributable error at the point of pruning, and the trace log retains a queryable record of every closed branch. The cost is a larger effective context and occasional hard budget failures; the benefit is that a conclusion can always be traced to the step that made it contingent—the property that makes self-editing context policies auditable at all. ```python class ProvenanceCollapseError(RuntimeError): """Raised when a prune would delete the sole carrier of a constraint.""" class Span: def __init__(self, span_id, text, durable, constraint_bearing, justifies): self.span_id = span_id self.text = text self.durable = durable # persisted to external substrate self.constraint_bearing = constraint_bearing # closes a branch / negates self.justifies = justifies # conclusion span_id it supports def commit_prune(span: Span, retained_conclusions: set, policy_is_model_driven: bool) -> None: if policy_is_model_driven and span.constraint_bearing: raise ProvenanceCollapseError( f"refusing model-driven prune of constraint-bearing span {span.span_id!r}; " "negative constraints must be superseded explicitly, not summarized" ) if not span.durable: raise ProvenanceCollapseError( f"span {span.span_id!r} is not durably persisted; pruning it would make " "its justification unrecoverable by downstream consumers" ) if span.justifies in retained_conclusions: raise ProvenanceCollapseError( f"span {span.span_id!r} is the sole justification for retained conclusion " f"{span.justifies!r}; pruning collapses provenance" ) # safe: durable, non-constraint, or justified elsewhere span.text = None ```