> sessions & tui

A session is one saved conversation plus the file changes made in it, scoped to the project directory you launched from. The TUI is built around managing those sessions — start a fresh one with /new, jump between old ones with /sessions, reclaim context with /compact, roll back edits with /undo — plus inline helpers like @ to reference a file and ! to run a shell command. Most actions have a leader-key shortcut (default Ctrl+X).

// sessions & tui

6 commands

// faq

Where does opencode store sessions?

Sessions and their git-based snapshots live in opencode's local data directory (under ~/.local/share/opencode on Linux/macOS), keyed by project. That is why the same session list appears only when you relaunch from the same directory, and why /undo can revert edits without touching your own git history.

Does /undo revert my own git commits?

No. /undo uses opencode's own snapshots, which are separate from your repository's commits. It steps back the agent's last message and the file edits its tools made, one message at a time — it will not rewrite your git history or recover changes you made by hand outside the agent.

What does /compact actually do?

It replaces the earlier conversation with an AI-written summary so the context window has room to continue, keeping the session going instead of forcing a new one. It is lossy: specific early details can be dropped, so record anything critical in AGENTS.md or a commit first. opencode also compacts automatically as you approach the model's limit.

How do I resume yesterday's conversation?

Run opencode -c to reopen the most recent session, or open the TUI and use /sessions to pick any past conversation in that project. From a script, opencode run -c continues the last session and opencode run -s <id> targets a specific one by ID.