Feature Request: Add actual context window usage to statusline JSON

Resolved 💬 3 comments Opened Jan 5, 2026 by rmfalco89 Closed Jan 9, 2026

Summary

The statusline JSON passed to custom scripts doesn't include the actual context window usage that /context command displays. This makes it impossible to show accurate context usage in custom statuslines.

Current Behavior

The JSON includes these fields under context_window:

  • total_input_tokens
  • total_output_tokens
  • context_window_size
  • current_usage.cache_read_input_tokens
  • current_usage.cache_creation_input_tokens

These are API billing metrics, not the actual context window usage. When trying to calculate context usage from these values, the result differs significantly from what /context shows (e.g., showing 50% when actual usage is 83%).

What /context Shows

The /context command displays the real breakdown:

  • System prompt tokens
  • System tools tokens
  • MCP tools tokens
  • Custom agents tokens
  • Memory files tokens
  • Messages tokens
  • Total: e.g., "128k/200k tokens (64%)"

Requested Feature

Please add the actual context window usage to the statusline JSON, similar to what /context displays. Something like:

{
  "context_window": {
    "actual_usage": {
      "total_tokens": 128000,
      "percentage": 64,
      "breakdown": {
        "system_prompt": 3200,
        "system_tools": 20400,
        "mcp_tools": 34100,
        "custom_agents": 4000,
        "memory_files": 7800,
        "messages": 58400
      }
    },
    "context_window_size": 200000
  }
}

Or at minimum, just the total tokens and percentage would be very useful:

{
  "context_window": {
    "total_used_tokens": 128000,
    "usage_percentage": 64,
    "context_window_size": 200000
  }
}

Use Case

Users want to display context usage in their custom statuslines to know when they're running low on context and should consider compacting or starting a new session.

Thank you!

View original on GitHub ↗

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