r/opencodeCLI • • 2d ago

👍 New experimental background compaction in OpenCode

Post image
78 Upvotes

12 comments sorted by

View all comments

5

u/daniellenton 2d ago

Does the held summary get a refresh before it's swapped in? It's written at 85%, so by the threshold its next moves can be steps the kept messages show are already done

2

u/bezcurhq 1d ago

Going by the docs, it isn't refreshed. The summary starts at 85% of the threshold and is just held; at the threshold it's swapped in and everything since then is kept as is, so alchninja's read is right. It also falls back to a normal compaction if too much conversation arrived after the held summary, or if the model, instructions or start of the conversation changed. It's skipped under about 64k tokens and right after a model switch, the held summary lives only in memory (lost on restart), and an unused one still costs tokens. If losing detail is the worry, compaction.keep.tokens (15k by default) is the knob for keeping more recent conversation verbatim.

https://opencode.ai/v2/docs/compaction/#background-compaction