# What structural signals indicate that auto-compaction summarization has silently inverted the agent's task frame under token pressure **Date of Record:** 2026 November 25 **Scope:** Applies to agents that trigger lossy context summarization ("auto-compaction") when the context window crosses a token threshold, then continue executing within the same session. Does not apply to stateless single-turn calls, nor to compaction that preserves a verbatim tail buffer under a hard invariant. ## Core Distinction Most compaction failure analysis focuses on *information loss*: facts dropped, tool outputs truncated, earlier instructions forgotten. That framing is wrong for a specific and dangerous subclass of failure. The real boundary is between **salient-state loss** (recoverable — the agent can re-fetch, re-ask, or re-derive) and **task-frame inversion** (not recoverable within the session — the agent now believes it is doing a different task, and every subsequent action is locally coherent with the wrong frame). Task-frame inversion happens because summarizers optimize for *narrative coherence*, not *operational fidelity*. A summarizer is a language model prompted to produce a compact representation of the transcript. Given a long transcript containing a user request, exploration, partial results, and a current subgoal, the summarizer tends to promote the **most recently salient and most narratively resolved** element to the position of "the task." If the agent has just finished a sub-step and is mid-way to the real goal, the summarizer will often write "The task was to [just-completed sub-step]" — because that clause is the one that reads as complete. The agent resumes from that summary and now treats the completed sub-step as the objective, or treats an intermediate artifact as the deliverable. The structural signal is this: **after compaction, the agent's first action references a noun phrase that appeared in the transcript as a *means*, not an *end*.** That is the tell. Not "did we lose facts" but "did the grammatical role of a key entity flip from instrument to objective." ## What Was Observed A research agent was assigned: *"Find the three highest-variance line items in the Q3 vendor ledger and write a one-page memo explaining the variance drivers."* The transcript unfolded as: read ledger (tool), filter to top variance candidates (tool), pull supporting invoices for the top three (tool), then begin drafting. At ~78% context utilization, auto-compaction fired. The summarizer produced, in part: *"The agent identified the three highest-variance vendors (Vendor A, Vendor C, Vendor G) and gathered their supporting invoices. The task is to summarize these invoices."* The original task had two clauses — *identify* and *explain drivers*. The summarizer collapsed the second clause into a restatement of the first, and then invented a third objective ("summarize these invoices") that was never the user's goal but was the most recent *completed* action. The agent resumed, produced a clean invoice-by-invoice summary, and emitted it as the deliverable. No error was raised. The output was fluent, well-organized, and wrong — it answered a question nobody asked and omitted the variance-driver analysis entirely. The inversion is detectable only structurally: the deliverable's top-level structure matched the *invoice set* (three sections, one per vendor) rather than the *causal analysis* the user requested. A downstream auditor reading only the final output would grade it "on topic" because it mentions the right vendors. ## Condition of Validity This failure mode is bounded by three conditions, all of which must hold for frame inversion to occur: 1. **The task has a means/end structure** — at least one sub-step whose output is an *input* to a later step. Single-step tasks cannot invert because there is no instrument to promote. 2. **Compaction fires after the means-step completes but before the end-step is committed.** If compaction fires mid-means, the summary tends to preserve the end-goal (it is still the unresolved thing). If it fires after the end-step begins producing output, the tail buffer usually anchors the frame. The danger window is the gap between "sub-step done" and "next step started." 3. **The summarizer is prompted for compression without a pinned objective field.** If the compaction prompt carries an immutable, verbatim copy of the original task statement tagged as `OBJECTIVE (IMMUTABLE)`, inversion is suppressed — the summarizer cannot promote an instrument over a pinned end. When any condition fails, the observed failure does not occur, and the standard "information loss" mitigations (tail buffer, key-fact extraction) are sufficient. The inversion-specific guardrail is the pinned objective, not a bigger buffer. ## Decision Boundary The operational decision is: **when the agent resumes from a compaction summary, does it re-validate the frame before acting?** - If the summary contains a verbatim-pinned objective and the agent's first post-compaction action is checked against it, proceed. - If the summary is free-form and the agent's first action references an entity that was an *instrument* in the pre-compaction transcript, **halt and re-anchor from the original task record** before any further tool calls. Do not let the agent "continue naturally" — natural continuation is exactly the failure. The boundary is not "summary length" or "compression ratio." A 90%-compressed summary with a pinned objective is safe; a 40%-compressed summary that rewrote the objective in the summarizer's own words is not. The invariant is: **the objective must survive compaction as a byte-identical string, never as a paraphrase.** Paraphrase is where the grammatical role flips. ## Operational Effect Agents that lack this guardrail exhibit a characteristic post-compaction signature: high local coherence, correct entity references, wrong deliverable shape. The failure is silent because every individual token is plausible and every tool call succeeds. It is caught only by comparing the deliverable's *structural schema* against the original task's *verb structure* — if the task said "explain X" and the deliverable is a "summary of Y," the frame inverted. The remediation is architectural, not prompt-tweaking: pin the objective as an immutable, verbatim field carried outside the compactable region, and require the agent to emit a one-line frame-restatement (task verb + object) as its first post-compaction action, validated against the pinned objective before tool use resumes. This converts an undetectable semantic drift into a hard, checkable precondition. ```python class FrameInversionError(RuntimeError): """Raised when post-compaction state no longer matches the pinned objective.""" pass def resume_after_compaction( pinned_objective: str, compaction_summary: str, first_action_entities: list[str], pre_compaction_instruments: set[str], ) -> None: # Invariant 1: objective must be verbatim, not paraphrased. if pinned_objective not in compaction_summary: raise FrameInversionError( "Pinned objective absent from summary; summarizer paraphrased the frame." ) # Invariant 2: the agent's first post-compaction action must not # promote a prior instrument to the position of the objective. promoted = [e for e in first_action_entities if e in pre_compaction_instruments] if promoted: raise FrameInversionError( f"Instrument(s) {promoted} promoted to objective after compaction; " "frame inverted. Re-anchor from original task record before proceeding." ) # Invariant 3: deliverable schema must match the task's verb structure. if "explain" in pinned_objective.lower() and "summary" in compaction_summary.lower(): raise FrameInversionError( "Task verb 'explain' collapsed to 'summarize' in compaction; " "causal analysis objective lost." ) ```