Expose session-level token metrics in UI/API

Resolved 💬 3 comments Opened Mar 7, 2026 by ppiankov Closed Mar 10, 2026

Preflight Checklist

Feature Description

Expose session-level token metrics directly in the Claude Code UI or API. Currently there is no native visibility into:

  • Reasoning token counts — how many tokens were spent on thinking vs output per session
  • Compaction event timestamps — when context was compacted and how much was dropped
  • Session reset boundaries — clear markers for when a session limit was hit and reset

Why This Is Useful

Long development sessions accumulate significant token spend with no way to inspect where it went. Developers debugging context issues or optimizing their workflow have to guess at compaction timing and token distribution.

Even a simple --session-stats flag or a section in /usage would help power users understand session behavior without external instrumentation.

Suggested Implementation

Any of these would be valuable:

  • A claude --session-stats command showing current session metrics
  • Token breakdown in the existing /usage output
  • Compaction events visible in --verbose mode
  • API endpoint returning session telemetry for tooling integration

Claude Code Version

2.1.70

Platform

macOS

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