opencode-s installs the oc CLI, a small tool for listing, inspecting, resuming, and deleting OpenCode sessions from the local session database.
- Node.js
>=24or Bun>=1.1.0 opencodeavailable in your shell
opencode-s can be installed with npm or Bun. It uses runtime-native SQLite:
Node runs use node:sqlite, and Bun runs use bun:sqlite. The package does
not depend on better-sqlite3 or any other third-party native SQLite addon.
From npm after publishing:
npm install -g opencode-sFrom Bun:
bun add -g opencode-sThe default oc binary runs on Node.js. A Bun-specific binary is also exposed
as oc-bun for users who want to run the same CLI under Bun.
For local development from this repository:
bun install
bun linkYou can also run the built CLI directly:
bun run build
node ./dist/cli/index.js list
bun ./dist/cli/index.js listoc <command>
Commands:
new Start a new OpenCode session
resume, r [session] Launch opencode in the session directory
list, ls List root sessions across all projects
view, v <session> Show session metadata and recent text parts
rename, mv <session> <title...>
Rename a session title
delete, d, rm [session..]
Delete sessions via opencode after confirmation
projects, p List OpenCode projects and session counts
cleanup Clean stale OpenCode DB/cache artifacts
help Show CLI help
completion Print a fish completion script
<session> is required for view and rename. [session] is optional for resume and delete.
When a session value is provided, the CLI resolves it in this order:
- Exact session ID match
- Exact session title match
- Unique session title prefix match
- Unique session ID prefix match
When oc delete is run without arguments, it opens an interactive multi-select picker. In TTY mode, type to filter, use Space to toggle sessions, and press Enter to continue. In non-TTY mode, enter numbers and ranges like 1,3,5-8.
Deletion always requires typing DELETE before any sessions are removed.
oc help
oc new
oc resume
oc list
oc projects
oc rename ses_abc123 "better title"
oc delete
oc delete ses_abc123 ses_def456
oc cleanup
oc cleanup --vacuumIf you use Fish, install a completion file into Fish's user completion directory:
mkdir -p ~/.config/fish/completions
oc completion fish > ~/.config/fish/completions/oc.fishOpen a new Fish shell after installing the file, or run:
source ~/.config/fish/completions/oc.fish