* fix(export): give the JSON export stable keys
The JSON export reused the CSV row builders, so its keys were display
headers with spaces and parentheses, and the money keys changed name
with the configured currency. A program had to reshape the file before
it could read it.
The builders now produce one camelCase row, and a single key to header
map writes the CSV, so every CSV header line stays byte-identical. The
JSON schema moves to codeburn.export.v3; the currency is stated once in
currency.code and the money values stay converted to it.
Before (v2, EUR):
{"Period":"7 Days","Date":"2026-11-02","Cost (EUR)":1.1,"Saved (EUR)":0,"API Calls":1,"Sessions":1,"Input Tokens":100000,"Output Tokens":50000,"Cache Read Tokens":200000,"Cache Write Tokens":30000,"costBasis":{"calculated":1}}
After (v3, EUR):
{"period":"7 Days","date":"2026-11-02","cost":1.1,"saved":0,"apiCalls":1,"sessions":1,"inputTokens":100000,"outputTokens":50000,"cacheReadTokens":200000,"cacheWriteTokens":30000,"costBasis":{"calculated":1}}
v2 consumers must rename keys. New keys can still appear under v3.
* docs: changelog entry for the v3 export JSON
* test: read the v3 export keys
Every served call now carries a costBasis: recorded when the tool wrote
its own figure, calculated when CodeBurn priced measured tokens,
estimated when the tokens or price are a guess, included when a
subscription covered it at $0, and unpriced when the model has no known
price. It is derived from fields the cache already stores, so no parse
or cache version moves.
The export JSON gives each record its basis and gives sessions and days
the share of cost from recorded, calculated and estimated; records.csv
gets the column. sessions --format json, the menubar payload and MCP
get_usage carry the same shares. Sync now sets ai.cost_estimated from
the basis instead of guessing from the provider name.
* fix(optimize): price findings from the calls they point at
Every finding's dollar figure was its token estimate times one blended
rate: 70% of the period's spend over all input-side tokens. That rate is
close to a cache-read price, so it misprices anything that is not a cache
read. Schema findings already weight cache reads at 0.1, so their reads
were discounted twice; findings whose tokens include output were priced
as input.
A finding can now carry savingsUSD, computed from the calls it names.
Every surface reads it through findingUSD: the CLI and TUI optimize
views, the JSON report (and so the desktop Optimize page), the menubar
payload and MCP get_savings, and the --apply list. classTotals sums it,
scaled to the apply-able share for fix findings. Findings without it keep
tokensSaved times the blended rate, and any token whose session or model
has no price still falls back to that rate.
Measured now:
- low-worth-sessions: each session's real cost times its recovery fraction
- retry-heavy-capabilities: the retry turns' real cost times the fraction
- redundant-rereads, build-folder-reads: the reads at the input rate of
their session's most-called model
- warmup-heavy: the excess cache writes at the session model's write rate
- mcp-low-coverage, mcp-project-scope: each call's charged schema tokens
at that call model's cache-write or cache-read rate
- unused-mcp, mcp-deferral-off, mcp-alwaysload-hygiene,
mcp-defer-threshold: the per-session schema at the input rate of the
sessions charged
Still on the blended rate, because no calls can be named: read-edit-ratio
(reads that never happened), context-heavy-sessions, cost-outliers,
low-cache-hit-sessions, claude-md-too-long, bash-output-cap,
recurring-context and the unused agents, skills and commands.
* feat(optimize): flag one-hour cache writes the next request never needed
A one-hour prompt-cache write is billed at 1.6 times the five-minute
rate and only earns that back when the same model's cache is next used
after a pause of more than five minutes but less than an hour. Reads
refresh either TTL, so a write is judged by the first such pause after
it, not just by the very next call.
The new one-hour-cache-unused nudge walks each session per model in
time order, prices the 60% premium on every one-hour write that never
reached such a pause from the call's own model and tier, and fires at
one dollar or more. Unpriced models and five-minute writes add nothing.
* test(optimize): pin one-hour writes that later hits kept warm
Every cache hit refreshes the TTL, so a one-hour write followed by more
than an hour of steady activity and then a twenty-minute pause still
needed the hour. The detector already judges the length of the first
pause over five minutes, not its distance from the write; this test
pins that. A pause that itself runs past the hour still counts as
wasted, because the one-hour entry expires inside it either way.
Also lists one-hour-cache-unused among the measured findings.
The sessions table, the interactive sessions view, the JSON rows and the
desktop Sessions page now show a cache hit rate per session. It is cache
reads divided by input plus cache reads plus cache writes, the share of the
prompt that came from cache. A session with no cache reads or writes is
unmeasured and shows a dash instead of 0%.
The session drawer, the compare views, the menubar payload and the JSON
report now use the same formula through one helper, so every surface
reports the same number. Optimize already used it, so its finding does not
move.
* fix(optimize): price findings from the calls they point at
Every finding's dollar figure was its token estimate times one blended
rate: 70% of the period's spend over all input-side tokens. That rate is
close to a cache-read price, so it misprices anything that is not a cache
read. Schema findings already weight cache reads at 0.1, so their reads
were discounted twice; findings whose tokens include output were priced
as input.
A finding can now carry savingsUSD, computed from the calls it names.
Every surface reads it through findingUSD: the CLI and TUI optimize
views, the JSON report (and so the desktop Optimize page), the menubar
payload and MCP get_savings, and the --apply list. classTotals sums it,
scaled to the apply-able share for fix findings. Findings without it keep
tokensSaved times the blended rate, and any token whose session or model
has no price still falls back to that rate.
Measured now:
- low-worth-sessions: each session's real cost times its recovery fraction
- retry-heavy-capabilities: the retry turns' real cost times the fraction
- redundant-rereads, build-folder-reads: the reads at the input rate of
their session's most-called model
- warmup-heavy: the excess cache writes at the session model's write rate
- mcp-low-coverage, mcp-project-scope: each call's charged schema tokens
at that call model's cache-write or cache-read rate
- unused-mcp, mcp-deferral-off, mcp-alwaysload-hygiene,
mcp-defer-threshold: the per-session schema at the input rate of the
sessions charged
Still on the blended rate, because no calls can be named: read-edit-ratio
(reads that never happened), context-heavy-sessions, cost-outliers,
low-cache-hit-sessions, claude-md-too-long, bash-output-cap,
recurring-context and the unused agents, skills and commands.
* fix(act): price realized savings at the session's own rates
Findings now carry dollars priced from the calls they point at, but act
report still priced the re-measured tokens of an applied fix with the
blended input rate. That rate sits near a cache-read price, so a fix
advertised in optimize came back as roughly a tenth of that in act report
and in the desktop "Saved by applied fixes" line.
Each measured row now carries realizedCostUSD, priced per post-apply
session at that session's most-called model rate through the same
findingPricing helpers the findings use. MCP removals, project scoping
and deferral price the schema tokens once per session that benefited, at
the cache-write rate. Archived skills, agents and commands price their
definition tokens the same way. CLAUDE.md read rules price the credited
reads at the input rate, split across sessions by their edits. Sessions
whose model has no price keep the blended rate. The total, the JSON
totals.realizedCostUSD and the optimize header sum these row figures.
Token figures are unchanged, and nothing stored in the journal changes.
Worked example: an MCP removal drops 8,000 schema tokens from each of
1,280 post-apply Opus 4.6 sessions, 10.24M tokens. Optimize advertised it
at about $64, the same writes at Opus's $6.25 per million cache-write
rate. Before this change act report priced the 10.24M tokens at a blended
$0.60 per million and showed about $6.14 realized. Now it shows $64.00.
* fix(act): price realized savings the way the finding priced them
The first pass priced every realized schema or definition token at the
cache-write rate and every credited read at the input rate, whatever the
finding had advertised. That left advertised and realized on different
footings: unused-mcp and the deferral findings price schema at the input
rate, and the archive and read-edit-ratio findings still use the blended
rate, so their realized figure could read several times their estimate.
FINDING_TOKEN_KIND in optimize.ts now maps each measured finding to the
token kind it prices: cache-write for mcp-low-coverage and
mcp-project-scope, input for unused-mcp, mcp-deferral-off,
mcp-alwaysload-hygiene, mcp-defer-threshold, redundant-rereads and
build-folder-reads. act report prices a fix's realized tokens at that kind
for each benefiting session, and keeps the blended rate for any finding
not in the table and for unpriced models. A detector that moves to
measured pricing adds one line to the table.
Worked example on 1,280 post-apply Opus 4.6 sessions, 8,000 schema tokens
each, 10.24M tokens, blended rate $0.60 per million:
- mcp-low-coverage removal: advertised about $64 at the $6.25 cache-write
rate; realized $6.14 on the blended rate before, $64.00 now.
- unused-mcp removal: advertised about $51 at the $5 input rate; realized
$6.14 before, $64.00 after the first pass, $51.20 now.
- archived skills: advertised and realized both stay on the blended rate,
$6.14.
* fix(act): store the baseline at the finding's own per-tool token figure
Since the deferred-tool fix, mcp-low-coverage charges each unused tool as
one deferred name line of about 9 tokens, once per call: as a cache read
when the call read cache, as a cache write otherwise, weighted into
effective input tokens. The act baseline for that apply still stored 400
tokens per unused tool once per session, so realized tokens and the
at-apply estimate measured different things and realized ran far above
the estimate.
captureBaseline now stores, per server, the effective schema tokens the
finding's own attribution charges over the baseline window divided by the
sessions that loaded the server. mcpLowCoverageSchemaPerSession runs the
same per-call pass the finding runs, so there is no second constant.
Because the stored figure is now effective input tokens (writes x1.25,
reads x0.1), mcp-low-coverage realized dollars use the input rate, which
for Claude models equals the finding's per-call cache-write and
cache-read prices.
Example: 20 unused deferred tools, one cache write and one cache read per
session. The baseline was 8,000 tokens per session (20 x 400); it is now
243 (180 name-line tokens x1.25 + 180 x0.1), and 243 times the sessions
equals the finding's tokensSaved.
Applies recorded before this change keep their stored 400-per-tool
baseline; there is no migration. Their realized dollars now use the input
rate rather than the cache-write rate. Other MCP baselines
(mcp-project-scope, unused-mcp, deferral) are unchanged.
* fix(act): store the project-scope baseline at the finding's figure too
mcp-project-scope has charged each scoped server's tools as deferred name
lines of about 9 tokens, once per call, in its cold projects only, since
the deferred-tool fix. Its act baseline still stored 400 tokens per
available tool once per session.
captureBaseline now stores, per scoped server, the effective cold-project
schema tokens the finding's own pass charges, divided by the cold-project
sessions that loaded the server. mcpProjectScopeSchemaPerSession runs that
pass over the finding's removeProjects; it is a separate helper because
the pass differs from mcp-low-coverage's (available tools in cold projects
rather than unused tools everywhere). The stored figure is effective
input tokens, so realized dollars use the input rate, as for
mcp-low-coverage.
Example: 4 tools loaded in two cold projects, one cache write and one
cache read per session. The baseline was 1,600 tokens per session
(4 x 400); it is now 48.6 (36 x1.25 + 36 x0.1), and 48.6 times the cold
sessions equals the finding's tokensSaved.
Applies recorded before this change keep their stored 400-per-tool
baseline; there is no migration.
* fix(optimize): price findings from the calls they point at
Every finding's dollar figure was its token estimate times one blended
rate: 70% of the period's spend over all input-side tokens. That rate is
close to a cache-read price, so it misprices anything that is not a cache
read. Schema findings already weight cache reads at 0.1, so their reads
were discounted twice; findings whose tokens include output were priced
as input.
A finding can now carry savingsUSD, computed from the calls it names.
Every surface reads it through findingUSD: the CLI and TUI optimize
views, the JSON report (and so the desktop Optimize page), the menubar
payload and MCP get_savings, and the --apply list. classTotals sums it,
scaled to the apply-able share for fix findings. Findings without it keep
tokensSaved times the blended rate, and any token whose session or model
has no price still falls back to that rate.
Measured now:
- low-worth-sessions: each session's real cost times its recovery fraction
- retry-heavy-capabilities: the retry turns' real cost times the fraction
- redundant-rereads, build-folder-reads: the reads at the input rate of
their session's most-called model
- warmup-heavy: the excess cache writes at the session model's write rate
- mcp-low-coverage, mcp-project-scope: each call's charged schema tokens
at that call model's cache-write or cache-read rate
- unused-mcp, mcp-deferral-off, mcp-alwaysload-hygiene,
mcp-defer-threshold: the per-session schema at the input rate of the
sessions charged
Still on the blended rate, because no calls can be named: read-edit-ratio
(reads that never happened), context-heavy-sessions, cost-outliers,
low-cache-hit-sessions, claude-md-too-long, bash-output-cap,
recurring-context and the unused agents, skills and commands.
* feat(optimize): report fast-mode spend on background agents and long-context premiums
Two findings for premium-tier spend the parser already prices, so their
dollars come from the calls themselves.
fast-mode-background (nudge) sums, over fast-mode calls inside subagent
sessions, the call's cost minus the same tokens at standard speed. It
fires at $1 or more in the window. Some background runs need the speed,
so it stays a habit check.
long-context-premium (keep) sums, over calls whose prompt crossed the
model's long-context tier, the tiered cost minus the same tokens at base
rates. Fast calls are priced at standard on both sides so the fast
premium is never counted twice. tokensSaved is the prompt tokens above
the threshold; the fix names each model's threshold from its tier. It
fires at $1 or more and has no apply action.
Both rate high above $20, medium above $5, else low.
* fix(claude): estimate the output of subagent messages that never got a final usage row
Claude Code before 2.1.307 wrote subagent (sidechain) assistant messages
without their final usage. Every row of such a message id keeps the
output_tokens of the first streamed chunk (usually 1 to 100) and a null
stop_reason, so the output was priced at that placeholder. Input and cache
tokens on those rows are correct. 2.1.307 fixed the writer.
For a sidechain row from a version below 2.1.307 with no stop_reason, the
parser now estimates the output from the message content (text plus
serialized tool_use input, 4 chars per token, summed over every row of the
id) and uses it when it exceeds the recorded count, flagging the call as
estimated. Rows with a stop_reason, main-thread rows and rows from 2.1.307
on are untouched. Large lines get the same estimate from the byte scanner.
The claude parse version gains sidechain-output-estimate-v1 so cached
sessions re-parse.
Measured on one machine with 327,711 Claude calls: 209,889 calls from
2.1.272 to 2.1.304 are re-estimated, output rises from 89.5M to 132.0M
tokens and cost from $22,947 to $23,687 (+$740). Call counts, input and
cache tokens do not change. On finished subagent messages from 2.1.307 on,
the same estimate recovers 24 to 48 percent of the real output, since
thinking is not visible in the content, so this is a lower bound.
* fix(daily-cache): bump to 78 so settled days carry the estimated subagent output
* feat(guard): warn and stop identical-call loops and failing-command retries
The PreToolUse hook now watches two more signals next to the dollar caps.
The same tool called with the same input (hashed as JSON with sorted keys)
4 times in a row gets a one-time warning and the 8th call is denied. A shell
command (Bash or PowerShell) that already failed 3 times in the session gets
a one-time warning and is denied once it has failed 5 times; successful runs
do not reset the count. Both pairs are guard.json settings (loopWarnAfter,
loopStopAfter, retryWarnAfter, retryStopAfter), validated like the dollar
caps, null turns one off, and guard status prints them.
The incoming call is read from the hook payload and recorded by tool_use_id,
since the transcript can lag. The session cache (version 4) keeps a rolling
window of the last 16 calls, pending shell calls and failure counts per
command, folded from the same incremental tail read as the cost. When a loop
or retry warning fired, the Stop note adds one line with the count and what
the calls after the first warning cost.
On a generated 20 MB transcript the warm hook takes about 13 ms (median of 5);
the first cold read of the whole file takes about 480 ms, as before.
* fix(guard): let allow lift loop blocks and tell the agent at the warning
codeburn guard allow now lifts the loop and retry stops as well as the hard
cap, for that session only, so polling a CI job on purpose has the same way
out. The deny reasons name it.
Loop and retry warnings now also reach the agent through PreToolUse
additionalContext, with the same sentence plus "Change approach or ask the
user." It is sent without a permissionDecision, since "allow" would also
skip the user's permission prompt. The docs now say the loop count tops out
at 17 (16 earlier calls plus the incoming one).
* chore: drop the no-zstd fallbacks the 22.15 floor made unreachable
The dsh, zed and openclaw providers still guarded against a Node whose
node:zlib has no zstd. The floor is 22.15 now, so they call
zlib.zstdDecompressSync directly like the shared helpers do. The tests that
exercised the missing-zstd path and the guards that skipped zstd cases on old
Nodes are gone.
* docs: state the 22.15 zstd floor plainly and name the tools degraded mode cannot read
Every finding's dollar figure was its token estimate times one blended
rate: 70% of the period's spend over all input-side tokens. That rate is
close to a cache-read price, so it misprices anything that is not a cache
read. Schema findings already weight cache reads at 0.1, so their reads
were discounted twice; findings whose tokens include output were priced
as input.
A finding can now carry savingsUSD, computed from the calls it names.
Every surface reads it through findingUSD: the CLI and TUI optimize
views, the JSON report (and so the desktop Optimize page), the menubar
payload and MCP get_savings, and the --apply list. classTotals sums it,
scaled to the apply-able share for fix findings. Findings without it keep
tokensSaved times the blended rate, and any token whose session or model
has no price still falls back to that rate.
Measured now:
- low-worth-sessions: each session's real cost times its recovery fraction
- retry-heavy-capabilities: the retry turns' real cost times the fraction
- redundant-rereads, build-folder-reads: the reads at the input rate of
their session's most-called model
- warmup-heavy: the excess cache writes at the session model's write rate
- mcp-low-coverage, mcp-project-scope: each call's charged schema tokens
at that call model's cache-write or cache-read rate
- unused-mcp, mcp-deferral-off, mcp-alwaysload-hygiene,
mcp-defer-threshold: the per-session schema at the input rate of the
sessions charged
Still on the blended rate, because no calls can be named: read-edit-ratio
(reads that never happened), context-heavy-sessions, cost-outliers,
low-cache-hit-sessions, claude-md-too-long, bash-output-cap,
recurring-context and the unused agents, skills and commands.
* fix(quota): label every Claude Max multiplier and the Ultra tier
The plan label only knew max_5x and max_20x, so any other Max multiplier showed as Max 5x and an Ultra tier showed as Subscription. The multiplier is now parsed from the tier id, a tier containing ultra is labelled Ultra, and an unknown tier falls back to its readable text. Applied to the CLI quota code, the desktop app copy, the Windows tray and the macOS menubar.
* fix(quota): keep a bare Max subscription labelled Max
A Max subscription whose tier carries no multiplier fell through to the readable fallback or Subscription. It now labels Max in all four copies.
* fix(antigravity): attribute CLI .db sessions to workspace projectPath (#1840)
* fix(antigravity): populate workingDirectory for sync --attribution (#1840)
* fix(antigravity): keep the RPC cache generation and the project-only scope
The CACHE_VERSION bump is dropped because applyAntigravityProject re-runs on every cache read, so cached cascades pick up the new project without discarding the durable RPC-only cache. The workingDirectory lines are dropped because they changed Desktop and IDE sessions outside #1840, and the fallback delete of projectPath was a no-op since only this function ever sets it.
* test(antigravity): build the workspace file URL for the running platform
---------
Co-authored-by: Resham Joshi <65915470+iamtoruk@users.noreply.github.com>
* fix(hermes): count helper-model usage recorded in session_model_usage
Hermes records auxiliary calls (compression, title generation, vision and
other helper tasks) only in session_model_usage, under the helper model and
a task name, and never adds them to the sessions totals the provider reads.
Those tokens and dollars were missing. Each helper row now becomes a call on
its own session, priced through the same cost path with the helper model id,
tracked by the session ledger so later growth lands as a delta, and marked as
supplementary accounting so it adds no requests or turns. Rows with an empty
task are the main loop and voice_chat is already in the sessions totals, so
both are skipped.
Measured on this machine's Hermes state.db: 12 sessions, 12 calls, $2.0834
before and after. Its 12 session_model_usage rows are all main-loop rows that
equal the sessions totals, so nothing changes there. On a copy of that DB with
a compression row and a title row added (plus a voice_chat row that must stay
out): before 12 calls, $2.0834; after 14 calls, $2.1660, helper share $0.0826.
Growing the compression row by 10,000 input tokens added one $0.0100 delta.
* fix(hermes): keep a recorded zero helper cost
session_model_usage stores actual_cost_usd as NOT NULL DEFAULT 0, while the
sessions column is nullable, so a 0 on a helper row usually means nothing
was recorded. When the row's cost_status says the amount is actual, that 0
is a recorded free line and now stays $0 (metered) like a sessions row,
instead of being re-priced from tokens.
* fix(claude): read thinking tokens into the reasoning breakdown
Claude rows carry output_tokens_details.thinking_tokens, but reasoningTokens was always 0. Read it so the token breakdown shows thinking. Claude is in REASONING_INCLUDED_IN_OUTPUT, so billed output and cost are unchanged. Bumps the Claude parse version so cached calls re-parse.
* docs: note the thinking-tokens parse suffix
* chore: raise the Node floor to 22.15 and make zstd unconditional
Node's built-in zstd in node:zlib arrived in 22.15. With the floor at 22.13
every reader of Codex's compressed .jsonl.zst rollouts had to check for it,
and the daily cache kept a separate generation for Nodes without it so a later
Node upgrade would still re-derive their days. That split could not survive
another cache bump.
The engines field, the launcher's version check, .nvmrc, the README and the
CI pins now say 22.15. The VS Code extension applies the same floor when it
picks a Node to run the CLI, and its runtime notice names it.
Removed: the optional zstd exports, zstdSupported and requireZstd in
fs-utils, the skipped-compressed-rollouts notice in launcher-homes, and the
76/77 split in the daily cache, which is now 77 for every Node.
* docs: say 22.15 wherever the Node floor is stated
MCP_CLI_CALL matched `mcp-cli ... call <server> <tool>` anywhere in a shell
command's text. A command that only mentions the phrase became an MCP tool
call, and `codeburn sync` sent the name upstream: `git commit -m "mcp-cli
call orion-merger initech-term-sheet"` produced the tool
`mcp__orion-merger__initech-term-sheet` on the wire. The same happened for
an echo, a shell comment or a quoted mention inside a longer command.
The matcher now requires mcp-cli to be the command being run, the first word
of a command segment: the start of the text, after a shell separator, `(`,
`$(` or a backtick, after a `-c`/`-lc` shell flag, or after the exec custom
tool's `cmd:`, optionally behind a directory prefix such as `./`. The server
and tool must be identifier-shaped tokens with balanced quotes, so free text
with spaces no longer yields a name. Option skipping and the `foo-mcp-cli`
lookbehind are unchanged, and every existing invocation shape still matches.
Bumps CODEX_CACHE_VERSION to 24 and PROVIDER_PARSE_VERSIONS.codex
(mcp-cli-command-v1) so cached sessions that already hold fake names are
re-parsed instead of re-sent.
The IDE modern-execution parser ran the `<tool_use><name>X</name>` markup
scan over the text of every message and over the top-level response field.
Message text includes tool OUTPUT (file contents, command output) on `tool`
messages, plus model prose. So any content containing that markup became a
tool call, and `codeburn sync` sent the name upstream: a file holding
`<tool_use><name>orion_merger_initech</name>` produced the tool
`orion_merger_initech` on the wire. sanitizeToolIdentifiers cannot catch
this, because the injected name is shaped like a valid identifier.
Real execution files never need the scan. They record tool calls as
structured data (toolUse entries, toolCalls, usageSummary[].usedTools), and
none of 319 local execution files contain the markup, so the scan only ever
produced false names. Tool names in this path now come from structured fields
only.
The legacy `.chat` format has no structured tool record, so parseChatFile
keeps its bot-message-only markup scan; a test pins that as unchanged.
Bumps PROVIDER_PARSE_VERSIONS.kiro (no-text-tools-v1) so cached entries that
already hold injected names are re-parsed instead of re-sent.
Two existing tests asserted tools derived from markup in modern-file text;
they now assert the structured toolCalls entry instead.
AI-Origin: human
Co-authored-by: Andrew Lee <andklee@amazon.com>
* fix(copilot): stop billing cached tokens twice on OTel spans
VS Code Copilot Chat writes gen_ai.usage.input_tokens on agent-traces.db
spans as the full prompt, cache reads and writes included. The OTel parser
passed it to calculateCost as uncached input, so every cached token was
billed at the input rate on top of its cache rate. The parser now subtracts
the cache counts the way the chatSessions path does, and keeps an input
below them as written.
Bumps the copilot parse version so cached OTel calls re-parse. Calls whose
spans the extension already pruned keep the old input.
* test(upgrade-path): expect the copilot OTel cache subtraction across the bump
The parse-version bump re-parses the surviving agent-traces.db spans with
the cache counts taken out of input, so input and cost drop by design while
the pruned calls keep the 0.9.20 figure. Calls, output and cache reads stay
exact; input must drop by exactly the cache counts of the surviving
cache-inclusive spans, and cost must drop.
Claude Code keeps the login of any config dir but ~/.claude in its own
Keychain item, "Claude Code-credentials-" plus the first 8 hex chars of
the SHA-256 of the dir's NFC path, next to that dir's .credentials.json.
The quota reader only knew the unsuffixed item and ~/.claude, so on macOS
a profile's login read as not connected.
The claude row now reads the first configured dir (CLAUDE_CONFIG_DIRS,
CLAUDE_CONFIG_DIR or claudeConfigDirs), and with --claude-profiles the
profile that reuses the claude row is that dir's, not ~/.claude's. Every
profile can fall back to its own Keychain item. ~/.claude keeps the
unsuffixed item. An expired credential file no longer hides a live
Keychain login; with no Keychain item the expired file is still what
gets reported.
Keychain reads still happen only on a user-run codeburn quota.
codeburn web only answers to loopback Host and Origin values, which makes it unreachable behind a reverse proxy even when that proxy authenticates (oauth2-proxy, Authelia, Traefik with Keycloak). A repeatable --allowed-host flag adds exact hostnames to the guard, matched case-insensitively and without the port, against both Host and Origin. Without the flag nothing changes.
The guard lives in two exported helpers, isAllowedHost and isAllowedOrigin, with unit tests for the loopback default, exact matching (dash.example.org.evil.example and evil-dash.example.org are refused), Origin limited to http and https, and null refused, plus server tests for a proxied Host and allowed and refused Origins. docs/web.md gains a section on running behind a reverse proxy.
The --host flag from the original proposal is dropped. The dashboard has no authentication, so a non-loopback bind would give any LAN client that sends Host: localhost every route, the share and pairing POSTs included. The bind stays on 127.0.0.1; a proxy on the same machine forwards to it and its Host and Origin pass the guard. Access control is the proxy's job and the docs say so.
Authored by @MarcelRoozekrans. Reviewed and tested locally against real data; the maintainer commit on top removes --host.
Codex writes native web_search_call, tool_search_call and image_generation_call items, and newer builds record a completed WebSearch item as type Extension with kind web.search. None of these counted as tool activity, so Codex sessions showed shell calls but no searches. They are now attributed as WebSearch, ToolSearch and ImageGeneration, with stable item identities deduplicated across status updates, mirrors, append checkpoints and fork replay, so a fork keeps its own new activity and never double counts the parent's.
Three maintainer commits sit on top. Codex builds of May 2026 write every search twice in a row, an item_completed WebSearch with its id and then a web_search_call with no id, so an id-less web_search_call directly after a WebSearch item is treated as that item. The depth-1 payload type scan now runs only for lines whose first payload type names a native tool or item_completed, which keeps the cold parse of compacted history from slowing by a fifth. The daily cache version is left alone: native tool items change which activity a turn lands in, never its calls, tokens or cost, and the Codex results file version already re-parses every session once; settled days pick up the new split at the next DAILY_CACHE_VERSION bump, which is reserved for the Node 22.15 floor.
Verified on a real session: usage, tokens and cost identical before and after, one WebSearch where there was none.
Authored by @uttamdeb.
Antigravity calls carried no user message, so every turn classified as
conversation. The provider now reads the cascade's first USER_INPUT from
the brain transcript (first 50 lines, <USER_REQUEST> unwrapped, cut to
500 chars), with the SQLite steps row as the fallback for .db sources,
and sets it as userMessage on every call of the cascade, the way the
cline-cli, goose, codewhale and mistral-vibe providers already do.
Calls, tokens and cost do not change. The activity split does: on real
data the last 30 days go from 128 conversation turns to 2, with 126 now
exploration. ANTIGRAVITY_CACHE_VERSION moves 9 to 10 and the antigravity
parse tag gets user-msg-v1, so only Antigravity re-parses once. Session
titles and optimize are unchanged. Follow-up prompts in a cascade are not
read yet; the first prompt stands for the whole cascade.
Closes#1792
Claude Code on Windows runs shell commands through a tool named PowerShell,
with the same { command } input as Bash. The shell-tool sets only knew Bash,
BashTool and PowerShellTool, and PowerShellTool never appears in a transcript:
the Claude Code binary names the tool PowerShell. compactEntry dropped the
command, so it never reached the shell breakdown, command-only turns fell
through to coding or conversation, and optimize missed read-shaped commands.
The claude parse tag gets powershell-shell-tool-v1 so cached sessions re-parse
once, as in #1791. DAILY_CACHE_VERSION is unchanged, so settled days keep
their old split until the next bump. Calls, tokens and cost do not change:
identical on a full real day, main vs branch.
Cursor 3.27 can store its app session as cursor-safe-storage:v1 ciphertext
(Chromium v10, key in the "Cursor Safe Storage" keychain item), behind
Cursor's own cursor.storage.authTokenEncryptionAtRest flag. CodeBurn read it
as an expired login. The CLI and the menu bar now unlock it with that item
and run the usual JWT checks; the newline `security -w` appends is trimmed
before the KDF.
Keychain consent is user-initiated, as for Claude: the first read happens on
`codeburn import cursor --sync`, `codeburn quota`, or Retry/Reconnect on the
menu bar's Cursor quota. Background syncs and dock refreshes read only after
one such read succeeded, reuse the opened token per blob, and the first
refused read switches that off again. Status never reads the keychain. No
service-only keychain lookup, since after a Deny it asks again.
Windows and Linux say CodeBurn cannot unlock the session there yet; the
desktop app, VS Code and the Windows tray show the new `locked` line in all
locales. Docs describe the prompt and what Always Allow grants.
Closes#1801
A provider-filtered dashboard painted the right total, then changed it
when the background index finished. Dates the shared daily cache did not
hold were dropped, so Copilot fell to $0 in #1769, and a cached day
with the same call count as the live parse kept its cached numbers, so
a cache derived under older accounting still moved the headline after
refresh. Report and the first paint did neither.
The provider-scoped index now overlays its normalized days the way
buildDurablePeriod does for report: they fill the dates and slices the
cache lacks and replace a cached slice unless a settled cached day
explains more calls, so expired history is kept and nothing is counted
twice. Against real Copilot history and a complete cache that predates
it, main refreshed 30 days from $0.355 to $0.00; it now stays at $0.355.
The all-provider path is unchanged, and a provider view still never
writes the shared cache. report, models and the first paint do not
change.
Fixes#1769
Claude Code writes one JSONL line per content block, so a message that
calls several tools in parallel spans several lines with the same message
id. dedupeStreamingMessageIds kept only the last line, which has the right
usage but only the last tool_use, so the earlier calls were missing from
the tool, MCP and shell breakdowns, turn classification, edit line counts,
tool errors and PR link evidence. On a real 7-day sample main counted
59,765 tool calls where the transcripts hold 69,376.
The last line is still the one kept. The tool_use blocks of the earlier
lines with the same id are put back in front of its content, matched by
block id, so the older shape whose final write restates every block (#110)
is not counted twice. The claude parse tag gets streamed-tool-blocks-v1,
so cached sessions re-parse once.
Calls, tokens and cost do not change; activity turns, edit and one-shot
counts and the by-PR split do. DAILY_CACHE_VERSION is not bumped (v77 is
the last bump the zstd split can carry), so days the daily cache has
already settled keep their old activity split until the next bump
re-derives them.
Today's day row comes from the live parse with session identities, but
the session-count provenance treated it like a cache row, so a Today-only
period reported its exact count as partial on the headline, the provider
rows and the project rows. Today is now left out of the cache-provenance
days at every call site (money still uses the complete day set) and the
status snapshot render version moves to 13 so stale labels are rejected.
The Overview hero count-up wrote textContent into a div whose children
React owns; when the ~ estimate marker appeared, React hit a detached text
node (insertBefore NotFoundError) and the error boundary took over. GSAP
now writes only into an empty span and React keeps the marker; a currency
change with the same raw value refreshes the text.
Fixes#1760Fixes#1785
Warp 0.2026.10 removed total_provider_cost_in_cents and now persists
total_billed_cost_in_cents. Read it after total_charged_usage, as Warp
does, so conversations without streamed charges keep their billed dollars
instead of the credits estimate. Bump the warp parse version and
DAILY_CACHE_VERSION to 77 (76 on a Node without zstd, so it re-derives
too and a zstd Node still adopts its file).
A slice with tokens but no calls, cost or savings (a Hermes or Copilot
session total) read as a placeholder, so every adoption or re-derive merge
replaced it while adding its tokens to the day and model rows again. Each
version bump multiplied them by the number of older cache files holding
the day. Count tokens as slice data, and cap day and model-row tokens at
the slices' sum on load for days whose calls and cost match their
slices, this bug's fingerprint, so caches already inflated heal without
a version bump.
A newer token-only slice now wins over an older one with calls, as the
newer-wins rule intends, instead of the two being added.
Codex now moves cold rollouts to rollout-*.jsonl.zst. Discovery, the
first-line probe, the parser, fork parent lookup, codex-tps and the context
view read them through a zstd decode; a session present in both forms
counts once from the plain file. Compressed files are parsed whole and never
resumed by byte offset. Without node:zlib zstd (Node < 22.15) they are
skipped with one notice. DAILY_CACHE_VERSION 76 so settled days pick up the
recovered Codex usage. Without zstd it stays 75, so a later Node upgrade
still adopts that cache and re-derives it.
Writing a new file has nothing to read first, so teams whose subagents
write report and evidence files got a false 'edits more than it reads'
finding. The detector now counts only Edit-type calls. EDIT_TOOL_NAMES
stays as is because act report baselines were recorded with it.
* Copilot: count every agent round and exact credits in VS Code chat sessions
Copilot Chat 0.69 keeps only the last model call of an agent request in result.metadata. Read the request's modelTotals (input, cache reads, output over every call) first, then root completionTokens, then metadata. Carry copilotCredits as nanoAiu so plan credits are exact. Bump the copilot parse tag so cached chat sessions re-parse.
modelKeyMatches no longer lets claude-sonnet-4 capture claude-sonnet-4-6.
* Copilot: bill chat-session credits exactly and skip agent-host twins
A chat-session request that records copilotCredits now costs credits x $0.01 through costFromBilling; requests without it stay priced from tokens. A chat session whose id matches a session-state dir is left to the agent-host path so it is counted once.
* Copilot: drop agent-host twins at serve time, rate chat requests one by one, re-derive past days
A chat-session journal request is left out when the same session has billed agent-host usage (session-state calls with tokens or nanoAiu, or session-store rows). Plan credits rate chat-session requests individually, so older requests in a mixed session keep their estimate. DAILY_CACHE_VERSION 75 with copilot pending re-derive so settled days pick up the new counts.
Electron's Node 24 undici asserts and kills the process when a server closes the socket while a piped download is paused on the file write. The menu bar zip is now read whole and written once.
Adds codeburn update [--check] [--cli|--menubar|--desktop|--all] [--local] [--json] with a fixed JSON step/result contract that the desktop app, menu bar and Windows tray call, so every surface updates in one click without Terminal. Also documents the npm-first release order and adds always-latest /download links.
* fix(pr): push evidence beats the carried pr-link, show every PR fact
Claude Code's pr-link tags a session with its latest PR and CodeBurn carried
that tag to every later turn and subagent run. A run or turn that pushes the
head branch of a PR opened in the same data (paired gh pr create --head) now
goes to that PR, same repo only; spend left only on the tag is carriedUSD.
Rows also get runList (why each run counts), a locally evidenced state and
follow-up round times, and a call opening several PRs pairs its pr-link with
the last create. The PR card states every unknown and the expanded view shows
timeline, runs, cost by phase and work as compact tables.
* fix(app): full text on hover for cropped PR cells, plainer wording for same-session spend
Truncated PR labels, run descriptions, table labels and summary figures now show their full text in the shared tooltip surface while cut off. The carried-from-session-tag wording becomes 'from other work in the same session' in all six locales.
* fix(pr): explain carried spend without the pr-link jargon
* fix(clinepass): say when the Cline login expired and how to renew it
An expired saved Cline login only said "Run cline to refresh it". It now
reads "Cline login expired 3h ago" (age from the saved expiry, when known)
and asks to send a message in Cline or run `cline auth cline`, then press
Retry. Still a retryable state, so the last quota is kept. CLI and menubar.
* fix(menubar): title an expired Cline login instead of "Retrying"
A provider failure can now carry a short status title. The expired Cline
login sets "Cline login expired", which the settings pane and the dock
caption show in place of the generic retrying text. It stays a retryable
state and keeps the last quota; the title clears with the error.
* fix(clinepass): match the expired-login hint to the visible control
"Then press Retry" only fits where a Retry button shows: the settings pane
with no last quota. Everywhere else, including the CLI, the hint now ends
with "CodeBurn picks up the new login on its next refresh."
Command Code's credits endpoint only reports monthly credits left, so the
monthly window was dropped. For an active subscription on a known plan the
plan price now comes from a small table (the API has no monthly cap field):
pool = max(plan, left), used = pool - left, reset = currentPeriodEnd.
Unknown plans and purchased/free credits stay out. CLI and menubar mirrored.
* fix(pr): a subagent whose description names a PR folds into that PR
A subagent run folded into whatever PR its parent's last pr-link carried, so
review runs for #1703, #1712, #1728 and #1729 landed on a stale closed#24.
The Agent description ("Review PR 1729 ...") is now read from the subagent's
.meta.json at report time; a single PR it names outranks the carried PR.
* fix(pr): date each PR by its own turns and count its agent runs
Every PR row carried the whole session's first and last timestamp, so one
long orchestrator session stamped the same span and "1 session" on all of
them. Rows now span their first to last attributed turn or folded run, and
a new `runs` field counts contributing sessions plus folded subagent runs.
* feat(pr): local one-shot, follow-up rounds, review runs, merge time and cost split per PR
Each PR row now carries signals read from cached commands, no GitHub calls:
openedAt (gh pr create paired with the PR's first pr-link), follow-up rounds
(pushes naming its --head branch, or from a run whose description names it,
in 10-minute bursts), oneShot only when the open and its branch were seen,
reviewRuns and reviewCostUSD, mergedAt and timeToMergeMs, a build/review/fixes
cost split that sums to the row, and linkEvidence to flag pr-link-only rows.
* feat(session-why): PRs the session opened, their follow-up rounds and review runs
The why view now carries prWork: each gh pr create whose output printed a PR
URL, the pushes after it on its --head branch (or from a helper whose
description names that PR) in 10-minute rounds, and the helpers that read a
PR without committing or pushing, with their cost.
* perf(pr): only parse commands that can name a push or a PR
* feat(app): local PR facts on PR cards and PR work in the session view
Each PR card gets one line of facts from the CLI's local signals: the review
run and its cost, one shot or follow-up rounds, and merge time after open.
Unknowns are left out; a pr-link-only row says so. The count shows agent runs
instead of sessions. The expanded card splits spend into building, review runs
and after first review, and lists the review runs. The session view lists the
PRs it opened and the review runs it spawned.
* perf(pr): read subagent descriptions only for PR attribution
Every report, status and menubar refresh read each subagent's .meta.json
(about 2,000 files in 30 days) and the cross-provider correlation scanned
every folded run's commands for PR signals it never uses. Sessions now carry
the sidecar path; the description is read on demand, memoized by mtime, only
for folded runs and runs that push, and correlation skips the command scan.
The by-pr footer now counts runs to match the Runs column.
When an Antigravity response left out the model, the parser crashed on the legacy .pb path and the whole session was skipped. It now falls back to the chat's own model and passes it through the live model map.
Maps the Gemini 3.8 Flash placeholders M318/M319/M320 to the high/medium/low ids from Antigravity's model catalog, and the gemini-3-flash-a/-d family strings to gemini-3-flash-preview (LiteLLM prices, nothing hardcoded). Parse version, results cache v9 and daily cache v74 bumped so cached rows re-parse; calls and cost only rise.
Thanks @dcaldr.
* perf(cursor): stop JSON and menubar answers waiting on cursor.com
report/today/month --format json, overview and status --format menubar-json
awaited the hourly Cursor usage download (15 s cap, 45 s on the first
backfill) before parsing. The download now runs beside the command and its
import applies after the command (serve: between two requests, then its
memos are dropped), so the next run shows it. Dashboards still wait.
* test(cursor-sync): keep the in-process sync enabled when the shell disables it
* test(cursor-sync): wait for the serve memo instead of a fixed answer count
The serve test expected the second answer to be memoized, but serve only
memoizes once its root watchers are armed, which on a slow CI runner lands
after that answer. Keep asking until two answers share a generation. The
spawn now imports the fake fetch by file URL so Windows accepts the path,
and the in-process test points USERPROFILE at the temp home too.
Warm reports re-derived the display name of every cached call, a linear
scan of the short-name table each time (about 0.5 s on a lifetime run).
The name depends only on the aliases and the pricing namespaces, so it is
memoized per model id and cleared when either changes.
The sessions.db query returned each message's whole metadata blob and
parsed it in JS (617 MB on a real store) to use five fields. The query now
builds an object of just those fields; a missing or non-object metadata
still comes back NULL.
The fork-parent memo lived in module state, so every parse worker indexed
the Codex home and read the same parent rollouts again (58 reads of 10
parents, 8 GB for 1.28 GB on a real corpus). Workers now ask the main
thread over a message port, which keeps one memo for the whole parse.
The low-coverage and project-scope findings only see servers whose tools were
deferred, yet charged 400 tokens per tool and counted every call as both a
cache write and a cache read. A deferred tool is one name line (~9 tokens),
and each call now pays it as a read, or as a write only when it read no cache.
The delivered check read bashBreakdown keys, which are base names (git), so
git commit / gh pr create never matched; it now reads the full command from
each call's tool sequence (Kimi Code now records one) and allows git global
options. Devin and cursor-agent edit tools count as edits, and the retry
share divides by edit steps instead of user prompts.
* fix(cursor-agent): leave Cursor IDE chat transcripts to the cursor provider
Cursor IDE agent chats write agent transcripts too, so on days without a
Cursor import they were counted by both cursor (state.vscdb) and
cursor-agent. Discovery now skips a transcript or store whose id is an IDE
composerData key; cursor keeps them with per-bubble times and models.
Daily cache v73 lets cursor-agent days shrink once.
* fix(cache): drop old cursor-agent slices the IDE parse now explains
On an existing cache, settled days kept their old cursor-agent slice after
v73 because the fresh parse no longer has one there and the merge carries
missing slices forward. While cursor-agent is pending its v73 re-derive, a
day the fresh parse explains with a cursor slice and no cursor-agent slice
drops the old cursor-agent slice; days with no fresh cursor slice keep it.
The session cache keys the Cursor parse on the DB fingerprint alone, but the
parse stopped at the requested range start, so a narrow run (7 days) was served
to every wider range afterwards (30 days showed 2 calls instead of 1,680). The
parse now always reads the full 6 month lookback; the cursor parse version is
bumped so cached narrow entries re-parse.