npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-sessions-explorer

v0.1.4

Published

OpenCode plugin for recall and analysis of past OpenCode sessions: search, grep, and cost/usage insights across your session history via 18 LLM tools (17 read-only plus one write, unarchive-session).

Readme

opencode-sessions-explorer

CI npm version License: MIT

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.

Compatibility

| 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% |

Quick Start

  1. Add the plugin and grant access to the OpenCode data directory:
// ~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-sessions-explorer"],
  "permission": {
    "external_directory": {
      "~/.local/share/opencode/**": "allow"
    }
  }
}

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.

  1. Quit and restart OpenCode. All 18 tools auto-register. OpenCode auto-installs npm plugins with Bun on startup, so there is no separate npm install step.
  2. Run the health probe once. Warnings for the missing export tree, missing ck, or missing ck index are okay at this stage:
bunx opencode-sessions-explorer-check-deps
  1. Materialize the search export once:
bunx opencode-sessions-explorer-bulk-export
  1. (Optional) Prewarm the ck index from the export root, not the repo root. Normal lex, sem, and hybrid searches ask ck to build or refresh indexes lazily, so this step is only for avoiding first-search latency or troubleshooting:
cd ~/.local/share/opencode-sessions-explorer
ck --index .  # run in the export root, not the repo root
  1. Run the health probe again to confirm the export and optional index state:
bunx opencode-sessions-explorer-check-deps

The 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.

Features

Recall and Navigation

  • Find your bearings. current-session, get-session, and session-summary report where you are and what a session contains.
  • Walk a session. session-timeline and session-genealogy trace the chronology and the parent/subagent chain.
  • Drill into detail. get-message and get-part fetch individual messages and parts, with optional tool-output dereference.
  • Browse and filter. list-sessions and search-sessions-meta find sessions by recency, agent, directory, title, or cost.
  • See docs/guides/recall-and-navigation.md.

Content Search and Grep

  • Search across history. search-text answers "where did I mention X?" with curated session-first recall by default.
  • Grep one session. grep-session scans a single session's curated channels, with raw replay via surface:'forensics'.
  • Audit tool calls. search-tool-calls finds every invocation of a command, every read that errored, or all calls to a given MCP.
  • See docs/guides/search-and-grep.md.

Cost and Usage Analysis

  • Spend by dimension. cost-by-project breaks cost down by project, directory, agent, or model.
  • Spend over time. cost-by-period reports OpenCode spend per day, week, or month.
  • Failure and repetition signals. list-tool-failures and list-repeated-prompts surface recurring errors and duplicated questions.
  • See docs/guides/cost-and-usage-analysis.md.

Export and Maintenance

  • One-time export. bulk-export materializes searchable session content for ck.
  • Stay current. The plugin auto-syncs new parts before each search call, then lets normal lex, sem, and hybrid ck searches lazily build or refresh their indexes. Explicit ck --index . / ck --reindex . runs are optional prewarm or troubleshooting steps for stale or partial coverage warnings.
  • Health probe. check-deps and the db-stats tool report dependency and schema health.
  • See docs/guides/export-and-maintenance.md.

Archived Session Recovery

  • Restore a buried session. unarchive-session is the one write tool — it clears time_archived and refreshes time_updated so the session resurfaces at the top of the per-directory list and can be opened again.
  • See docs/guides/manage-archived-sessions.md.

Privacy and Safety

  • 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-session redact common secret shapes in snippets by default; get-part dereference is path-guarded to a whitelist root.
  • See docs/reference/configuration.md and .github/SECURITY.md.

Documentation

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 |

Contributing

See CONTRIBUTING.md.

License

MIT