Skip to content

AgentMenu 1.3.0

Choose a tag to compare

@nisarganag nisarganag released this 25 Aug 14:13
· 5 commits to main since this release

A correctness fix that changes every dollar figure the app has ever shown, plus a small addition.

Cost was 2.68× too high

Reported by the owner, who could check the figures against the Claude console.

Claude Code writes one JSONL record per content block of an assistant response — the text on its own line, each tool call on the next — and every one of those records repeats a verbatim copy of the whole response's usage. That usage belongs to the request, not to the record. Folding it per-record multiplied cost by however many blocks the reply happened to contain.

Measured across all 878 transcripts on the owner's machine before anything was changed:

duplicate groups 29,026
copies byte-identical in all four token buckets yes, every one
distinguishing field parentUuid only — same file, same requestId
reported vs real $20,271.36 vs $7,577.09 — 2.68×

Deduplication is keyed on the response id (message.id, falling back to the top-level requestId). Per-file deduplication was verified to capture the entire win — deduping globally across files changes the total by 1.000×, so response ids never recur across transcripts and no cross-file registry is needed.

The window is bounded at 128 rather than an unbounded set, because it is persisted in every checkpoint. That bound is sized off the real distribution: copies of one response are separated by a median of 2 records and at most 29 across every file on disk, the gaps being user-side tool_result records. Erring here is safe in one direction only — too small merely misses a duplicate and over-counts as before, and can never subtract usage that was real.

Deduplication skips the token fold only, never the whole record. The copies are the response's different content blocks, so the second and later ones carry the tool calls; bailing out of the record would have left every multi-block turn showing its opening sentence and never the tool it ran. That was caught during implementation and is covered by a test.

checkpointVersion 1 → 2 — not merely because a field was added, but because every checkpoint written before this holds the inflated totals. Carrying them forward would have meant the fix never reached anyone already running the app. Expect one slower launch as history is re-derived.

Verified against an independent implementation, not just against itself: over the live 7-day window the source produced 5,810,010 work tokens against 5,809,617 computed separately in Python — 393 apart on 5.8M (0.007%), which is the transcript growing between the two runs. The same window read 22,308,145 before the fix.

Codex is not affected — it assigns from the cumulative total_token_usage rather than summing, so repeated records are idempotent there. opencode reports cost natively and never used this path. Both were checked rather than assumed.

Also confirmed while investigating: every usage-bearing record is type assistant (23,975 in the 7-day window, none of any other type) and all four token buckets are always present, so nothing was being silently missed.

Version stamp in the footer

The running version now sits bottom-left of the popover, balancing "Quit" across from it — tertiary grey and monospaced so it reads as a stamp rather than a control, since it sits beside the only button down there.

It deliberately does not append CFBundleVersion. That counter is published nowhere — not in a release tag, not in the DMG name — and since the two use different numbering schemes, a "show it only when it differs" rule would have been true every single time, making it permanent noise on the one line that has to stay glanceable.

Absent rather than a placeholder when the bundle has no version, the same rule the rest of the app follows for anything it cannot establish.

Still known to overstate

Sonnet 5 is priced at list ($3/$15), but its introductory rate ($2/$10) runs until 2026-08-31. On the owner's data that is a further ~5.5% overstatement until then, and exactly right afterwards. Sonnet is the most-used model in that sample, so this is not negligible — it is left at list price so figures do not under-report once the intro lapses.

259 tests pass (was 248).


Install: download AgentMenu-1.3.0.dmg, open it, drag to Applications. Ad-hoc signed and not notarised, so macOS blocks the first launch — the README covers three ways past that.