Skip to content

Cursor activity-by-model card from local tracking - #61

Merged
tsouth89 merged 2 commits into
mainfrom
feat/cursor-model-activity
Jul 19, 2026
Merged

Cursor activity-by-model card from local tracking#61
tsouth89 merged 2 commits into
mainfrom
feat/cursor-model-activity

Conversation

@tsouth89

@tsouth89 tsouth89 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

What

Cursor doesn't log tokens locally (so it can't join the dollar-spend cards), but its ~/.cursor/ai-tracking/ai-code-tracking.db records 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

  • rust cursor_activity module: reads the tracking db (rusqlite, read-only), groups ai_code_hashes by 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.
  • chart.rs: get_cursor_model_activity command + CursorModelActivityRow; registered in main.rs + permissions/commands.toml.
  • bridge.ts type + getCursorModelActivity wrapper.
  • ChartsSection: a "Cursor activity by model - 30 days" card with share bars, contributions + requests per model, and default relabeled "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

  • Backend: aggregation ranking + window/blank-model exclusion (in-memory sqlite, exercises the real query).
  • Frontend: render asserting shares (75% / 25%), the "Auto" relabel, and the honest framing.

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

  • New Features
    • Added a Cursor activity chart to provider settings (model-level contributions and tracked request totals over the past 30 days).
    • Added a new Cursor activity card within the charts UI for the Cursor provider, including the relabeled “Auto” default model.
    • Introduced a dedicated “cursor activity” visual section with progress-style contribution visualization and explanatory copy.
  • Bug Fixes
    • Improved resilience: if local activity data is unavailable/unreadable or fetch fails, the settings experience continues and the chart renders safely (or shows an empty state) instead of failing.

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.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fa2d1992-ce02-442e-9b3e-51cacfeacf99

📥 Commits

Reviewing files that changed from the base of the PR and between 8388bef and 7b2c33a.

📒 Files selected for processing (2)
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.tsx

📝 Walkthrough

Walkthrough

Adds 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.

Changes

Cursor activity reporting

Layer / File(s) Summary
Cursor tracking aggregation
rust/src/cursor_activity.rs, rust/src/lib.rs
Adds read-only SQLite aggregation of recent Cursor model contributions and distinct requests, with filtering, ordering, error fallback, and unit tests.
Tauri command and bridge wiring
apps/desktop-tauri/src-tauri/src/commands/chart.rs, apps/desktop-tauri/src-tauri/src/main.rs, apps/desktop-tauri/src-tauri/permissions/commands.toml, apps/desktop-tauri/src/lib/tauri.ts, apps/desktop-tauri/src/types/bridge.ts
Defines and registers the native command, permits invocation, and exposes typed activity rows through the frontend bridge.
Cursor activity chart display
apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.tsx, apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.test.tsx, apps/desktop-tauri/src/styles.css
Fetches Cursor activity, renders model shares and totals, updates the empty state, and validates the UI output with component styles and tests.

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
Loading

Possibly related PRs

  • tsouth89/ceiling#26: Establishes the Tauri command-boundary allowlist that this change extends.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a Cursor activity-by-model card sourced from local tracking.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cursor-model-activity

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 28d0a68 and 8388bef.

⛔ Files ignored due to path filters (4)
  • design/x-ad-square.svg is excluded by !**/*.svg
  • docs/images/ceiling-screenshot.png is excluded by !**/*.png
  • docs/images/ceiling-x-ad-square.png is excluded by !**/*.png
  • docs/images/ceiling-x-ad.png is excluded by !**/*.png
📒 Files selected for processing (10)
  • apps/desktop-tauri/src-tauri/permissions/commands.toml
  • apps/desktop-tauri/src-tauri/src/commands/chart.rs
  • apps/desktop-tauri/src-tauri/src/main.rs
  • apps/desktop-tauri/src/lib/tauri.ts
  • apps/desktop-tauri/src/styles.css
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/charts/ChartsSection.tsx
  • apps/desktop-tauri/src/types/bridge.ts
  • rust/src/cursor_activity.rs
  • rust/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.
@tsouth89
tsouth89 merged commit a589f97 into main Jul 19, 2026
10 of 11 checks passed
@tsouth89
tsouth89 deleted the feat/cursor-model-activity branch July 19, 2026 02:39
@tsouth89 tsouth89 mentioned this pull request Jul 19, 2026
tsouth89 added a commit that referenced this pull request Jul 19, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant