Skip to main content

Module cursor

Module cursor 

Source
Expand description

Cursor session reader (local SQLite blob stores).

Cursor keeps session data in two places under ~/.cursor:

  • ai-tracking/ai-code-tracking.db — one row per AI-authored code line, carrying the model that wrote it. Used to attribute each conversation to a model for the analysis view (conversationId -> model).
  • chats/<projectHash>/<conversationId>/store.db — a content-addressed blob store holding the whole conversation. Assistant turns live in binary protobuf DAG nodes (field 4 = the message JSON, field 26 = timestamp, field 5 = the running context-window gauge); tool results live in standalone JSON blobs. Parsed for analysis tool-call metrics.

Cursor does not persist real billing tokens locally (only the context gauge), so the usage view is a deliberately-rough local estimate from that gauge (there is no dashboard-API path here; see docs/quota.md for the raw endpoint if it is ever reintroduced), keeping Cursor consistent with the other providers whose usage is likewise computed from local session data.

Both entry points return the same (local YYYY-MM-DD, CodeAnalysis[, cost]) shape the OpenCode reader produces, so the usage / analysis aggregators fold Cursor in exactly like the other providers.

Functions§

read_cursor_analysis
Reads per-model file-operation metrics for Cursor from the chat stores.
read_cursor_usage
Reads per-model token usage for Cursor.