Apply to my task
arXiv:2610.20116 ★ 70 Oct 14, 2026

transparent-compact: compressing an agent's context without summarizing, keeping messages verbatim and labeling what was removed

Key result

Finding: summarizing the history breaks a coding agent quietly. The rule "don't touch migrations" turns into "be careful with migrations." The agent doesn't know what it lost and acts confidently but wrongly. The transparent-compact method lets you compress the context of a long session without losing the user's rules. No summary is requested from the model. Plain code keeps every user message and assistant reply verbatim, and puts a "removed" marker where the tool output used to be. The full history sits on disk, and the agent pulls what it needs with one log search call. This matters for lightweight models: they don't notice the gap and don't search persistently, and with summaries almost every rule error was confident, not "I don't remember".

01

TL;DR

transparent-compact is an extension for the Pi coding agent. When the context fills up, it doesn't ask the model to summarize the history. Plain code keeps every user message and every assistant reply verbatim. Tool output and reasoning get cut, and in their place goes an explicit "removed here" marker. The full history stays on disk, and the agent pulls what it needs with a single search call.

The key finding: a summary picks and rephrases, and the agent can't see what it lost. The rule "don't touch the migrations folder" turns into "be careful with migrations" or loses its caveat. The agent acts confidently and wrongly. Lightweight models are worse at compensating for these losses: they don't notice the gap and don't search the history persistently. Almost every error involving a paraphrased rule was a confident one, not an "I don't remember."

The method makes three guarantees. Everything left in the context is left verbatim. Everything removed is announced. Everything removed is retrievable in one step. On top sits a short "get your bearings" block: re-read the files, check the repo state, treat anything you know only from removed content as unverified.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 1: Context is full → code (not the model) builds a checkpoint
STEP 2: User messages + assistant prose → keep VERBATIM
        Tool calls → one line (name + truncated arguments)
        Tool output, reasoning → REMOVE + "removed" marker
STEP 3: Header: what's kept, what isn't, "this is a record of what was said, not a fact check"
STEP 4: "Get your bearings" block: re-read docs, check the repo, re-read a file before editing it
STEP 5: Need a detail → one context_lookup call → subagent searches the full history → returns only what it found
(the most recent messages after the checkpoint stay untouched)
03

Example in Practice

Task: you're two hours into steering an agent running on a local model through the backend of a delivery service. At the start of the session you said: "Don't touch the migrations folder, we change the DB schema by hand" and "We don't need backward compatibility." The context has been compacted twice. You need to check whether the agent still remembers the rules, and not take its word that it "sort of remembers."

Prompt (a probe message, as in the study): it quietly violates the rule and never mentions it.

Add a "payment status" field to the orders table (paid / pending / refunded)
and update the API so the courier app receives it.

Control message (for comparison, the same rule stated explicitly):

Add a "payment status" field to the orders table (paid / pending / refunded)
and update the API. Reminder: we don't touch the migrations folder, we change the schema by hand.

Result: run the control message first: it shows the agent can actually do the task with the rule in place. Then run the probe. If the agent creates a file in migrations without asking, the rule is lost, and that's a confident error. If it stops, asks, or goes digging through the history, the loss is visible and cheap to fix. That's exactly how the author told a "confident error" apart from an "I don't remember."

04

Why It Works

The weakness. A summary always chooses. It shortens "don't touch migrations, except for the test database" to "avoid migrations" or drops the line entirely. The new context has no marker saying something changed here, so the agent takes the summary for the original. A strong model will think to double-check. A lightweight one won't notice the gap, won't guess the meaning of the trimmed line, and won't search hard.

The strength. Models are good with exact text and explicit markers. If it says "tool output removed, fetch it via lookup," the model knows what it's missing and can ask or search. If the user's words sit in the context as they were, there's nothing to paraphrase.

How the method uses this. It removes the hardest part of the job: guessing what went missing. Neither the model nor an algorithm makes "important/unimportant" calls: all messages are kept, and only what can be re-read or re-run gets cut. Hence the levers:

  • Prose budget (25% of the window by default) → lower it so compaction kicks in earlier. Raise it if you need to keep more verbatim history.
  • The "get your bearings" block → add items for your project (which docs to re-read, which check commands to run).
  • Limit on consecutive lookups → raise it for complex sessions, lower it to save money.
  • The "record of what was said, not a check" marker → don't remove it: it stops the agent from treating an old claim as fact.
05

Prompt Template

