v0.9.0 · source-only · Apache-2.0
Local-first analytics for your OpenCode sessions
OpencodeView reads the session store already sitting on your disk and turns it into project-scoped analytics. Read-only on opencode.db, a derived cache of its own, redaction before any payload leaves the process — and no outbound call, ever.
Requires Bun ≥ 1.3.0 and a local OpenCode install. No npm package, no binary, no container — clone and run.
Independent, unofficial companion. Not affiliated with the OpenCode team.
$
Five invariants, enforced in code
Not a policy page. These are assertions the process makes at startup and on every request.
-
Local-first
Default bind is loopback. The app opens no outbound socket and ships no telemetry. Your session history never leaves the machine that produced it.
OPENCODEVIEW_HOST=127.0.0.1 -
Read-only source
The OpenCode database is opened read-only at the engine level and pinned with a query_only pragma. OpencodeView structurally cannot write to it.
readonly: true · PRAGMA query_only = 1 -
Separate cache
Every derived metric lands in its own SQLite file. The cache path is checked so it can never be the same file, symlink or hardlink as the source.
.cache/analytics.sqlite -
Redact before leave
Transcript and live payloads pass through server-side redaction before JSON leaves the process: secret-like keys, bearer tokens, provider prefixes, URL userinfo and absolute home paths.
sk-… ghp-… → [REDACTED] -
Fail closed
Binding beyond loopback without an auth token is not a warning — the server refuses to start. Exposure is always a deliberate operator decision.
no token + public bind → exit
The product
Seven lenses over the same corpus
Every tab answers a different operational question about the agents you already ran. Scope is global or project-first; identifiers stay untranslated on purpose.
Where the budget actually went
Global and per-project rollups: total tokens, session counts, active time, tool calls and flagged sessions. Token volume by project is clickable — every bar is a drill-down into that project's session table.
- Project rollups with tokens, sessions, active time and patch precision
- Flag distribution across the whole corpus, ranked by count
- Per-project drill-down into a sortable session table
- Subagent counts surfaced next to primary sessions

