A developer has identified a significant bug in the popular `claude-code-templates` repository, which has led to an overcounting of token usage by 2.35 times. The issue stems from how the code sums message usage, counting tokens multiple times for each content block within a single assistant message. This problem was documented by Anthropic in their Agent SDK documentation, which even provided a reference implementation for a fix, yet the bug persisted in the widely-used template repository. The developer noted that a simple assertion checking distinct message IDs against record counts would have flagged the issue immediately. AI
IMPACT Highlights potential for significant cost overruns in AI agent development due to unaddressed token counting bugs.
RANK_REASON Developer identifies and documents a bug in a popular open-source code repository related to LLM token counting.
AI-generated summary · Google Gemini · from 1 sources. How we write summaries →