--- summary: "Cursor provider data sources: browser cookies or stored session; usage + billing via cursor.com APIs." read_when: - Debugging Cursor usage parsing - Updating Cursor cookie import or session storage - Adjusting Cursor provider UI/menu behavior --- # Cursor provider Cursor is web-only. Usage is fetched via browser cookies or a stored WebKit session. ## Data sources + fallback order 1) **Browser cookie import** (preferred) - Cookie order from provider metadata (default: Safari → Chrome → Firefox). - Domain filters: `cursor.com`, `cursor.sh`. - Cookie names required (any one counts): - `WorkosCursorSessionToken` - `__Secure-next-auth.session-token` - `next-auth.session-token` 2) **Stored session cookies** (fallback) - Captured by the "Add Account" WebKit login flow. - Login teardown uses `WebKitTeardown` to avoid Intel WebKit crashes. - Stored at: `~/Library/Application Support/CodexBar/cursor-session.json`. ## API endpoints - `GET https://cursor.com/api/usage-summary` - Plan usage (included), on-demand usage, billing cycle window. - `GET https://cursor.com/api/auth/me` - User email + name. ## Cookie file paths - Safari: `~/Library/Cookies/Cookies.binarycookies` - Chrome/Chromium forks: `~/Library/Application Support/Google/Chrome/*/Cookies` - Firefox: `~/Library/Application Support/Firefox/Profiles/*/cookies.sqlite` ## Snapshot mapping - Primary: plan usage percent (included plan). - Secondary: on-demand usage percent (team on-demand preferred when present). - Provider cost: on-demand usage USD (limit when known). - Reset: billing cycle end date. ## Key files - `Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift` - `Sources/CodexBar/CursorLoginRunner.swift` (login flow)