←News detail

Larsen CundricUpdated Oct 30 14:28

Larsen Cundric reposted the view that compaction is inferior to context retrieval

AI summary

Larsen Cundric reposted Alexander Yue's view, arguing that compacting an agent's context once it fills up is the wrong approach; instead, the full session record should be retained and the model should retrieve from it on demand. Alexander Yue said that in a real test on an approximately 400k-token Opus 5.5 session, compaction took 38 seconds and cost $1.99 when the cache had expired, and 29 seconds and $0.17 when it had not, and that the summary loses details such as error messages and file paths; Mainplane, which he developed for this purpose, uses context retrieval and, on the same session and model, took 15 seconds and cost $0.10 to restore work, does not depend on cache hits and performs no rewriting, and the project is open-sourced under the MIT license.

Quoted post

Alexander Yue

@Alezander9

Compaction is a mistake. When an agent's context fills up, tools like Codex and Claude Code compact it: 1. The model prefills the entire session again 2. It writes a summary of everything so far 3. A new session starts from that summary I measured this on a real ~400k-token session with Opus 5.5: → 38 s and $1.99 when the prompt cache has expired → 29 s and $0.17 when it hasn't And the summary is lossy. The exact error message, the file path, the one number you needed is often gone. So I do something new for Mainplane Context retrieval works the other way around. Mainplane keeps the full record of every session as a file. When the context fills up, a new session starts right away with one instruction: "You are continuing session X. Retrieve key context from it as you go." The agent searches the old session and copies the exact lines it needs, when it needs them. Same session, same model: 15 s and $0.10 to get back to work. It does not depend on a cache hit, and nothing is paraphrased. This is the bitter lesson applied to agent memory. Don't hand-design what the model should remember. Give it the full record and good tools, and let it decide. Mainplane is open source (MIT). Link in the first comment.

View original

Compaction is a mistake. When an agent's context fills up, tools like Codex and Claude Code compact it: 1. The model prefills the entire session again 2. It writes a summary of everything so far 3. A new session starts from that summary I measured this on a real ~400k-token session with Opus 5.5: → 38 s and $1.99 when the prompt cache has expired → 29 s and $0.17 when it hasn't And the summary is lossy. The exact error message, the file path, the one number you needed is often gone. So I do something new for Mainplane Context retrieval works the other way around. Mainplane keeps the full record of every session as a file. When the context fills up, a new session starts right away with one instruction: "You are continuing session X. Retrieve key context from it as you go." The agent searches the old session and copies the exact lines it needs, when it needs them. Same session, same model: 15 s and $0.10 to get back to work. It does not depend on a cache hit, and nothing is paraphrased. This is the bitter lesson applied to agent memory. Don't hand-design what the model should remember. Give it the full record and good tools, and let it decide. Mainplane is open source (MIT). Link in the first comment.

View original post

Body

It’s time to find something better than compaction.

Source

Larsen Cundric