Blog

Does context compaction lose the user's request? We tested it

· updated · by

TL;DR. We expected context compaction to drop exact details from a later-turn user request once that turn moved into the summarized middle of a conversation. Across 108 trials with three low-cost models, 0 of 672 exact request values were dropped and 0 were changed; one summary rewrote two dates in another format, which an exact-string check counts as missing. Loss happened on tool output instead: a value a tool printed once and the user never typed disappeared in 1 of 72 trials. Pinning the user's request word for word fixed nothing here, whereas one-time tool output still needs care. Limits: synthetic conversations, three low-cost models, one summary format, one to three passes.

An LLM agent resends its conversation at each step, so long tasks fill the context window. Plori runs AI agents in cloud Workspaces; its compaction keeps the first messages and most recent messages word for word, and replaces the middle with a model-written summary.

Video: Does AI agent context compaction lose the user's request? (4 min 12 s)

Interactive walkthrough · PLO-2009

A later-turn request lands in the middle

Context window full
Head · Verbatim

First task & opening messages stay word for word.

Turn 1 request
Middle · ~20k–80k est. tokensto be summarized
Turn 2 request (under test)
2026-08-172026-10-250.37exclude IDs
Tool output filler · includes one-time DB port from start script
Tail · Verbatim

Most recent messages stay word for word.

Recent tool calls

The first messages and most recent messages stay word for word. Once a later turn runs long enough, its request and earlier tool output sit in the ~20,000 to ~80,000 estimated tokens that compaction replaces.

Step through how compaction compresses the middle of a conversation while keeping the head and tail verbatim. Counts are from 108 user-request trials and 72 tool-output trials across three low-cost models.

Why we tested our own compaction

The paper You don't need long context reports that, with frequent compaction, "frontier language models sacrifice little to no task accuracy when maintaining short contexts", while noting that "Compaction is a lossy context compression method" and that the strongest summaries keep "a verbatim or near-verbatim copy of the input task". After each compaction, its harness "starts a fresh conversation containing the original task and the compacted state", so the model sees the full task again.

Our agent does not re-inject later turns: the first request stays in the verbatim head, but a later-turn request moves into the summarized middle once the task runs long enough. Because the paper measures benchmark task accuracy rather than exact-value retention, we measured exact values directly.

How we ran the test

On 2026-11-11 we tested three low-cost models from three providers (model A, model B and model C) on synthetic conversations, with no customer data. Each trial put an earlier finished task in the head, the tested request in the middle, and tool-output filler sized to about 20,000 or about 80,000 estimated tokens in the summarized span. Our compaction code ran with a lowered trigger, the model wrote the summary, and we searched the compacted conversation for each exact string.

  • Short requests carried 2 to 6 exact values, such as file paths and the threshold 0.37.
  • Long requests ran 1,633 bytes with 14 exact values: two dates, three account ids to leave out, a rounding rule, column order, commit-message prefix and an e-mail address.
  • Separate cases edited a value in a later message, replaced the whole request, or compacted three times in a row (summarizing the earlier summary each pass).

Zero request values were dropped across 108 trials

Across 108 summarized trials (672 values total), 670 matched as exact strings and 0 were dropped or changed. The only 2 non-exact matches came from one three-pass long-request trial: the prompt gave 2026-08-17 and 2026-10-25, and the summary wrote "Aug 17–Oct 25, 2026 inclusive". Both dates stayed right, though an exact-string check counts them as missing; the rewrite happened on pass one and held unchanged through passes two and three.

Exact-value retention after compaction: 670 of 672 user-request values matched as exact strings and 2 dates were reformatted with 0 lost across 108 trials; 71 of 72 tool-printed values survived and 1 was lost; all 72 control trials kept every value.Exact-value retention after compaction: 670 of 672 user-request values matched as exact strings and 2 dates were reformatted with 0 lost across 108 trials; 71 of 72 tool-printed values survived and 1 was lost; all 72 control trials kept every value.
Exact-value retention across 108 user-request trials, 72 tool-output trials, and 72 verbatim controls.
Case Trials Values present
Short request, one pass, including a changed value and a replaced request 72 all values in all 72
Long request, one pass 18 14 of 14 in all 18
Long request, three passes 9 14 of 14 in 8, 12 of 14 in 1 (the date rewrite)
Short request, three passes 9 6 of 6 in all 9
Control: request kept word for word 72 all values in all 72

The 72 control trials are separate from the 108. Every detail we expected a summary to drop (excluded account ids, column order, commit-message prefix) survived all 27 long-request trials.

In 107 of 108 trials, the summary opened with an "Active goal" section carrying the current request forward. One example, from the replaced-request case (synthetic data):

## Active goal

Produce `reports/active-team-2025.csv` containing the **accounts on plan `team-2025`**, exported via `scripts/export_accounts.py`.

- User's exact instruction: "export the accounts on plan team-2025 to reports/active-team-2025.csv using scripts/export_accounts.py"

That structure kept exact user instructions intact through three nested compactions without extra pinning logic.

One-time tool output can still disappear

Values the user never typed and a tool printed once, such as a database port from a start script, are less safe. Across 72 trials with those values inside the summarized middle, they were lost once, with model B at about 80,000 estimated tokens. That summary stated the database had not started, so the model's next call started it again. The other 23 trials of that case kept the values.

An earlier post about agent loops cites a public issue where an agent repeatedly compacted its context and restarted work. When a tool prints a port, token, or generated id needed later, write it to a Workspace file instead of relying on the summary.

Pinning the user request word for word had nothing to fix

We tested a variant that appends the current turn's user messages word for word after the summary, matching the paper's harness. All values survived across 102 trials (54 with the request summarized). Because the unchanged summarizer already lost zero request values, we did not ship the variant. That does not contradict the paper, which measured benchmark task accuracy rather than exact strings in synthetic conversations.

What the models did next

In a second stage, we fed the compacted conversation back to each model and classified its next call across 162 trials:

  • 0 trials used a replaced value, followed a replaced request, repeated finished work, or asked the user to repeat the request.
  • 37 trials took the right action with the right values immediately.
  • 7 trials re-ran a tool to recover a value.
  • 58 trials were still inspecting files after two rounds and stayed unclassified.

Because 36% of trials ended unclassified, this stage is weak evidence; the synthetic filler included failing tests and conflicting files, which likely pushed models to inspect first.

How to test compaction in your own agent

  1. Put measured values only inside the span that compaction summarizes.
  2. Run separate verbatim controls and report their counts apart from summarized trials.
  3. Run exact-string checks, then read every miss by hand so a valid format change is not counted as a loss.
  4. Test one-time tool output separately from user requests.
  5. Run repeated passes, because a format change on pass one persisted through passes two and three.

Limits of this test

  • Synthetic conversations only, up to three passes and requests up to 1.6 KB.
  • Three low-cost models; other models were not measured.
  • One summary format, ours; a summarizer without an explicit active-goal section can behave differently.
  • Exact-string checks flag a reformatted date as missing and cannot tell whether a kept value was attached to the wrong field.
  • "About 80,000 estimated tokens" spanned 88,000 to 167,000 real tokens depending on the model's tokenizer.