You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: replace SMTP with Resend, switch Slack to bot token, make thresholds opt-in (#9)
* feat: replace SMTP with Resend, switch Slack to bot token, make thresholds opt-in
- Replace nodemailer/SMTP with Resend SDK for email alerts (1 env var vs 6)
- Switch Slack from webhook to bot token + chat.postMessage for richer control
- Make static thresholds opt-in (default 0 = disabled), z-score and trends still active
- Pass DASHBOARD_URL through cron to alert links
- Update README: section title, config defaults, alerting docs
- Remove unused sendSlackResolution function
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add mock database for safe demos and screenshots
- Add scripts/generate-mock-db.ts: generates data/mock.db with 65 fake
users, 30 days of activity, anomalies, billing groups, and analytics
- Support DATABASE_PATH env var in db.ts for switching databases
- Add npm run dev:mock and Dev Server (Mock Data) VS Code task
- Commit mock.db (776KB) so cloners get demo data out of the box
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: rewrite anomaly detection to be spend-focused with smart batching
Detection was too noisy — model shift and drift alerts flagged normal
usage patterns, request-count alerts ignored cost, and 23+ individual
Slack messages bombarded the channel.
Detection changes:
- Remove model shift detection (using an expensive model isn't inherently bad)
- Remove drift/P75 detection (just identified power users, not actionable)
- Remove request-based z-score (high request count on cheap models is fine)
- Add daily spend spike: flags when today's spend > 5x personal average
- Add cycle spend outlier: flags when cycle spend > 10x active team median
- Z-score now spend-only, computed against active users (spend > $0)
- Minimum $50/day floor to avoid alerts on trivial amounts
- Critical threshold raised to 3x multiplier (was 2x)
Alerting changes:
- Slack uses bot token + chat.postMessage (replaces webhook)
- Batch alerts: ≤3 anomalies send individual messages, >3 sends summary
- Summary auto-chunks long lists to respect Slack's block character limit
- Add logging to Slack and email modules (missing config, send success/failure)
- Remove dead sendSlackResolution function
- Pass DASHBOARD_URL to alert links
Config changes:
- New trend settings: spendSpikeMultiplier, spendSpikeLookbackDays, cycleOutlierMultiplier
- getConfig() merges stored config with defaults for safe migration
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add npm publish support with npx setup command
- Add bin/create.mjs: `npx cursor-usage-tracker my-tracker` clones the
repo, installs deps, copies .env.example, and prints next steps
- Remove "private": true to allow npm publishing
- Add "files" field to ship only the bin/ directory (keeps package tiny)
- Add @semantic-release/npm for auto-publish on release
- Add NPM_TOKEN to release workflow
- Update README quick start with npx option
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Ofer Shapira <ofershap@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- API response shapes may not exactly match the live Cursor API. If real responses differ, update `src/lib/types.ts` and `src/lib/cursor-client.ts`.
88
-
- Trend detection can produce duplicate dedup keys (spike + drift both emit `trend:tokens` for same user) — first one wins, second is silently dropped.
88
+
- Trend detection can produce duplicate dedup keys (spend spike + cycle outlier both emit `trend:spend` for same user) — first one wins, second is silently dropped.
89
89
- CLI scripts (`npm run collect`, `npm run detect`) do NOT auto-load `.env` — use `source .env && export CURSOR_ADMIN_API_KEY` or run via the Next.js dev server cron endpoint instead.
Copy file name to clipboardExpand all lines: README.md
+43-36Lines changed: 43 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,7 @@
5
5
<h1align="center">Cursor Usage Tracker</h1>
6
6
7
7
<palign="center">
8
-
AI spend monitoring, anomaly detection, and alerting for teams on Cursor Enterprise.<br>
9
-
Know who's burning through your budget before the invoice tells you.
8
+
Know who's burning through your AI budget before the invoice tells you.
10
9
</p>
11
10
12
11
<palign="center">
@@ -21,7 +20,7 @@
21
20
22
21
---
23
22
24
-
## Why This Exists
23
+
## AI Spend Is a Blind Spot
25
24
26
25
Engineering costs used to be two things: headcount and cloud infrastructure. You had tools for both. Then AI coding assistants showed up, and suddenly there's a third cost center that nobody has good tooling for.
27
26
@@ -51,13 +50,12 @@ Developer uses Cursor → API collects data hourly → Engine detects anomaly
-**Slack**: Block Kit messages with severity, user, model, value vs threshold, and dashboard links
95
-
-**Email**: HTML-formatted alerts with the same context
92
+
-**Slack**: Block Kit messages via bot token (`chat.postMessage`) with severity, user, model, value vs threshold, and dashboard links. Batches alerts automatically (individual messages for 1-3 anomalies, single summary for 4+).
93
+
-**Email**: HTML-formatted alerts via [Resend](https://resend.com) (one API key, no SMTP config)
0 commit comments