@tim_hilde/opencode-insightsOpenCode plugin that analyses your session history and generates an HTML insights report
10
334
31 in 7 days
42.8
Multi-signal model
28 days ago
2026-07-23
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@tim_hilde/opencode-insights@1.4.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@tim_hilde/opencode-insights@1.4.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D @tim_hilde/opencode-insightsopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
A native opencode plugin that generates usage insights reports from your session history.
Registers a /insights slash command that:
- Reads sessions from opencode's SQLite database
- Extracts per-session facets via LLM (with caching)
- Runs 7 aggregate analysis prompts + an at-a-glance synthesis
- Generates a self-contained HTML report + diffable
insights.json
The report
/insights produces a single self-contained HTML file — no server, no build step, just open it in a browser. It loads light by default with an opt-in dark mode, every section is collapsible for quick skimming, and Export insights.json downloads the underlying data so you can diff reports over time.
The image above is a static preview. For the interactive version — collapsible sections, dark-mode toggle, and JSON export — open
docs/sample-report.htmlin a browser, or preview it online. The data shown is an illustrative example.
Installation
Runtime: Requires Bun. The
engines.nodefield inpackage.jsonis npm registry metadata only — the plugin usesbun:sqliteand cannot run under plain Node.js.
Add to ~/.config/opencode/opencode.json:
{
"plugin": ["@tim_hilde/opencode-insights@1.0.0"]
}
Usage
In the opencode TUI:
/insights # current project only (default)
/insights --all # analyze every project
/insights --days 7
/insights --force
/insights --model anthropic/claude-haiku-4-5
/insights --output ~/Desktop/my-insights.html
By default
/insightsanalyzes only the current project's sessions. Pass--allto include every project in your opencode history. Scoping to the current project also limits how much unrelated session content is fed to the analysis model.
Configuration
On the first run, the plugin creates ~/.config/opencode/insights.json with defaults:
{
"model": "anthropic/claude-haiku-4-5",
"days": 30,
"concurrency": 4
}
Edit this file to change the defaults for every /insights run.
| Field | Default | What it does |
|---|---|---|
model |
anthropic/claude-haiku-4-5 |
LLM used for all analysis calls. Format: providerID/modelID. Haiku-class models are recommended — they're fast, cheap, and sufficient for JSON extraction. Use a smarter model if you want richer analysis at higher cost. |
days |
30 |
How many days of session history to include. |
concurrency |
4 |
Max parallel LLM calls during per-session facet extraction. Increase to speed up the first run, decrease if you're hitting rate limits. |
Argument flags override config file values for a single run:
/insights --days 7 # override days
/insights --model anthropic/claude-sonnet-4-5 # use a smarter model this run
/insights --force # re-analyze all sessions, ignoring cache
How it works
- Extract — reads sessions from
opencode.db(current project + last 30 days by default; use--allfor every project), filters out sub-agent sessions and[insights]sessions - Facet extraction — per-session LLM call extracting: goal, outcome, satisfaction, friction (cached to
~/.local/share/opencode/insights/facets/) - Aggregate analysis — 8 prompts: project areas, interaction style, agent performance, friction, suggestions, tool health, horizon
- At-a-Glance synthesis — final summary with split fault attribution (agent vs user-side)
- Report generation — self-contained HTML + machine-readable
insights.jsonfor tracking over time
Development
bun install
bun test
bun run scripts/smoke-db.ts # LLM-free validation against real DB
Attribution
This plugin ports and extends opencode-usage by rchardx (MIT License).
Prompt improvements are based on Claude Code's /insights system prompts as documented by Piebald-AI/claude-code-system-prompts.
