

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: What Is Context?
incomplete
2: Context As RAM
incomplete
3: New Sessions
incomplete
4: Token Economics
incomplete
5: Ignoring Files
incomplete
6: File Watcher
incomplete
7: Lost in the Middle
incomplete
8: Compaction
incomplete
9: Configure Compaction
incomplete
10: Undo and Redo
incomplete
11: Forking
incomplete
12: Secrets in Context
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
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.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.