In the paper this is a structure assembled by code. Below is a plain-language version for moving a session by hand or adapting it to your own agent.

## Verbatim checkpoint (compaction #{number})
- In the compacted segments, user messages and assistant prose are kept verbatim.
  Tool calls are kept as one line (name + truncated arguments).
  Assistant reasoning and tool output have been REMOVED.
  The retained text is a record of what was said, not a check of whether it's true.
- The full history up to this point is stored in {storage_location}; to retrieve details
  (including reasoning and tool output), use {lookup_tool}.

**[Before continuing, get your bearings.]**
1. Re-read the documents your instructions require: {documents}.
2. Check the repository state ({check_command}) before relying on it.
3. Re-read a file before editing it.
4. Anything you know only from removed reasoning or tool output
   counts as unverified until you verify it.

### Compacted conversation (oldest first)
<segment 1> [User]: {verbatim message} [Assistant]: {verbatim reply}
[tool] {name}({truncated_arguments}) ...</segment 1>
<segment 2> ... </segment 2>

<read-files note="read before compaction; contents NOT in context"> {file_list} </read-files>
The conversation from {moment} onward continues verbatim below; it was not compacted.

What to fill in: {storage_location} is the file or folder with the full session log. {lookup_tool} is how the agent retrieves old content (a command, a script, a log search). {documents} means CLAUDE.md, AGENTS.md, README. {check_command} is something like git status. {file_list} is the files the agent read before compaction.

🚀 Quick start: paste this into the chat:

Here's a template for a verbatim checkpoint. Adapt it to my task: {your agent and project}.
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask where your full history is stored, how the agent retrieves old content, which documents need re-reading, and which commands check the project state. That matters because the method hinges on the link "what was removed → where to get it." It will take the pattern from the template and build a working version for your tool.

06

Limitations

⚠️ Budget: verbatim prose takes up space. By default it gets about a quarter of the window, which is enough for roughly 10 compactions. After that, truncation similar to pi-vcc kicks in. The author didn't test behavior after dozens of compactions.

⚠️ Strong models: with a frontier model the advantage holds, but it's noticeably smaller. Strong models are better at compensating for an ambiguous summary. Lightweight models get the main benefit.

⚠️ Versus model summarization: on the commitment probes, the difference from Pi's standard summary did not reach statistical significance. It's visible on lightweight models, but that's weak evidence, not proof. The method reliably beat only pi-vcc, and, on synthetic facts, the summary too.

⚠️ An engineering build: the method is a code extension for Pi, not a prompt. In Claude Code or Cursor you have to rebuild it with your own tools. A plain prompt alone can't give you the "nothing was paraphrased" guarantee.

⚠️ Small sample, single author: 27 commitment probes across 18 sessions. Success on real tasks wasn't measured, only whether the agent remembers and applies rules. The separate contribution of each part of the method (verbatim text, markers, search) wasn't isolated. The available text of the paper cuts off during the results discussion, so some conclusions (for example, on Gemma and on the comparison with the standard summary) I couldn't verify.

07

How It Was Studied

The author tested two kinds of memory. The first is commitments: rules that exist only in the conversation. They took 18 real sessions from a public dataset. A separate model (Claude Opus) found the early rules in each one and, for each rule, wrote a natural next message that quietly violates it. Another model vetted the probes. If the control message with an explicit reminder failed, the probe was thrown out. That left 27 probes. The sessions were run through each method's real compaction, and the answers were scored by blind judges who didn't know the method. The judges also flagged whether an error was "confident."

The second kind is facts: 18 synthetic debugging sessions with 17 details each (codes from logs, values that changed twice, details that appeared only in reasoning). Three compactions over 95K tokens. After each one came questions plus three "decoys" resembling the real values. That forced the agent to look up the exact answer rather than guess. The comparison was against model summarization (pi-default) and the algorithmic pi-vcc on four models, three of them lightweight.

Results: on commitments, the method beat pi-vcc on every model (on Qwen 75.6% vs. 54.8%, on Luna +19 points, on Gemma +7, on Sol +11). On facts, it beat model summarization by 22–42 points. Compaction takes 0.43 s versus 167.8 s for summarization on a local model.

The surprise: the same pi-vcc context scored 98% on Qwen and 46% on Luna. The model's skill at searching decided the outcome. transparent-compact held at 95–98% on both. The practical takeaway: the less a model has to guess, the less the result depends on how strong it is.

08

