Skip to content
OpencodeView

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.

Quickstart — copy/paste
$

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
Overview — OpencodeView dashboard showing live session tree, token rollups and delegation analytics

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_loop
    Rule 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_waste
    Rule patch_count > 50, apply_patch_ok = 0, summary_additions = 0

    Fifty-plus patch attempts, nothing applied, nothing added. Pure burn.

  • Context pressure

    context_pressure
    Rule compaction_count > 15

    The session spent more effort compacting context than moving forward.

  • Truncation

    truncation
    Rule at least one message with finish = length

    Output hit the token ceiling. Whatever came next was never written.

  • Metadata bug

    omo_metadata_bug
    Rule session title starts with the literal 'undefined'

    A harness-side metadata defect leaked into the stored title.

  • Security anomaly

    security_anomaly
    Rule title matches local injection-like string heuristics

    Worth a human look. String matching only — no model, no network.

  • Low yield, high cost

    low_yield_high_cost
    Rule > 1M tokens, no additions, no successful apply_patch

    A million tokens spent with nothing landing in the diff.

  • Data quality gap

    data_quality_gap
    Rule session month falls in a known low-coverage window

    Not 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

scan.ts — writes cache only transcript + live — RO, redacted

analytics.sqlite

derived cache · RO for API

scan.ts → write

server.ts (Hono)
/api/* — loopback
Vite UI

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

    Required

    The 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

    Optional

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

Point the server at the harness log: 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.ts rollups, flags, cache schema
  • src/server.ts Hono routes, bind + auth guards
  • src/redaction.ts outbound payload scrubbing
  • src/stats.ts EWMA, 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.

  1. 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 ..
  2. 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>
  3. 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?
No. The source connection is opened with readonly: true and pinned with PRAGMA query_only = 1, so writes are rejected at the SQLite engine level rather than by application logic. The cache path is additionally validated so it can never resolve to the same file, symlink or hardlink as the source.
Does any session data leave my machine?
No. There is no telemetry and the runtime opens no outbound connection. The default bind is loopback, and going beyond it requires you to set an auth token — without one the server refuses to start rather than exposing an unauthenticated surface.
Is this an official OpenCode product?
No. OpencodeView is an independent, unofficial companion for people already running OpenCode locally. It is not affiliated with or endorsed by the OpenCode team, and it is not a substitute for OpenCode's own product surface.
How do I install it — npm, brew, Docker?
None of those. v0.9.0 is source-only by design: clone the repository and run it with Bun. There is no npm package, binary, container or installer, and APIs, cache schema, CLI flags and environment variables should be treated as unstable until 1.0.0.
What are flags, exactly?
Heuristic labels computed locally over cached session rows — for example a tool failure loop is 20 or more tool calls with an error rate above 30 percent. They are operator signals about your own runs, derived from data on your disk. They are not statements about OpenCode product quality.
Why is patch precision sometimes unavailable?
Because sessions that used the legacy edit and write tools never populate the apply_patch counters. Rather than inferring a number, the interface renders an explicit unavailable state — a missing metric should never be readable as a zero.
Can I expose the dashboard on my network?
You can, and it is deliberately friction-heavy. Set OPENCODEVIEW_HOST to a non-loopback address and OPENCODEVIEW_AUTH_TOKEN to a bearer token; omitting the token aborts startup. Review the redaction rules against your own transcripts before you do it.
Does it work if my OpenCode database is somewhere unusual?
Yes. Set OPENCODE_DB to the path you use. The default is ~/.local/share/opencode/opencode.db, and every other path in the system is likewise configurable through environment variables.

Your agents already wrote the logs.

OpencodeView just makes them readable — on your machine, under your rules.