Magic Compact: a fix for OpenCode's context-wrecking compaction
OpenCode, an tool, runs a process called '' when a conversation fills up its available context space, collapsing the entire conversation into a single summary. The problem is that this process throws away almost everything valuable that had built up: tool call records, file reads and writes, decisions made, and facts uncovered, leaving only a generic summary that captures roughly 10% of what mattered. One developer had spent months Claude Code's internals from minified JavaScript files published on npm, carefully mapping out what symbols meant, how functions worked, the main conversation loop, the modules, and the permission system.
After a single event, the agent lost nearly all of that accumulated understanding, output quality collapsed, and the agent ended up re-reading and re-deriving the same minified code it had already figured out. To fix this, the developer began building a replacement tool called Magic Compact.
Key points
- OpenCode compresses the whole conversation into one summary once context space runs out
- That process discards most detail: , file contents, and decision history
- In this case the resulting summary captured only about 10% of what mattered
- After , the agent re-did analysis it had already completed from scratch
- The developer is building a replacement tool, Magic Compact, to fix this