OpenCode V2 Compaction: A Checkpoint Mechanism With Hard Token Limits
OpenCode V2 includes a compaction system that activates when a session's token estimate exceeds the model's context threshold, compressing all older conversation history into a fixed 4,096-token summary. The mechanism is designed as a last-resort survival tool, not a relevance-based pruning system, meaning it cannot distinguish important context from noise. Three hardcoded limits govern its behavior: tool output is capped at 2,000 characters, summary output at 4,096 tokens, and neither limit is user-configurable. Durable session history is never deleted, but after compaction, future model requests start from the checkpoint and cannot access older messages through normal provider calls. Media content such as images and videos from before the checkpoint is also reduced to plain text metadata, making visual context permanently invisible to the model going forward.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in