Cursor activity-by-model card from local tracking - #61
Conversation
Cursor doesn't log tokens locally, but its ai-code-tracking.db records which model produced each accepted AI code block. Surface that as an honest activity breakdown (never spend), so heavy Cursor models like grok-4.5 are visible. - rust: new cursor_activity module reads ~/.cursor/ai-tracking/ai-code-tracking.db (rusqlite, read-only), grouping ai_code_hashes by model over a 30-day window into contributions + distinct requests, ranked by contributions. Returns empty on a missing/locked/old-schema db rather than erroring. - chart.rs: get_cursor_model_activity command + CursorModelActivityRow; wired in main.rs + commands.toml. - bridge.ts type + getCursorModelActivity wrapper. - ChartsSection: a "Cursor activity by model - 30 days" card (share bars, contributions + requests, "default" relabeled "Auto") shown for the Cursor provider even without chart history, with a clear note that it is activity, not tokens or spend. Tests: backend aggregation + window/blank-model exclusion (in-memory sqlite); frontend render asserting shares, the Auto relabel, and the honest framing. Clippy/fmt/tsc clean; rust 382+2, frontend 259.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ceiling | 7b2c33a | Commit Preview URL Branch Preview URL |
Jul 19 2026, 02:34 AM |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds local Cursor Composer activity aggregation over 30 days, exposes it through a Tauri command and TypeScript bridge, and displays per-model contribution shares in the Cursor provider charts section with supporting tests and styles. ChangesCursor activity reporting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ChartsSection
participant TauriBridge
participant NativeCommand
participant CursorTrackingDB
ChartsSection->>TauriBridge: getCursorModelActivity()
TauriBridge->>NativeCommand: invoke get_cursor_model_activity
NativeCommand->>CursorTrackingDB: aggregate the current 30-day window
CursorTrackingDB-->>NativeCommand: model contributions and requests
NativeCommand-->>TauriBridge: typed activity rows
TauriBridge-->>ChartsSection: render Cursor activity card
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.tsx`:
- Line 451: Update the provider gating in the charts section to require the
current provider to be Cursor: include isCursor in both the hasCursorActivity
calculation and the CursorActivity render condition. Preserve the existing
cursorActivity length checks so stale data cannot render during provider
transitions.
- Around line 392-394: Update the ChartsSection rendering flow so successful
getCursorModelActivity() data still produces a Cursor activity-only section when
getProviderChartData() returns no data or fails. Handle this case before the
existing !data || failed early return, while preserving the current combined
chart rendering behavior. Add a regression test covering rejected chart-data
retrieval with available cursor activity.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ae1b5741-68ef-4f52-868e-8aa18d91dfc8
⛔ Files ignored due to path filters (4)
design/x-ad-square.svgis excluded by!**/*.svgdocs/images/ceiling-screenshot.pngis excluded by!**/*.pngdocs/images/ceiling-x-ad-square.pngis excluded by!**/*.pngdocs/images/ceiling-x-ad.pngis excluded by!**/*.png
📒 Files selected for processing (10)
apps/desktop-tauri/src-tauri/permissions/commands.tomlapps/desktop-tauri/src-tauri/src/commands/chart.rsapps/desktop-tauri/src-tauri/src/main.rsapps/desktop-tauri/src/lib/tauri.tsapps/desktop-tauri/src/styles.cssapps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.test.tsxapps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.tsxapps/desktop-tauri/src/types/bridge.tsrust/src/cursor_activity.rsrust/src/lib.rs
…eRabbit) - Render the Cursor activity card in the `!data || failed` branch too, so a failed chart-history read no longer hides activity that loaded fine. Adds a regression test. - Gate the card on the current provider (isCursor) so a stale cursorActivity fetch from a previous selection can't briefly flash in another provider's view before the effect clears it.
Version bump to **1.2.0** across manifests + `version.env`, with the 1.2.0 changelog entry. No code changes beyond version strings; all feature work already merged and green on main. ### Since 1.1.0 - **Depletion ETA** — Calm mode and the dashboard show "about ~42m left" instead of just flagging a running-low window (SOU-274, #64) - **`statusline` command** — cache-only, prints remaining capacity for editor status bars without waking the app or hitting the network (SOU-271, #65) - **Per-project cost** — 30-day spend split by project alongside model/effort (SOU-272, #66) - **CSV export** — export a provider's 30-day spend to Downloads from the charts view (SOU-273, #67) - **Cursor activity card** — activity-by-model share from local request logs (#61) Release doctor passes. Tag `v1.2.0` will be pushed after merge to trigger the signed Windows build. Co-authored-by: tsouth89 <tsouth89@users.noreply.github.com>
What
Cursor doesn't log tokens locally (so it can't join the dollar-spend cards), but its
~/.cursor/ai-tracking/ai-code-tracking.dbrecords the model behind each accepted AI code block. This surfaces that as an honest per-model activity breakdown, so heavy Cursor models (e.g.grok-4.5) are visible without fabricating token/dollar numbers.Changes
cursor_activitymodule: reads the tracking db (rusqlite, read-only), groupsai_code_hashesby model over a 30-day window into contributions (code blocks) + distinct requests, ranked by contributions. Returns empty on a missing / locked / older-schema db rather than erroring.get_cursor_model_activitycommand +CursorModelActivityRow; registered in main.rs + permissions/commands.toml.getCursorModelActivitywrapper.defaultrelabeled "Auto". Shown for the Cursor provider even when there's no quota chart history, with a clear note: activity, not tokens or spend (Cursor logs neither locally).Tests
Clippy (
-D warnings) / fmt / tsc clean; rust 382 desktop + 2 lib, frontend 259.Note: the in-app browser preview was unavailable this session, so the card was verified via the render test + a static style mock rather than a live screenshot.
Summary by CodeRabbit