Command Overview
beacon token-usage sync-cursor extracts runtime-recorded token usage from Cursor’s
local state store (state.vscdb) and appends it to the Beacon runtime log as
canonical token.usage events, so beacon token-usage and
the dashboard token view cover Cursor sessions.
Command syntax
How it works
- Read-only and offline. The command copies the state store to a private temporary snapshot before reading, never touches Cursor’s live files, and writes only to the local runtime JSONL log. It is safe to run while Cursor is open.
- Best-effort extraction. The store is Cursor’s internal, undocumented database. Generations without recorded token counts are skipped (some Cursor builds record zeros), unparseable rows are skipped and counted in the summary, and Beacon never estimates token counts or derives cost locally.
- Canonical output. Synced events carry
gen_ai.usagewith the standard disjoint token fields,harness.name=cursor, the model Cursor recorded, and the conversation id assession.id— the same id Cursor hook events carry, so per-session rollups join hook activity with synced usage. - Idempotent. Synced generations are remembered in a local state file
(default
~/.beacon/cursor/usage-sync-state.json) and skipped on later runs. If the state file is lost, it is rebuilt from the runtime log before syncing. - No double counting. Synced events are marked as a metric channel
(
raw.metric_name=cursor.db.token.usage). If a Cursor release starts including usage in hook payloads, hook-reported usage takes precedence in rollups and synced counts for the same session are suppressed.
Examples
Sync Cursor usage into the per-user runtime log:Sync Cursor token usage
Dry run
Bound the backfill
Report Cursor usage
Flags
Summary output
Each run prints one summary line so an empty sync is explainable:Example summary
Related
Token usage report
Report token usage and attribution from Beacon runtime logs.
Cursor runtime
Cursor endpoint telemetry support details.

