OpenCode School

Lesson 12

Sessions

Manage and resume conversations with Sessions.

Every conversation you have with OpenCode is a session. Sessions have their own history and context — the model remembers everything said within a session, but starts fresh in a new one. A single project can have as many sessions as you like.

Starting a new session

There are a few ways to start a new session:

  • Type /new in the prompt — works in both OpenCode Desktop and the TUI
  • Click New Session in the left sidebar in OpenCode Desktop

The current session stays in your history. You can always go back to it.

Sessions persist

Your session history is saved to disk. You can resume any previous session even after quitting and restarting OpenCode. Nothing is lost — if you were mid-task when you closed the app, the conversation is still there when you reopen it.

Sharing a session

You can share any session as a public link — useful for collaborating with teammates or asking for help.

/share

This generates a unique URL (at opncd.ai/s/<id>) and copies it to your clipboard. Anyone with the link can view the conversation.

To stop sharing and remove the data:

/unshare

Sharing modes

The default behavior is manual — sessions are private unless you explicitly run /share. You can change this in your config:

// Share every session automatically
{ "share": "auto" }

// Disable sharing entirely
{ "share": "disabled" }

Disabling sharing is a good idea for sessions that involve sensitive or proprietary information. To enforce this across a team, add "share": "disabled" to your project’s opencode.jsonc and commit it.

Listing and exporting sessions

OpenCode has two CLI commands for working with session data:

opencode session list

Lists all sessions across all your projects — session IDs, project paths, and timestamps.

opencode export <sessionID>

Exports a single session as JSON, including the full message history and metadata.

Exercise: summarize your past work

Ask OpenCode to list your sessions and summarize what you’ve been working on. You don’t need to touch the terminal — OpenCode can run the commands, read the output, and give you a summary.

List my recent OpenCode sessions and summarize what I’ve been working on.