Imported from kingdomseed/cursor-calculator (
AGENTS.md). Install upstream withnpx skills add kingdomseed/cursor-calculator. Copyright stays with the author.
AGENTS.md
This file provides guidance to coding agents working in this repository.
Project Goal
This project is an empirical budgeting tool for Cursor IDE pricing. Every number shown in the app must trace back to Cursor's official docs at https://cursor.com/docs and the relevant pricing or individual model pages. Do not invent or assume pricing rules. If a pricing rule or model rate cannot be sourced from Cursor docs, mark it as unverified instead of presenting it as fact.
The app answers three questions:
- Budget mode — “I have a budget.” Which plan is best, and how many tokens do I get per model?
- Token mode — “I know my token usage.” What will it cost, and which plan covers it?
- CSV replay mode — “I have a Cursor usage export.” Reprice the exact imported token columns and show which plan would have covered that month.
Source-of-Truth Boundaries
Manual mode and CSV replay do not share the same source catalog:
src/data/cursor-pricing.jsonis the source of truth for current Cursor-supported manual calculations.src/data/importReplayHistoricalModels.tsandsrc/data/importReplayLabelMappings.tsexist only for CSV replay of retired historical labels and mapping policy for labels that no longer have a current Cursor catalog entry.- Import-only historical or provider-backed estimates must stay visibly approximate and must not leak into the manual model selector as though they were current Cursor-native entries.
When Cursor updates pricing, update the underlying data and the calculations together so the UI remains consistent with the docs.
Commands
npm install— install dependenciesnpm run dev— run the Vite dev servernpm run build— type-check and build production assets intodist/npm run lint— run ESLintnpm run preview— preview the production buildnpm test— run Vitest oncenpm run test:watch— run Vitest in watch mode
Architecture
This is a single-page React + TypeScript app deployed to Vercel.
Stack: React 19, TypeScript 5.9, Vite 7, Tailwind CSS 4 via @tailwindcss/postcss.
Key structure
src/App.tsx— composition root and page layoutsrc/app/calculatorState.ts— reducer-owned source state and defaultssrc/app/calculatorReducer.ts— calculator state transitionssrc/app/calculatorSelectors.ts— derived app view data, replay reports, and recommendationssrc/app/cursorImportActions.ts— import action sequencingsrc/app/cursorImportPresentation.ts— UI-facing replay summary formattingsrc/app/useCalculatorController.ts— reducer wiring, file reading, and UI callbackssrc/components/— presentational UI components, including import flow UIsrc/data/cursor-pricing.json— current Cursor pricing catalog for manual modesrc/data/importReplayHistoricalModels.ts— import-only historical replay modelssrc/data/importReplayLabelMappings.ts— import-only replay label mappings and approximationssrc/domain/catalog/— current Cursor catalog accessors and typessrc/domain/recommendation/— pricing math, effective rates, conversions, and recommendationssrc/domain/importReplay/— CSV parsing, normalization, pricing, aggregation, and summary logicsrc/domain/modelConfig/— model config defaults, selection reconciliation, and capability helperssrc/lib/types.ts— shared type barrel for component importssrc/domain/*/__tests__/andsrc/app/__tests__/— current automated coveragedata/private/raw/cursor/— optional local-only copied Cursor export fixtures;data/private/is gitignored
There is no routing layer or external state-management library. Keep src/App.tsx composition-focused, app orchestration in src/app/, and domain logic in src/domain/.
Core calculation logic
getPricingCatalog(),getManualApiModels(),getPlans()— current manual catalog accessorsgetImportReplayModels()— replay catalog assembly from current and historical import-only modelscomputeRecommendation()— shared recommendation entry point for budget mode and manual token modecomputeExactUsageRecommendation()— plan comparison logic for imported exact-usage rowscomputeBillableRates()andcomputeEffectiveRates()— Max/long-context rate overrides, fast variants, and caching mathparseCursorUsageFiles()— CSV parsing, billable row filtering, normalization, replay pricing, and summariesuseCalculatorController()— app orchestration for reducer state, selectors, and CSV-loading side effects
Budget mode uses exact-token pricing with cache-read share via dollarsToExactTokens(). The legacy DEFAULT_RE_READS = 3 pattern is only used by the per-model effective rate display in ModelConfigRow.
Pricing Domain Rules
All pricing facts should be verified against Cursor docs before changing the catalog or recommendation logic.
Empirical boundary
- Manual calculator mode may only expose models and rates present in
src/data/cursor-pricing.json. - CSV replay may use import-only estimates for retired labels from historical exports, but those rows must remain clearly labeled as approximate.
- Do not move provider-backed replay estimates into the main pricing JSON unless Cursor publishes a current first-party pricing entry for them.
Usage pools
- Cursor Models — Composer 2.5, Grok 4.6, and Grok 4.5. Generous included usage; no published dollar amount. Auto is a router, not a pool.
- Other Models — third-party models at API rates. Last published official floors: Pro at least
$20, Pro Plus$70, Ultra$400. Live docs now say only “Included.” Those floors are not current guaranteed included dollars. Ultra used to include$400on a$200plan; you may not get that now. Teams dollars unpublished. - Do not treat
$20/$70/$400as current guaranteed coverage in recommendation or overage math. Keep them as last-published historical floors. If a floor still applies, billed-beyond is usage minus that floor. If it does not, Other Models usage bills in full. Teams/Enterprise add$0.25/Mon third-party tokens.
Max Mode
Max Mode is available only on legacy request-based plans, at API rate plus 20%. Current usage-based plans do not include Max Mode, so the +20% upcharge is hidden. Some model pages publish separate long-context rates when input exceeds the default context window.
Current documented examples:
- Claude 4.6 Sonnet and Claude Opus 4.8: no long-context surcharge — same per-token rates in Max Mode
- Gemini 3.1 Pro: input
2xand output1.5xwhen input exceeds200k - GPT-5.4 and GPT-5.5: input
2xand output1.5xwhen input exceeds272k
Model-specific long-context rates belong in the catalog as documented rate overrides. Do not infer a blanket Max Mode multiplier.
Fast mode
Fast mode is a distinct model variant, not a toggle on the base model.
- Claude Opus 4.8 Fast:
$10/Minput and$50/Moutput, and requires Max Mode - GPT-5.5 Fast:
$12.50/Minput and$75/Moutput - GPT-5.6 Sol, Terra, and Luna Fast:
2xeach model's standard rates - Composer 2.5 Fast:
$3/Minput and$15/Moutput - Grok 4.5 Fast:
$4/Minput and$18/Moutput
Historical imported fast labels may still be replayed as best-effort estimates, but that approximation logic belongs only in the import layer.
Thinking mode
Thinking mode exists for Claude models, current GPT models, Gemini models, and Composer 2.5, but Cursor docs do not currently publish separate token pricing for thinking tokens.
Context windows
- Claude Opus 4.8 and Claude Fable 5:
300kdefault,1Mmax - Claude 4.6 Sonnet and Gemini 3.1 Pro:
200kdefault,1Mmax - GPT-5.5 and GPT-5.4:
272kdefault,1Mmax - Claude Sonnet 5:
200kdefault,1Mmax - GPT-5.6 Sol:
272kdefault,1Mmax; input2xand output1.5xabove272k - GPT-5.6 Terra and Luna:
272kdefault, no Max Mode extension - Composer 2.5:
200kdefault, no Max Mode - Grok 4.5:
256kdefault, no Max Mode extension - GLM 5.2:
200kdefault, no Max Mode extension - Kimi K2.7 Code:
262kdefault, no Max Mode extension
Testing and Verification
- Prefer targeted tests for the area you changed before broader validation.
- Run
npm testfor logic changes andnpm run lintfor code quality when relevant. - Use
npm run buildbefore finalizing significant app or type changes. - Browser verification still matters for file-upload behavior because there is not yet a committed jsdom/browser integration suite for the import UI path.
Styling and UI
- Use Tailwind utility classes inline; there is no component library.
- Keep the existing palette aligned with
#14120b,#f7f7f4, and#e0e0d8. - Reuse the established provider color mapping in
PROVIDER_COLORS.
Working Rules for Agents
- Keep changes minimal and aligned with the existing architecture.
- Fix root causes instead of layering on ad hoc patches.
- Do not add unsupported pricing assumptions or undocumented Cursor behavior.
- Treat imported historical replay behavior as approximate unless backed by current first-party Cursor docs.
- Preserve the distinction between current manual pricing data and historical replay-only data.
- Do not write mannered prose in UI copy or agent-facing repo docs. Mannered prose substitutes metaphor and flourish for direct statement. Write "a parameter worth varying," not "a dial worth turning." Write "this point still matters," not "this point earns its keep." Those phrases display the writer instead of stating the idea. They also import connotations you did not choose. When a literal phrase is available, use it.