Runtime reference
opencode#
opencode persists everything to one SQLite database, with both tokens and cost recorded per session and per assistant message. It is one of the cleanest stores in the matrix.
| Runtime id | opencode |
| Category | Terminal coding agent |
| Vendor | SST |
| Tier | Paid tier (Starter and up) |
| Upstream | github.com/sst/opencode |
Where the data comes from#
ClawMetry reads these locations, in order, and never writes to any of them.
$XDG_DATA_HOME/opencode/opencode.db (default ~/.local/share/opencode/opencode.db)
Format. SQLite session / message / part tables; message.data and part.data are JSON. Timestamps are epoch milliseconds.
Environment variables#
| Variable | Effect |
|---|---|
CLAWMETRY_OPENCODE_DB | point at a specific database |
XDG_DATA_HOME | honoured for the default path |
See Environment variables for the variables that apply to every runtime.
Tokens and cost#
Tokens. Real, per session and per assistant message, including the cache read/write split.
Cost. Real, on disk. A local Ollama provider records cost=0 honestly and ClawMetry passes that through unchanged.
Why this section exists
Runtimes differ enormously in what they persist. Rather than showing a plausible number everywhere, ClawMetry reports what the store actually contains and marks the rest unknown. A cost of $0.00 and a cost of unknown mean different things, and the dashboard keeps them different.
Things worth knowing#
- The database runs in WAL mode; ClawMetry opens it with the WAL visible so freshly written sessions are not missed.
Verify it is being read#
# Is this runtime detected, and would this install unlock it?
clawmetry runtimes --json | jq '.runtimes[] | select(.id=="opencode")'
# Why is it locked, if it is?
clawmetry runtimes --why opencode
# Any sessions ingested yet?
curl -s 'http://localhost:8900/api/local/sessions?limit=5' \
| jq '.rows[] | {session_id, agent_id, events, cost_usd}'If detection succeeds but no sessions appear, work through Troubleshooting — the usual causes are a relocated data directory (set the override above), a session limit that is hiding older runs, or a runtime that simply has not written anything yet.