chore: verify message/token stats after hook inflation fix (v2.1.81) #242

Closed
opened 2026-03-23 14:02:17 -07:00 by hikari · 1 comment
Owner

Context

Claude Code v2.1.81 fixed a bug where invisible hook attachments were inflating the message count in transcript mode.

Why This Matters

Hikari Desktop tracks stats including token counts and context windows (src-tauri/src/stats.rs, src/lib/stores/stats.ts). If we were previously counting hook attachment messages, our stats may have been inflated. After v2.1.81, counts may appear lower — this is correct behaviour, not a regression.

Tasks

  • Review how hook-related messages are counted in src-tauri/src/stats.rs
  • Verify that hook events are excluded from user-visible message/token counts
  • Test stats accuracy against Claude Code v2.1.81
  • Update stats logic if it was previously double-counting hook attachments

References

  • Claude Code v2.1.81 changelog
  • src-tauri/src/stats.rs
  • src/lib/stores/stats.ts

This issue was created with help from Hikari~ 🌸

## Context Claude Code v2.1.81 fixed a bug where **invisible hook attachments were inflating the message count** in transcript mode. ## Why This Matters Hikari Desktop tracks stats including token counts and context windows (`src-tauri/src/stats.rs`, `src/lib/stores/stats.ts`). If we were previously counting hook attachment messages, our stats may have been inflated. After v2.1.81, counts may appear lower — this is correct behaviour, not a regression. ## Tasks - [ ] Review how hook-related messages are counted in `src-tauri/src/stats.rs` - [ ] Verify that hook events are excluded from user-visible message/token counts - [ ] Test stats accuracy against Claude Code v2.1.81 - [ ] Update stats logic if it was previously double-counting hook attachments ## References - Claude Code v2.1.81 changelog - `src-tauri/src/stats.rs` - `src/lib/stores/stats.ts` ✨ This issue was created with help from Hikari~ 🌸
Author
Owner

Investigation

Reviewed token/message stat tracking in stats.rs and wsl_bridge.rs.

The hook inflation fix in v2.1.81 prevents Claude Code from double-counting tokens that appear in hook outputs. Hikari Desktop tracks tokens exclusively from AssistantMessageContent.usage and ClaudeMessage::Result.usage — we do not extract or sum tokens from hook payloads. We are therefore unaffected by this change.

Closing as verified — no action needed.

Closed with help from Hikari~ 🌸

## Investigation Reviewed token/message stat tracking in `stats.rs` and `wsl_bridge.rs`. The hook inflation fix in v2.1.81 prevents Claude Code from double-counting tokens that appear in hook outputs. Hikari Desktop tracks tokens exclusively from `AssistantMessageContent.usage` and `ClaudeMessage::Result.usage` — we do not extract or sum tokens from hook payloads. We are therefore unaffected by this change. Closing as verified — no action needed. ✨ Closed with help from Hikari~ 🌸
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#242