Recall, search, and analyze every past OpenCode session — 18 LLM-discoverable tools over the OpenCode SQLite database.
opencode-sessions-explorer is an OpenCode plugin that exposes your OpenCode
session history (~/.local/share/opencode/opencode.db) to the running model as a
set of named tools — 17 read-only (recall, search/grep, cost/usage analysis) plus
one explicit unarchive-session write. Ask in natural language and the model picks
the right tool automatically; nothing leaves your device.
Example questions it answers:
Where in my history did I mention the export codec?
Summarize session ses_… and list the files it touched.
How much did I spend on Claude this month, by project?
Which tool fails most for me, and what errors keep recurring?
Unarchive session ses_… so I can open it again.
| Area | Support | Notes |
|---|---|---|
| OpenCode | Plugin host compatible with @opencode-ai/plugin >= 1.15.0 |
Loads the plugin and owns the source database |
| Bun | >= 1.0 |
Runtime; the plugin uses bun:sqlite (OpenCode ships Bun), which should include SQLite json1; check-deps / db-stats verify it |
ck |
>= 0.7, optional |
Only search-text / grep-session need it; the other 16 tools work without it |
| OS | macOS / Linux | Windows paths resolve via %LOCALAPPDATA% |
- Add the plugin and grant access to the OpenCode data directory:
The external_directory snippet covers the common macOS/Linux default path. If
$XDG_DATA_HOME, Windows %LOCALAPPDATA%, or
OPENCODE_SESSIONS_EXPLORER_DB points elsewhere, allow the actual containing
directory and restart OpenCode. Some existing global configs use
external_directory: "allow"; that also permits access, but the scoped path rule
above is preferred for normal users.
- Quit and restart OpenCode. All 18 tools auto-register. OpenCode auto-installs
npm plugins with Bun on startup, so there is no separate
npm installstep. - Run the health probe once. Warnings for the missing export tree, missing
ck, or missingckindex are okay at this stage:
bunx opencode-sessions-explorer-check-deps- Materialize the search export once:
bunx opencode-sessions-explorer-bulk-export- (Optional) Build the
ckindex from the export root, not the repo root:
cd ~/.local/share/opencode-sessions-explorer
ck --index . # run in the export root, not the repo root- Run the health probe again to confirm the export and optional index state:
bunx opencode-sessions-explorer-check-depsThe external_directory permission is required because the OpenCode database lives
outside your project workspace. For installing from source, version pinning, and the
full first-run walkthrough, see docs/install.md and
docs/getting-started.md.
- Find your bearings.
current-session,get-session, andsession-summaryreport where you are and what a session contains. - Walk a session.
session-timelineandsession-genealogytrace the chronology and the parent/subagent chain. - Drill into detail.
get-messageandget-partfetch individual messages and parts, with optional tool-output dereference. - Browse and filter.
list-sessionsandsearch-sessions-metafind sessions by recency, agent, directory, title, or cost. - See docs/guides/recall-and-navigation.md.
- Search across history.
search-textanswers "where did I mention X?" with curated session-first recall by default. - Grep one session.
grep-sessionscans a single session's curated channels, with raw replay viasurface:'forensics'. - Audit tool calls.
search-tool-callsfinds every invocation of a command, every read that errored, or all calls to a given MCP. - See docs/guides/search-and-grep.md.
- Spend by dimension.
cost-by-projectbreaks cost down by project, directory, agent, or model. - Spend over time.
cost-by-periodreports OpenCode spend per day, week, or month. - Failure and repetition signals.
list-tool-failuresandlist-repeated-promptssurface recurring errors and duplicated questions. - See docs/guides/cost-and-usage-analysis.md.
- One-time export.
bulk-exportmaterializes searchable session content forck. - Stay current. The plugin auto-syncs new parts before each search call; rebuild the optional semantic index when you want embeddings.
- Health probe.
check-depsand thedb-statstool report dependency and schema health. - See docs/guides/export-and-maintenance.md.
- Restore a buried session.
unarchive-sessionis the one write tool — it clearstime_archivedand refreshestime_updatedso the session resurfaces at the top of the per-directory list and can be opened again. - See docs/guides/manage-archived-sessions.md.
- Local and read-only by default. 17 of 18 tools never write; no data leaves your device through this plugin.
- Secret redaction.
search-text/grep-sessionredact common secret shapes in snippets by default;get-partdereference is path-guarded to a whitelist root. - See docs/reference/configuration.md and .github/SECURITY.md.
Docs home: docs/README.md
| Goal | Doc |
|---|---|
| Install and first run | docs/install.md, docs/getting-started.md |
| Recall and navigation | docs/guides/recall-and-navigation.md |
| Search and grep | docs/guides/search-and-grep.md |
| Cost and usage analysis | docs/guides/cost-and-usage-analysis.md |
| Export and maintenance | docs/guides/export-and-maintenance.md |
| Archived session recovery | docs/guides/manage-archived-sessions.md |
| Tool reference | docs/reference/tools.md |
| Configuration | docs/reference/configuration.md |
| Search surfaces | docs/reference/search-surfaces.md |
| Response format | docs/reference/response-format.md |
| Architecture | docs/reference/architecture.md |
| Troubleshooting | docs/support/troubleshooting.md |
| Maintainer and release | docs/maintainers/development.md, docs/maintainers/release.md |
| Change log | CHANGELOG.md |
See CONTRIBUTING.md.