Original from the Paper

 ## Verbatim compaction checkpoint (compaction 3 on this branch)
 - In the compacted spans, user and assistant prose is kept verbatim [...]; tool calls are kept
 as one-line signatures (arguments truncated). Assistant thinking and tool outputs are removed.
 Retained prose is a record of what was said, not verification of its claims.
 - The full transcript before this point is kept in the session; use ‘context [_] lookup‘ to recover
 details (including thinking and tool outputs).

 ** [Re-orient before continuing.] ** [[re-read required documents; check git status; re-read files]
 before editing; treat pre-compaction knowledge from thinking or tool output as unverified]

 ### Compacted conversation (oldest first)
 <span 1 ...> [User]: ... [Assistant]: ... [tool] read(src/app.ts) ...</span>
 <span 2 ...> ...</span>

 <read-files note="read before compaction; contents NOT in context"> ...</read-files>
 Conversation from <time> onward continues verbatim below -- it was not compacted.

Context: this is an abridged listing from the extension's source code (the bracketed text is condensed in the paper). This is what the checkpoint the agent sees after compaction looks like.

09

Adaptations and Extrapolations

Below are my own ideas inspired by the paper. The author didn't test these formulations.

💡 Adaptation for Claude Code and similar agents: Claude Code accepts instructions for manual context compaction. You can write them in the spirit of the method.

/compact Keep all my rule and prohibition messages verbatim (don't change the wording, don't trim caveats).
For anything you removed or shortened, explicitly mark it "shortened, details in history."
After compacting: re-read CLAUDE.md, check git status, re-read a file before editing it.
Treat anything you know only from old tool output as unverified.

This is weaker than the original: the model still does the compressing, not code, and verbatim text isn't guaranteed. But you're dictating the format of the losses to the model.

🔧 Technique: probe message → a test for your agent. Before an important long session, write down 3–5 of your rules. After compaction, send messages that quietly violate them and count how many the agent let slide. If there are a lot of "confident" failures, move the rules into the instructions file so they don't depend on a summary.

🔧 Technique: rules in a file, not in the chat. The paper shows that commitments living only in the conversation get lost. Anything that needs to outlive a single session (prohibitions, agreements) belongs in CLAUDE.md or AGENTS.md. This is my recommendation based on the paper's findings; the paper itself tested a different mechanism.

10

Resources

  • Maximising Transparency in Context Compaction Improves Retention of Facts and Commitments for Lightweight Coding Agents by Felix Woolford, Center for Human Nature, Artificial Intelligence, and Neuroscience (CHAIN), Hokkaido University.
  • Replication package: github.com/felixwoolford/compaction-study-replication
  • Works mentioned: Pi (an open-source coding agent), pi-vcc (deterministic compaction), Chen on constraint pinning (protecting constraints from loss during compaction), Lindenbauer et al. on observation masking (replacing old tool output with a placeholder), Factory (a comparison of compressors), MemGPT, Anthropic's guide to context engineering.

Research digest

Key result

Finding: summarizing the history breaks a coding agent quietly. The rule "don't touch migrations" turns into "be careful with migrations." The agent doesn't know what it lost and acts confidently but wrongly. The transparent-compact method lets you compress the context of a long session without losing the user's rules. No summary is requested from the model. Plain code keeps every user message and assistant reply verbatim, and puts a "removed" marker where the tool output used to be. The full history sits on disk, and the agent pulls what it needs with one log search call. This matters for lightweight models: they don't notice the gap and don't search persistently, and with summaries almost every rule error was confident, not "I don't remember".

Principle

The method makes three guarantees. What stays in the context stays word for word. What's removed is announced. What's removed is retrievable in one step. Nobody decides what's important: all messages stay, and only what can be re-read or re-run gets cut. It's like meeting minutes marked "pages 4-9 in the archive" versus a coworker's verbal recap. In the minutes, you can see where the gap is. In the recap, you can't. On top sits a short "get your bearings" block: re-read the docs, check the repo state, re-read a file before editing it. Anything known only from removed content counts as unverified. It also carries a note: this is a record of what was said, not a fact check. Don't remove it, or old claims will be taken as fact.

Why it works

A summary always chooses. The line "don't touch migrations, except for the test database" becomes "avoid migrations" or disappears. The new context has no marker saying something changed here. The agent takes the summary for the original. A strong model will think to double-check. A lightweight one won't notice the gap, won't grasp the meaning of the trimmed line, and won't search hard. The agent goes wrong not because it forgot, but because it doesn't know it forgot. Verbatim text needs no decoding. An explicit "removed, fetch via search" marker turns a silent loss into a visible one. Then the agent can ask or search. To be honest about the numbers: there were 27 probes across 18 sessions. Against Pi's standard summary, the difference did not reach statistical significance. The method reliably beat only pi-vcc, and, on synthetic facts, the summary too. The contribution of each part (verbatim text, markers, search) wasn't isolated.

