OpenCode Guide

The Dummies Guide to OpenCode Sessions
Topic: Sessions
Classification: Guide
What's a Session?

A session = one conversation with Claude. It remembers everything: what you asked, what Claude did, what files changed, how much it cost. It's saved to disk automatically. You never lose work.

The Basics
Starting a Session

Just type a prompt. That's it. A new session is created automatically with a random name like "brave-falcon".

Naming Your Session

Give it a real name so you can find it later:

  • /rename -- type this in the prompt while inside a session
  • ctrl+r -- keybind shortcut, works anywhere

Name sessions after what you're working on: "auth-refactor", "fix-login-bug", "add-dark-mode".

Switching Sessions
  • /sessions -- opens the session picker (also /resume or /continue)
  • Type to search by name
  • Arrow keys to select, enter to switch
Starting Fresh
  • /new -- start a brand new session (also /clear)
The Workflow

You sit down Monday morning:

opencode -c              <- picks up where you left off Friday

You get pulled into a bug:

/new                     <- fresh session
> fix the crash in auth  <- work the bug
/rename                  <- call it "auth-crash-fix"

Bug's fixed, back to your feature:

/sessions                <- open the picker
search "dark"            <- find your "add-dark-mode" session
enter                    <- you're back, full context intact

End of day, close terminal. Everything is saved.

CLI Shortcuts
CommandWhat it does
opencodeStart fresh on the home screen
opencode -cResume your most recent session
opencode -s ses_abc123Jump to a specific session by ID
opencode session listList all sessions in the terminal
opencode session list --format jsonList sessions as JSON (for scripting)
Slash Commands
CommandWhat it does
/sessionsOpen the session picker
/resumeSame as /sessions
/continueSame as /sessions
/newStart a new session
/clearSame as /new
/renameRename the current session
Keybinds
KeyWhat it does
ctrl+rRename session
session_list keybindOpen session picker
Tips
Name your sessions.
"brave-falcon" means nothing in 3 days. "refactor-api-routes" does.
One task per session.
Don't mix unrelated work. Start a /new session for each distinct task.
Use -c habitually.
If you're continuing yesterday's work, opencode -c saves you from hunting through the picker.
Sessions are per-project.
Different git repos have separate session lists. You won't see your frontend sessions when working in the backend repo.
Context compaction is automatic.
If a conversation gets long, older messages get summarized to free up the context window. Your session keeps working, it just condenses the history.
You can delete sessions.
In the /sessions picker, hit the delete keybind twice (confirmation required) to remove sessions you don't need.
Sessions track costs.
Each session records token usage and cost per message, so you can see how expensive a conversation was.
Mental Model

Think of sessions like browser tabs for conversations. Each tab has its own history, its own context, its own state. You can have many open, switch between them, close ones you don't need, and name them so you can find them later. The difference: these tabs survive closing the terminal.

END OF DOCUMENT