We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Configure Compaction

You can configure compaction settings in opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "compaction": {
    "auto": true,
    "keep": {
      "tokens": 10000,
    },
    "buffer": 20000,
  },
}
  • auto: whether to compact automatically near context limits. It defaults to true, and usually you want it to stay that way.
  • keep.tokens: the approximate number of tokens of recent context that OpenCode tries to preserve (in addition to the summary).
  • buffer: the safety margin, in tokens, below the model's limit; increasing it can trigger compaction earlier.

Assignment

Tell OpenCode to enable automatic compaction with keep.tokens set to 10000 and buffer set to 20000 in opencode.jsonc.

Then tell OpenCode to run and submit the CLI tests from the project root.