Answer: You trigger compaction manually by running the API command `opencode api post /api/session/ses_example/compact --data '{}'`, which requests compaction at any time, even for a short history. Status: Confirmed Entry: tool/opencode/memory-and-context/manual-compaction Revision: 1 Digest: sha256:7e7d52c2c85ee09f (changes whenever the content changes) Timeline: Created: 2026-11-13T03:56:34Z Last changed: 2026-11-13T03:56:34Z Last verified: 2026-11-20T13:45:34Z Next check: 2026-11-21T13:45:34Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of manual compaction command | opencode api post /api/session/ses_example/compact --data '{}' | [1] | 2026-11-20 when it can be requested | at any time, even for a short history | [1] | 2026-11-20 idempotent retry command | opencode api post /api/session/ses_example/compact --data '{"id":"msg_compact_once"}' | [1] | 2026-11-20 Sources: [1] opencode. "Compaction | OpenCode". https://opencode.ai/docs/compaction/ Role: primary. Accessed: 2026-11-20T13:45:34Z Quote: "opencode api post /api/session/ses_example/compact --data '{}'" (Supports: manual compaction command) Quote: "Request compaction at any time, even for a short history" (Supports: when it can be requested) Quote: "opencode api post /api/session/ses_example/compact --data '{"id":"msg_compact_once"}'" (Supports: idempotent retry command) 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:45Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:45:34Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:45:34Z Last attempt: 2026-11-20T13:45:34Z Notes and limitations: Extracted automatically from a single official source (section "Manual"). Related: https://latestn.com/tool/opencode/models/choose-edit-models-pricing How do I choose or edit models and set custom pricing in opencode Console? https://latestn.com/tool/opencode/models/claude-code-supported-models Which models can I use with Claude Code through OpenCode Console? https://latestn.com/tool/opencode/models/compaction-model Which model does opencode use for compaction and how do I change it? https://latestn.com/tool/opencode/memory-and-context/agents-md-discovery-order How does opencode discover and order AGENTS.md instruction files? https://latestn.com/tool/opencode/memory-and-context/agents-md-file-location Where should I place AGENTS.md files so opencode applies them to the right directories? https://latestn.com/tool/opencode/memory-and-context/instructions-updates How do I update opencode project instructions when files change? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:56:34Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/opencode/memory-and-context/manual-compaction/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/memory-and-context/manual-compaction POST: https://latestn.com/dispute/tool/opencode/memory-and-context/manual-compaction with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/opencode/memory-and-context/manual-compaction?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I trigger compaction manually in opencode? Revision 1, last verified 2026-11-20T13:45:34Z. https://latestn.com/tool/opencode/memory-and-context/manual-compaction (accessed 2026-11-21T09:53:15Z). @misc{LatestN_tool_opencode_memory_and_context_manual_compaction_r1, title = {How do I trigger compaction manually in opencode?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/opencode/memory-and-context/manual-compaction}}, note = {Revision 1; digest sha256:7e7d52c2c85ee09f; last verified 2026-11-20T13:45:34Z; accessed 2026-11-21T09:53:15Z} } 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/memory-and-context/manual-compaction