View all files | ||||
ANSI terminal dashboard and CLI for exploring your OpenCode database — sessions, tokens, costs, models, and project activity.
Download the latest binary from Releases:
Cross-compile for other platforms:
Every command supports --output json (or -o json):
Two ways to hide directories from the dashboard:
Focus the dashboard on specific directories with --name:
Works on all dashboard panels — directories, models, providers, weekly activity, and costs. The directory section adapts to show exactly the named directories (instead of the top N). Accepts comma-separated directory names (not paths).
If you have projects in multiple locations (different clones, worktrees) with the same directory name, the dashboard shows each path as a separate row. Use --merge-same-names to collapse them into a single row by basename:
The path-arg shortcut (ocv .) enables this automatically — current-directory sessions from all clones/worktrees are merged into one row.
The sessions and search commands show a "Type" column:
ocv includes a Model Context Protocol (MCP) stdio server for AI agent tool access. Run ocv mcp to start the server — it communicates over stdin/stdout via JSON-RPC, exposing database queries as structured, typed tools.
Available tools: get_stats, get_overview, list_sessions, get_session, search_sessions, get_top_models, get_top_providers, get_weekly_activity, project_cost
get_overview accepts an optional directory string — when provided, returns aggregate stats for only that directory. Omit for all directories.
project_cost computes projected costs for a project across 16 Zen models (OpenCode pricing). Takes token counts and actual cost, returns cost projections per model sorted by projected total (cheapest first), with an "Actual" row at the top.
| tokens_input | number | yes | Total input tokens |
| tokens_output | number | yes | Total output tokens |
| tokens_cache_read | number | yes | Total cache read tokens |
| tokens_cache_write | number | yes | Total cache write tokens |
| actual_cost | number | yes | Actual cost from the database |
Available prompts: token-stats, cost-project
Register with OpenCode by adding to .opencode/opencode.jsonc in any project:
Or from source (requires Deno):
Agents in that workspace can then query session data, token usage, costs, and more through structured tool calls.
| (no args) / overview | Per-directory session overview table |
| stats | Full statistics: sessions (active/archived), projects, tokens, cost, most-used model, app version range |
| dash | ANSI dashboard with bars per directory, model, provider, weekly activity. Supports --top, --all, --name, --exclude, --merge-same-names |
| . (path arg) | Dashboard filtered to the given directory's sessions — resolve ., ./x, /abs/path to dir basename, auto-merges same-named dirs |
| sessions <path> | Filtered session list matching a directory path |
| session <id> | Single session detail with messages and todo breakdown |
| search <query> | Full-text search over session titles and directories |
| rename --from-dir <old> -d <new> | Batch-rename session directory and path fields when project moves |
| mcp | Start MCP stdio server — exposes DB queries as structured tools for AI agents |
This project uses semantic-release with conventional commits. Version bumps are automatic based on commit messages:
| fix: ... | Patch (1.0.0 → 1.0.1) |
| feat: ... | Minor (1.0.0 → 1.1.0) |
| feat!: ... or fix!: ... with BREAKING CHANGE: in body | Major (1.0.0 → 2.0.0) |
| chore: ..., docs: ..., refactor: ..., ci: ... | No release |
GitHub Releases are created automatically on push to main with compiled binaries attached.
| OPENCODE_DB_PATH | ~/.local/share/opencode/opencode.db | Override the OpenCode database path |
Reads the OpenCode SQLite database (opencode.db) directly via @db/sqlite. Queries aggregate token usage, session counts, model usage, version ranges, and per-project activity from the session, message, and part tables. Most commands are read-only; the rename command writes to update directory and path fields.
MIT