CClawMetryDocs

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 idopencode
CategoryTerminal coding agent
VendorSST
TierPaid tier (Starter and up)
Upstreamgithub.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#

VariableEffect
CLAWMETRY_OPENCODE_DBpoint at a specific database
XDG_DATA_HOMEhonoured 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#

bash
# 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.

Cookie preferences