Feature request: expose per-category context breakdown in statusline payload

Resolved 💬 3 comments Opened May 6, 2026 by RecursiveSyntax Closed May 10, 2026

Summary

The Claude Code UI's "Context" panel already computes a per-category token breakdown (System prompt, Tools, Rules, Skills, MCP, Subagents, Conversation). This data is not currently exposed to the statusline command API, which only provides aggregate token counts.

Current statusline payload (context fields)

{
  "context_window": {
    "total_input_tokens": 70500,
    "total_output_tokens": 4521,
    "context_window_size": 200000,
    "used_percentage": 35,
    "remaining_percentage": 65,
    "current_usage": {
      "input_tokens": 8500,
      "output_tokens": 1200,
      "cache_creation_input_tokens": 5000,
      "cache_read_input_tokens": 56000
    }
  }
}

Requested addition

A context_breakdown field (or equivalent) in the statusline payload:

{
  "context_window": {
    "context_breakdown": {
      "system_prompt": 608,
      "tools": 7800,
      "rules": 3800,
      "skills": 1900,
      "mcp": 3700,
      "subagents": 937,
      "conversation": 48700
    }
  }
}

Use case

Custom statusline scripts can already display rich session state (model, cost, cache hit rate, turn count, etc.) but have no way to show users which category is consuming the most context. This is the single most actionable piece of information for a user approaching context limits — knowing whether it's conversation history, MCP tool definitions, or skills bloating the window changes what they'd do about it.

The UI already computes this data. Surfacing it in the statusline payload would make it available to plugin authors and power users without any additional API calls or tokenizer approximations.

Workaround attempted

Parsing the session transcript JSONL (available via transcript_path in the payload) to approximate per-category token counts using a local tokenizer (tiktoken cl100k_base). This is ~85-90% accurate at best and adds non-trivial latency to each statusline render. The native breakdown would be exact and free.

Additional context

  • The context panel breakdown is visible in the Claude Code desktop/web UI but the data doesn't flow to the statusLine.command stdout payload
  • Hook event payloads (PreToolUse, PostToolUse, Stop, etc.) also don't include this breakdown
  • A context_breakdown field in either the statusline payload or a hook event payload would both be useful

View original on GitHub ↗

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