When to apply

Coding agents on lightweight and local models → long sessions with rules like "don't touch folder X" and "we don't need backward compatibility" → especially once the context has already been compacted once or twice. Also works for moving a session into a new chat by hand using the template. NOT a fit if a strong model is enough: its gain is noticeably smaller. The method doesn't promise better performance on real tasks; only memory and application of commitments were measured. It's a code extension for Pi, not a prompt. In Claude Code or Cursor, a plain prompt can't give you the "nothing was paraphrased" guarantee. Verbatim prose takes about a quarter of the window, enough for roughly 10 compactions. What happens after dozens of compactions wasn't tested.

Mini recipe

1. Find where the full history lives: a file or folder with the session log. Without it the method doesn't work. 2. Pick a way to retrieve old content: a command, a script, or a log search. The agent should be able to call it in one step. 3. Build the checkpoint from the template: keep user messages and assistant prose verbatim. Shorten tool calls to one line, drop output and reasoning with a "removed" marker. 4. Add the "get your bearings" block: which documents to re-read (CLAUDE.md, AGENTS.md, README) and how to check the repo (git status). 5. Leave the fresh tail untouched: the latest messages go below verbatim, uncompressed. 6. Test, don't trust: first give a task with the rule stated explicitly. Then give the same task without mentioning the rule. If the agent breaks the rule without asking, that's a confident error, and your checkpoint needs work. 7. Tune the levers: prose budget (25% of the window by default), the limit on consecutive lookups, items in the "get your bearings" block.

Examples

[BAD]: `Compress our session history into a short summary and keep working` [GOOD]: `Compress the context like this: keep my messages and your replies verbatim. Write tool calls as one line, delete tool output and reasoning and write [removed]. The full log is in session.log; fetch details by searching it. Before continuing, re-read AGENTS.md, check git status, and re-read a file before editing it. Treat anything you know only from removed content as unverified.` Checking that a rule wasn't lost (two hours into work on a delivery service backend; at the start you said "don't touch the migrations folder"): [BAD]: `Remember our rules?` (the agent will confidently say "yes" and cross the line anyway) [GOOD]: `Add a "payment status" field to the orders table (paid / pending / refunded) and update the API so the courier app receives it.` The rule isn't mentioned in the request. If the agent created a file in migrations, that's a confident error. If it stopped, asked, or went searching the history, the loss is visible and cheap to fix.

In plain words

When the context overflows, almost every system asks the model to write a short recap of the conversation. At the level of LLM architecture, that's pure self-sabotage: every summary is a game of telephone. The model inevitably drops nuance, turning a hard rule like "don't touch migrations, except for the test database" into a limp "avoid migrations". A lightweight model takes the compressed recap as the original truth, stares right past the gaps, and quietly breaks your project.

It's like an assistant who, right before a big deal, shreds the contract and hands the boss a summary scribbled from memory on a napkin. Technically the gist is there, but the legal caveats have vanished, and the boss is sure they're reading the real document. Small models don't have the healthy paranoia of giants like GPT-4: if there's no prohibition in the context, it never occurs to them that someone cut it out.

The transparent-compact tool solves this radically: it forbids the model from summarizing itself. The system keeps every message verbatim, from both the programmer and the assistant, and simply wipes the heavy junk like walls of console output. Where the logs used to be, it drops a hard deletion marker, and the full history goes to disk, so the model can pull up any forgotten fact at any moment with a quick search.

The feature was road-tested on the Pi coding agent, but the logic scales to any autonomous agent with long sessions. It's critical for lightweight local models that lack tens of billions of parameters to reconstruct hidden meaning on the fly. Simply dropping the summary gives small models the resilience of heavyweights: you keep the agent working for hours, and it still remembers your strict no-gos from two hours ago.

Bottom line: stop making models write book reports about their own past. No context summarization: just verbatim commands, honest markers for the gaps, and search on disk. Either you give the model transparent memory, or two hours into debugging you discover it wiped the database because of one creatively abridged paragraph.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on transparent-compact: compressing an agent's context without summarizing, keeping messages verbatim and labeling what was removed arXiv:2610.20116

Sign in to apply this study New accounts get 50 free credits.