API
/api/global/api/projects/api/projects/:id
Synthetic documentation previews — not live user data.
Heuristics
Eight flags, derived locally
Stable protocol strings, never translated. Each one is a rule over cached rows — an operator signal about your own runs, not a judgment about OpenCode itself.
-
Tool failure loop
tool_failure_loopRule tool_calls ≥ 20 and error rate > 30%The agent kept calling tools that kept failing. Usually a broken assumption about the environment.
-
Patch waste
patch_wasteRule patch_count > 50, apply_patch_ok = 0, summary_additions = 0Fifty-plus patch attempts, nothing applied, nothing added. Pure burn.
-
Context pressure
context_pressureRule compaction_count > 15The session spent more effort compacting context than moving forward.
-
Truncation
truncationRule at least one message with finish = lengthOutput hit the token ceiling. Whatever came next was never written.
-
Metadata bug
omo_metadata_bugRule session title starts with the literal 'undefined'A harness-side metadata defect leaked into the stored title.
-
Security anomaly
security_anomalyRule title matches local injection-like string heuristicsWorth a human look. String matching only — no model, no network.
-
Low yield, high cost
low_yield_high_costRule > 1M tokens, no additions, no successful apply_patchA million tokens spent with nothing landing in the diff.
-
Data quality gap
data_quality_gapRule session month falls in a known low-coverage windowNot a session problem — a dataset problem. Flagged so it is never read as a real zero.
Architecture
Two SQLite connections, both read-only
One scanner writes the cache. One server reads it. The source database is never in a writable state anywhere in the process tree.
opencode.db
OpenCode source · RO always
readonly · query_only
analytics.sqlite
derived cache · RO for API
scan.ts → write
Ecosystem
What it plugs into
OpencodeView sits downstream of two projects it does not own. One is required, one is optional, and neither is affiliated with it.
-
OpenCode
RequiredThe agent runtime and the session store
OpenCode owns the agent runtime and the on-disk database that OpencodeView reads. Schema evolution belongs to them, so the SQLite adapter here is best-effort and may lag upstream migrations. When source data looks wrong, that is where it should be investigated — flags on this side are local operator heuristics, not statements about OpenCode.
-
oh-my-openagent
OptionalOptional harness that enriches the Live lens
An agent harness for OpenCode, also known as omo. When its activity log is readable, the server overlays per-session poll telemetry onto the Live lens: the suspect health state, and terminal events such as poll_timeout, max_turns, aborted_by_user and terminal_error. The omo_metadata_bug flag also originates here. Everything else works without it.
OH_MY_OPENCODE_LOG=$TMPDIR/oh-my-opencode.log Both are third-party projects. OpencodeView is not affiliated with, endorsed by, or maintained by either.
Source
The whole thing is on GitHub
No hidden core, no paid tier, no vendored binary. What you audit is what you run.
git clone https://github.com/4i3n6/opencodeview.git - License
- Apache-2.0
- Runtime
- Bun ≥ 1.3.0
- Server
- Hono
- UI
- React + Vite + Tailwind
- Store
- SQLite (RO source + derived cache)
- Distribution
- Source-only
Repository layout
-
src/scan.tsrollups, flags, cache schema -
src/server.tsHono routes, bind + auth guards -
src/redaction.tsoutbound payload scrubbing -
src/stats.tsEWMA, changepoint helpers -
web/src/dashboard, charts, i18n catalogs -
docs/architecture one-pager (EN + PT-BR) -
scripts/release + identity gates
What CI enforces
- bun run test — root and web suites
- bun run typecheck — strict TypeScript, both workspaces
- bun run lint — oxlint
- bun run build — production web build
- bun audit — dependency advisories
- Gitleaks — mandatory secret scan, fails the gate
- Conventional Commits + release harness validation
Security
Defaults that assume you will forget
The trust boundary is your machine. Every default is picked so that the unsafe path requires you to type something extra.
-
Bind
Defaults to 127.0.0.1, with localhost and ::1 accepted. Host and Origin guards apply on loopback.
-
Auth
Any non-loopback host requires OPENCODEVIEW_AUTH_TOKEN. Without it the process exits instead of starting unprotected.
-
Redaction
Secret-like keys, bearer tokens, common provider prefixes, URL userinfo and absolute home paths are replaced before serialization.
-
Caching
API responses are sent with Cache-Control: no-store. Nothing analytical lands in an intermediary.
-
Telemetry
There is none. The runtime opens no outbound product analytics connection of any kind.
-
Supply chain
Gitleaks runs as a mandatory gate in bun run check, alongside tests, typecheck, lint, build and dependency audit.
Exposing past loopback is an operator choice. Review the redaction rules against your own data before you make it.
Honest by default
Non-goals
Things this project has decided not to be.
- Replacing OpenCode or shipping an official OpenCode UI
- Claiming affiliation with or endorsement by the OpenCode team
- Cloud or multi-tenant hosted analytics
- npm and registry distribution or an installer — source-run only
- A stable, versioned integration contract against opencode.db before 1.0.0
Known limitations
Documented up front, because you will hit them.
- opencode.db is an internal OpenCode implementation detail — the adapter is best-effort and may lag upstream schema changes
- cost is only comparable within the same billing regime; some auth modes report zero
- Sessions from 2026-06 and 2026-07 have incomplete summary_additions coverage and get tagged data_quality_gap
- Sessions that used legacy edit/write tools instead of apply_patch do not populate apply_patch counters
- Expect breaking changes to the cache schema, API and CLI before 1.0.0
Get started
Clone, scan, serve
Three commands between you and the dashboard. Requires Bun ≥ 1.3.0 and a local OpenCode database.
-
Clone and install
The web workspace installs separately — it is a distinct Vite app.
git clone https://github.com/4i3n6/opencodeview.git cd opencodeview bun install cd web && bun install && cd .. -
Materialize the cache
Reads the source read-only and writes rollups into its own SQLite file. Point OPENCODE_DB elsewhere if your install is non-standard.
bun src/scan.ts --all # or a single project bun src/scan.ts --list bun src/scan.ts <project> -
Serve the dashboard
API and UI run as two processes, both bound to loopback.
bun run serve # http://127.0.0.1:4317 bun run web # http://127.0.0.1:5273
FAQ
Questions worth answering
Can OpencodeView corrupt my OpenCode database?
Does any session data leave my machine?
Is this an official OpenCode product?
How do I install it — npm, brew, Docker?
What are flags, exactly?
Why is patch precision sometimes unavailable?
Can I expose the dashboard on my network?
Does it work if my OpenCode database is somewhere unusual?
Your agents already wrote the logs.
OpencodeView just makes them readable — on your machine, under your rules.