Harness Notes

Commands

Updated 2026-11-25,

On this page

The command for each task, in each harness. Pick what you are working with, then read across: commands you type in your shell or a script and commands you type inside an open session are listed separately. Commands for renaming sessions are on Thread naming and importing from another harness on Migration.

From your shell

Commands you run in a terminal or script, outside a session.

TaskOpenCode 2.xchecked at 2.0.28
Set up
Import

opencode session import <file> [--directory <dir>]

Import session data from a JSON file or URL.

1 note

Moved from the top-level import command.

Use
List

opencode session list [-n N] [--format table|json]

List top-level sessions in the current project, newest first.

1 note

Default limit 100.

Attach

opencode --server <url>

Connect the client to a specific server instead of the background service.

1 note

Replaces 1.x opencode attach.

Resume

opencode [directory] (--continue | --session <id>)

also opencode -c, opencode -s <id>

Continue the last session or a given one.

1 note

The root command has no --fork in 2.x.

Fork

opencode run (--continue | --session <id>) --fork

Fork the session before continuing.

1 note

Only on run and mini.

Export

opencode session export [<session>] [--sanitize]

Export session data as JSON.

1 note

Moved from the top-level export command.

Remove
Delete

opencode session delete <sessionID>

Delete a session and its child sessions.

Inside a session

Slash commands you type into an open session.

TaskOpenCode 2.xchecked at 2.0.28
Use
Resume

/sessions

also /resume, /continue

List sessions and switch to one.

1 note

The dialog can also delete, rename and pin sessions.

Fork

/fork

Fork the current session from a chosen message.

Export

/export

Export the current session transcript.

Notes and sources

OpenCode 2.x
  • @opencode/cli 2.x runs one shared background service per user, managed with opencode service. Session sharing is not supported yet.
  • 2.1 restores archiving through client.session.update({ sessionID, archived: true|false }) and archive filtering in client.session.list. These are SDK/HTTP operations, not newly claimed shell subcommands.
  • 2.1 adds editable saved-grant action/resource patterns through client.permission.saved.update / PATCH /api/permission/saved/:id. Action is a tool/action name, not an allow/deny effect.
  • 2.1.1 fixes provider reasoning variant generation after package normalization; other command observations retain their earlier help/source versions.
  • From 2.4.0, plugin specs using @latest, a version range, a Git branch or a Git semver range update at startup and every 24 hours. A failed reload keeps the previous version running. Bare names, exact versions, other dist-tags, Git tags and commit pins support manual update.