Skip to main content

Cortex usage and savings measurement

Status: Ready

Truth label: Current

Audience: Fleet operator

Reader outcome: Use cortex usage and savings measurement in Cortex, with every control, its verification, and its limits stated.

Last verified: 2026-09-13

Open Analytics > Usage and savings measurement. The report separates native request usage, Forge task attempts, operator acceptance, and actual account observations. It supports the experiments in the Claude usage review. The measurements do not establish savings by themselves.

Start a comparison​

  1. Pause the project before creating comparison tasks so workers cannot claim them while settings are being entered.
  2. Create matched tasks with the same acceptance checks. Use the existing execution settings to choose the model, effort, managed method revision and skills.
  3. In Analytics, open Task comparison settings, enter a pending task ID, and load it. Set its category, account label, comparison name, variant, helper policy and context strategy. These labels describe the intended experiment; they do not change execution settings or issue agent instructions.
  4. Optionally set an advisory estimate budget across that task's recorded attempts. The budget displays consumption after terminal reports. It does not stop execution or add a turn limit. Separate follow-up task IDs remain separate task totals.
  5. Save the settings, then unpause the project. Every claim freezes its comparison labels. A concurrent claim or edit produces a conflict instead of silently changing the experiment.
  6. Review the result through the normal final checkpoint and record a grade. Add total operator editing/review minutes through the task measurements editor. Missing minutes remain unknown. Plan approval and model completion do not count as final operator acceptance.

Use separate variants for a lighter method, a lower model/effort setting, fewer helpers, or fresh versus resumed context. Change one dimension at a time and repeat comparable tasks. Method IDs and revisions, actual reported model lists, requested and effective effort, prompt size, resumed attempts, verification scopes, failures and operator revisions remain visible. Effective effort stays unknown when the engine does not report it. The existing outcome report supplies observational retrieval/grade comparisons; prompt and retrieval traces supply the underlying context evidence.

The accepted-task estimate includes all recorded attempts, including attempts older than the report window. Only fully priced tasks enter cost averages, and the denominator is displayed. Final acceptance must refer to the latest recorded run and agree with the current task state. Acceptance overrides are identified. Tasks whose comparison labels changed between attempts form a separate mixed-history group. Cohorts are observational; review difficulty, verification and editing effort before attributing a difference to the variant.

Record Pro/Max allowance and actual charges​

In Subscription charges and allowance, save observations from the usage page or invoice. Use a stable account label. For allowance snapshots, retain the exact period start/end and window label, such as weekly or session, and enter the percentage already used. Dates entered in Cortex use the browser's local time and are stored in UTC.

At least two observations in the same account/provider/window/period are needed to show consumed percentage points. A decreasing percentage is flagged as inconsistent instead of becoming negative consumption. Use a new period for a reset. The linked accepted-task count uses the matching account label and the interval between snapshots. Other concurrent activity can consume that account's allowance, so this ratio is observational and is not per-task billing attribution.

Record subscription fees, extra-usage charges and API charges as separate dollar observations. The report sums charges by their observation date within the selected window; it does not prorate fees. Edit or withdraw an erroneous observation through its row. Earlier versions remain in history. Tokens and CLI estimates cannot supply missing invoice values or reconstruct historical plan percentages.

Collection and accounting​

Collection sources and refresh edits paths on the Central host and its refresh interval. Zero disables automatic collection; Collect now performs an explicit scan. The default interval is 300 seconds. Workers started with the updated code collect their own ~/.claude/projects unless configured otherwise. Restarting Central does not update already running workers.

Worker configuration:

VariableDefaultMeaning
SE_MANAGER_USAGE_CAPTURE_INTERVAL_SECONDS300Worker scan interval; 0 disables collection
SE_MANAGER_USAGE_TRANSCRIPT_ROOTS[]JSON list of paths on that host; workers use their Claude home when empty

Central begins with these configuration defaults and uses its saved, host-specific Cortex settings when present. An empty Central root list scans nothing. Saving a new interval takes effect after the current scheduled wait. Missing, inaccessible, partial and stale sources remain visible. Stale means the last scan exceeds the larger of 15 minutes or three configured intervals. Worker coverage lists instances that have never supplied a usage report; a Central scan can still cover their files. Malformed-line counts describe changed files read in that scan.

The parser retains request/message identity, request timestamps, parent session and agent identity, actual model, project/branch metadata, uncached input, cache reads, cache writes and output. It skips synthetic responses. Streaming blocks and copied transcripts merge the largest observed cumulative counts per engine/request/message, rather than summing duplicate blocks. Changed files are retried until delivery is acknowledged. Request timestamps, not a session's end date, determine report-window membership.

<data_dir>/usage.sqlite3 holds canonical request metadata, source status, versioned measurement records and history. It stores no prompts, tool arguments or response prose. Native request totals can overlap Forge attempt totals. The report identifies session matches and keeps the totals separate. Unmatched requests can include workers whose Forge session identity was never captured. Helpers are reported separately at request level; a CLI run estimate can already include them, so never add those two totals.

Claude input excludes cached reads and writes. Codex and current LangChain chat input include them. The shared normalizer accounts for these differences before cache fractions and pricing. Historical chat rows with unknown semantics do not receive a cache percentage. Thinking tokens, where reported, are a subset of output and must not be added again; absent thinking counters do not establish zero thinking.

For a one-time import or compatibility session-ledger refresh:

python scripts/import_sessions.py --data-dir /path/to/data \
--transcript-root /path/to/.claude/projects --configure-refresh

Repeat --transcript-root for multiple homes. --dry-run writes nothing. Run this with the native interpreter of the host that owns the SQLite files. The legacy sessions.jsonl snapshot remains available, but automatic collection and exact request-window comparisons use usage.sqlite3.

Price assumptions and export​

Model prices for usage estimates accepts operator-supplied USD rates per million tokens for fresh input, output, cache reads and cache writes. Missing rates remain unknown. Exact model matches take priority; otherwise the longest prefix wins. Record the source and date with the table. No price table ships with the application.

Saved Cortex prices take precedence over the legacy <data_dir>/model_prices.json. Edits are revision checked and retained in history. New task runs freeze rate values and completeness at completion. Older runs without that snapshot and native request estimates use the current table. A provider's nonzero reported estimate remains its own measurement. None of these estimates is a Pro/Max charge.

Export measurements downloads the loaded report, including coverage, request groupings by model/day/session, task comparisons, account observations and budget status. Histories remain available through the editors and history API. Collection covers available local Claude transcripts and existing Forge/Brain ledgers; it does not capture unseen web/app activity or invent missing historical settings.

Installation verification, 2026-09-10​

The Windows Central was restarted with no runnable tasks. Its saved collection roots cover the Windows Claude home and the Ubuntu-24.04 WSL Claude home. The initial backfill recovered 11,713 distinct requests; the live collector subsequently reached 11,719 with both sources fresh and zero scan errors. SQLite integrity and the authenticated report/export endpoints passed. No account observations or model rates were invented. Other worker processes still need to load the updated code before sending their own collection reports, including the Mac hosts.

The full WSL suite passed 1,597 tests with 26 skips and one embedding-dependent test checked separately on Windows, where it passed. Final focused accounting/execution checks passed all 56 tests. The Cortex browser flow covers prices, task labels, allowance snapshots, history, export and reload. Lint and syntax checks passed for the new files; changed Python lines and the diff have no check findings. These checks validate measurement behavior, not model quality or actual savings.