The vendor documents this bug. A 30k-star repo shipped it anyway.
This is part three of a series about pointing an append-only audit log at things that count tokens. Part one found that a single missing model line was half my AI agent overspend. Part two found two accounting bugs in splitrail, both of which undercounted — one hid 54% of my messages. This one points the other way. The target is claude-code-templates — 30.1k stars, 3.3k forks, the largest Claude…
The Claude Code Templates repository, which has 30.1k stars and 3.3k forks, was found to be undercounting token usage by 2.35×. This issue was documented in Anthropic's own SDK, which includes a warning box and a reference implementation for the fix. Despite four separate mechanisms attempting to address the issue, no human has replied to the open fix for ten days.
The bug was caused by the calculateRealTokenUsage() function summing message.usage over every parsed record, resulting in each assistant message being counted once per block. This led to downstream inflation of token usage figures, including conversation.tokens, summary.totalTokens, per-project rollups, and the Total Tokens figure on the analytics dashboard.
Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.