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

@expnn/opencode-insight

v0.2.1

Published

Readme

OpenCode Insight

A monitoring plugin for OpenCode that provides real-time observability into your AI coding sessions.

Features

  • Overview Dashboard — 6 metric cards + token distribution + model usage + cache efficiency
  • Timeline View — Scrollable list of messages and tool calls with inline detail expansion
  • Real-time Updates — The fullscreen overlay auto-refreshes every 2 seconds (configurable via overlayRefreshIntervalMs)
  • Sidebar Stats — Shows total cost (incl. subagents) and cache hit rate directly in the sidebar, below the entry button
  • Theme Aware — Integrates with OpenCode's current theme

Installation

Add to your tui.json (or tui.jsonc):

{
  "plugin": ["@expnn/opencode-insight"]
}

The plugin field is an array. Each entry is either a string spec or a [spec, options] tuple — not an object. See Configuration.

Configuration

Pass options using the tuple form [spec, options] inside the plugin array. An object form like { "spec": { options } } is invalid — opencode will reject the whole tui.json and skip every plugin.

{
  "plugin": [
    ["@expnn/opencode-insight", {
      "sidebarRefreshIntervalMs": 20000,
      "overlayRefreshIntervalMs": 2000,
      "overlayNavPct": 15
    }]
  ]
}

For a local dev build, use a file:// spec instead of the package name:

{
  "plugin": [
    ["file:///absolute/path/to/opencode-insight/dist/index.js", {
      "sidebarRefreshIntervalMs": 20000,
      "overlayRefreshIntervalMs": 2000,
      "overlayNavPct": 15
    }]
  ]
}

There are two independent refresh intervals — don't confuse them:

| Option | Type | Default | Applies to | Description | |--------|------|---------|------------|-------------| | sidebarRefreshIntervalMs | number (ms) | 20000 | Sidebar stat line | How often the compact sidebar line (total cost + cache hit rate) polls for fresh data. Aggregation reuses a per-session cache and only refetches changed sessions, so a higher interval costs almost nothing. | | overlayRefreshIntervalMs | number (ms) | 2000 | Fullscreen overlay | How often the overlay re-renders while open. Lower = more live, higher = less API traffic. | | overlayNavPct | number (%) | 20 | Fullscreen overlay | Width of the overlay's left navigation bar as a % of terminal width. The right main panel takes the remaining 100 - overlayNavPct. Clamped to [10, 40]. Lower it on narrow screens to give the main panel more room. |

Both must be positive numbers; otherwise the default applies.

Usage

Click "🤖 Opencode Insight" in the sidebar to open the fullscreen overlay. The sidebar also shows a compact line — total cost (including subagents) and cache hit rate — that updates on the sidebarRefreshIntervalMs cadence.

To close the overlay:

  • Press Esc or q, or
  • Click the [X] Close button at the top-right of the overlay.

Overview Panel

| Card | Shows | |------|-------| | Total Tokens | All tokens consumed | | Cost | Total USD | | Input | Input tokens + cached | | Output | Output tokens + cached | | Cache | Cache read + write | | Tool Calls | Total tool call count |

Timeline Panel

Scrollable table of every message and tool call. Click any row to expand inline details — message content, reasoning, token breakdown, or tool I/O.

Screenshots

Overview Panel

Troubleshooting

If the plugin doesn't load or shows stale code after reinstalling:

rm ~/.cache/opencode/packages/@expnn/opencode-insight@latest -rf

Then restart OpenCode.

Requirements

  • OpenCode >= 1.17.3

License

MIT