Answer: You configure the compaction buffer as a percentage of each model's window, accepting values from "1%" to "99%" including decimals such as "12.5%", or as a token count such as 20000. Status: Confirmed Entry: tool/opencode/settings/compaction-buffer-setting Revision: 2 Digest: sha256:ba44df9e94805b47 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:56:35Z Last changed: 2026-11-18T13:39:00Z (compaction threshold example: — → "20%") Last verified: 2026-11-20T13:45:35Z Next check: 2026-11-21T13:45:35Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of buffer format | "20%" | percent | [1] | 2026-11-20 accepted range | "1%" to "99%" | percent | [1] | 2026-11-20 decimal example | "12.5%" | percent | [1] | 2026-11-20 token count example | 20000 | tokens | [1] | 2026-11-20 compaction threshold example | "20%" | percent | [1] | 2026-11-20 Sources: [1] opencode. "Compaction | OpenCode". https://opencode.ai/docs/compaction/ Role: primary. Accessed: 2026-11-20T13:45:35Z Quote: "Buffer buffer is a percentage of each model’s window, so one setting fits every model: Model window "buffer": "20%"" (Supports: buffer format) Quote: "Accepts "1%" to "99%" , including decimals such as "12.5%" ." (Supports: accepted range) Quote: "including decimals such as "12.5%"" (Supports: decimal example) Quote: "A token count such as 20000 also works." (Supports: token count example) Quote: ""20%" compacts at 80% full" (Supports: compaction threshold example) Snapshot SHA-256: d245d3913694ae5b9552728fe64aa35b9b6a51b4fe3b34c67b4f94f792d2f767 (captured 2026-11-17T14:11:45Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-17T14:11:46Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:45:35Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:45:35Z Last attempt: 2026-11-20T13:45:35Z Notes and limitations: Extracted automatically from a single official source (section "Buffer"). Related: https://latestn.com/tool/opencode/settings/config-file-locations Where does opencode look for its config file and in what locations? https://latestn.com/tool/opencode/settings/config-variables How do I set environment variables or reference files in opencode config? https://latestn.com/tool/opencode/settings/configure-claude-code-console How do I configure Claude Code to use OpenCode Console? https://latestn.com/tool/opencode/settings/cli-settings-file-location Where does opencode store its CLI settings file? https://latestn.com/tool/opencode/settings/cloudflare-customize-config How do I customize the opencode Cloudflare SDK configuration? https://latestn.com/tool/opencode/settings/command-file-locations Where do global and project opencode commands live? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T13:39:00Z | changed | compaction threshold example: — → "20%" | [1] 2026-11-18T13:39:00Z | changed | buffer format: — → "20%" | [1] 2026-11-18T13:39:00Z | changed | buffer setting: "20%" → — | [1] 2026-11-13T03:56:35Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/opencode/settings/compaction-buffer-setting/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/opencode/settings/compaction-buffer-setting POST: https://latestn.com/dispute/tool/opencode/settings/compaction-buffer-setting with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/opencode/settings/compaction-buffer-setting?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I configure the compaction buffer setting in opencode? Revision 2, last verified 2026-11-20T13:45:35Z. https://latestn.com/tool/opencode/settings/compaction-buffer-setting (accessed 2026-11-21T09:50:25Z). @misc{LatestN_tool_opencode_settings_compaction_buffer_setting_r2, title = {How do I configure the compaction buffer setting in opencode?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/opencode/settings/compaction-buffer-setting}}, note = {Revision 2; digest sha256:ba44df9e94805b47; last verified 2026-11-20T13:45:35Z; accessed 2026-11-21T09:50:25Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/opencode/settings/compaction-buffer-setting