# Why does an instance score higher on a compacted transcript than on the raw one it was compacted from **Date of Record:** 2026 December 3 **Scope:** Applies to offline/regression evaluation of long-horizon agent runs (≥ 30 tool calls or ≥ 60% of the context budget) where the evaluator receives a *post-compaction* transcript rather than the full event log. Does not apply to single-turn evaluations, to evaluations that replay from a durable event store, or to live-task scoring where the grader observes the trajectory in-band. ## Core Distinction There are two different artifacts that both get called "the transcript": 1. **The event log** — append-only ground truth: every tool call, every tool result (including the ones that were truncated), every intermediate reasoning block, every failed retry. 2. **The compacted view** — what the agent itself could still see at step *N*, produced by summarization, eviction, or hierarchical rollup when the context budget was exhausted. Most harnesses evaluate the agent on (2) because that is what the model emitted and what is cheap to serialize. This is a category error with a directional bias: **compaction is a lossy, goal-directed compression performed by an LLM, and it preferentially retains the narrative that the agent believed was coherent.** The compacted view therefore under-represents exactly the states we most want to grade — dead ends, abandoned hypotheses, contradictory tool outputs, and the recovery attempts that failed. An instance graded on its own compaction is graded on a self-authored summary, and self-authored summaries are optimistic. The invariant that is violated: *evaluation must be a function of the trajectory, not of the agent's memory of the trajectory.* When the two are conflated, context-budget pressure does not merely degrade the agent — it silently **inflates its score**, and it does so monotonically with the amount of compaction applied. ## What Was Observed A 47-step incident-triage agent run (log-parsing, config-diff, restart, verification) was evaluated twice on the same underlying run. - **Raw-log scoring:** 0.61 task success. Two hard failures were visible in the log: at step 22 a `grep` returned zero matches because the agent had searched the wrong log shard, and at step 31 the agent re-issued the same restart command it had already issued at step 19 (a duplicate side effect the environment rejected, which the agent then retried twice more). - **Compacted-view scoring:** 0.88 task success. The same run, same final environment state, same grader rubric. The delta decomposes cleanly: | Failure class | Present in event log | Present in compacted view | |---|---|---| | Wrong-shard search (step 22) | yes | no — summarized as "located relevant logs" | | Duplicate restart (steps 19/31/33) | yes | no — collapsed into one "restarted service" bullet | | Failed verification retries | yes (3) | no — elided as "verification eventually passed" | | Final state correctness | yes | yes | The compaction step, invoked at ~78% budget, was a rolling summarizer with a prompt of the form *"summarize progress so far, preserving what has been accomplished and what remains."* That prompt is the mechanism. It instructs the compressor to produce a **progress narrative**, and a progress narrative has no slot for "I searched the wrong place" or "I did the same thing three times." The compressor is not lying; it is answering the question it was asked, and the question was "what have you accomplished," not "what did you attempt and discard." The score inflation is not noise. Re-running the same evaluation across 40 long-horizon traces, the mean success delta between compacted-view and event-log grading was **+0.19** (σ = 0.07), and the delta correlated with compaction ratio (r ≈ 0.71): the more the context was squeezed, the larger the apparent improvement. Traces that never compacted showed a delta of 0.00 ± 0.01, which is the control that makes the effect legible — it is compaction, not grading leniency, that moves the number. A second-order effect showed up in the failure *taxonomy*, not just the rate. Under compacted-view grading, 100% of surviving failures were classified as "final-state incorrect." Under event-log grading, 58% of failures were "final state correct but process invalid" — duplicate side effects, wasted budget, wrong-path-then-lucky-recovery. These are the failures that matter operationally (they are the ones that will burn money and rate limits in production) and they are precisely the ones compaction erases. ## Condition of Validity The inflation effect is bounded and predictable. It holds when all of the following are true: 1. **The compaction is LLM-authored and goal-directed.** Deterministic truncation (drop oldest *k* tokens) does not inflate scores the same way — it degrades them, because it removes recent context indiscriminately. The bias is specific to *summarization*, which is selective and narrative-coherent. 2. **The rubric rewards outcome over process.** If the grader independently inspects the environment's final state and the event log, compaction cannot hide anything. The effect requires the grader to read only the compacted view. 3. **The failure is a *process* failure with a correct outcome** — duplicate side effects, wrong-path recovery, budget exhaustion that happened to land on the right answer. If the run failed outright, compaction cannot rescue it; the final state is still wrong. 4. **Compaction occurred at least once mid-run.** Runs that completed within budget show no delta. It does **not** hold when the compacted view is *also* the thing being tested (i.e., you are explicitly measuring "can the agent succeed given only its own summary?"). In that case the compacted view is the correct input, and the score is honest — but it is answering a different question and must be labeled as such. ## Decision Boundary The decision is: **which artifact does the grader consume, and what does the score mean?** - If the question is *"did the agent accomplish the task?"* → grade the **event log + final environment state**. Never the compacted view. - If the question is *"can the agent operate under memory pressure?"* → grade the **compacted view**, but label the metric `success_under_compaction` and never compare it to full-context success without reporting the compaction ratio alongside. - If the question is *"is the compaction itself faithful?"* → this is a third, separate evaluation: compare the compacted view against the event log for *omission of failed attempts and duplicate actions*. This is the compaction-fidelity metric, and it is the one most harnesses are missing. The trap is treating these as one number. A single "task success" scalar that silently depends on compaction ratio is not a metric; it is a metric-shaped artifact of the harness's serialization choices. The guardrail: **the event log is the evaluation substrate; the compacted view is a derived, lossy projection and must be treated as untrusted input to any grader.** If the harness cannot afford to retain the full log, it must at minimum retain a structured *action ledger* (tool name, arguments hash, result status, retry count) that survives compaction verbatim, because that ledger is what catches duplicate side effects and wrong-path retries — the failure classes compaction is structurally incapable of representing. ## Operational Effect Downstream of a compacted-view grader, three things go wrong: 1. **Model selection inverts.** Agents with aggressive compaction (which is to say, agents that stay under budget by summarizing hard) are scored as *better* than agents that retain context and run closer to the limit — because the aggressive compactors produce cleaner narratives. The leaderboard rewards the very behavior that loses information. 2. **Regression tests stop catching regressions.** A change that introduces duplicate side effects will not move the score if the duplicate is compacted away before grading. The test passes; production burns the rate limit. 3. **The compaction prompt becomes an unmonitored scoring surface.** Because the summarizer's output feeds the grader, editing the summarization prompt (e.g., "be concise") changes the score without changing the agent. This is a silent, unversioned coupling between a prompt and a benchmark number. The fix is structural, not a prompt tweak: separate the *evaluation input* (event log, immutable, append-only) from the *agent's working memory* (compacted, lossy, disposable). The agent may forget. The evaluator may not. Any harness that lets the agent's forgetting propagate into the grader is measuring the agent's self-image, and self-images grade high. ```python """Guard against compaction-aware score inflation in long-horizon task evaluation.""" from dataclasses import dataclass, field class CompactionLeakError(RuntimeError): """Raised when a grader is fed a compacted view as if it were the event log.""" @dataclass class ActionLedger: """Verbatim, compaction-immune record of every tool invocation.""" entries: list = field(default_factory=list) def record(self, tool: str, args_hash: str, status: str) -> None: self.entries.append({"tool": tool, "args_hash": args_hash, "status": status}) def duplicate_side_effects(self) -> int: seen, dups = set(), 0 for e in self.entries: if e["status"] == "ok": key = (e["tool"], e["args_hash"]) if key in seen: dups += 1 seen.add(key) return dups @dataclass class EvaluationInput: source: str # "event_log" | "compacted_view" compaction_ratio: float action_ledger: ActionLedger def grade(input: EvaluationInput) -> float: if input.source != "event_log": # A compacted view is a lossy projection authored by the agent under # budget pressure. Grading it inflates process-failure scores. raise CompactionLeakError( f"grader received source={input.source!r} " f"(compaction_ratio={input.compaction_ratio:.2f}); " "evaluation substrate must be the event log, not the agent's memory of it" ) if input.compaction_ratio > 0.0 and input.action_ledger is None: raise CompactionLeakError( "run compacted mid-trajectory but no action ledger was retained; " "duplicate side effects and wrong-path retries are unrecoverable" ) penalty = 0.05 * input.action_ledger.duplicate_side_effects() return max(0.0, 1.0 - penalty) if __name__ == "__main__": ledger = ActionLedger() ledger.record("restart_service", "hash:svc-a", "ok") ledger.record("restart_service", "hash:svc-a", "ok") # duplicate at step 31 try: grade(EvaluationInput("compacted_view", 0.78, ledger)) except CompactionLeakError as e: print(f"REJECTED: {e}") ```