What this thread does
Do first: Launch each scripted run with opencode run --archived.
Short answer
Add --archived when starting a run. The session is created archived rather than waiting for a post-run cleanup step. OpenCode added this in v2.2.6 on 2026-11-06.
What to do
| Item | Value / action |
|---|---|
| Scripted run | opencode run --archived "Review this diff" |
| Find retained sessions | opencode session list; includes archived sessions |
| Release | v2.2.6, 2026-11-06 |
Use the flag in the script that launches each run. Keep the session ID if you want to open that session later.
Limits and open questions
The session still exists. The pages do not specify an archive-retention interval or an automatic deletion rule. The command reference explicitly includes archived entries in the CLI list, despite their exclusion from ordinary session lists.
Not for: Gemini CLI session retention.
Sources
Checked
2026-11-17; read OpenCode command reference, OpenCode changelog; no command was run.
Started from a post by @anomalyco, packaged by the editor. Original post