Feature Request: Include total context usage in statusline JSON

Resolved 💬 3 comments Opened Jan 6, 2026 by satelerd Closed Jan 6, 2026

Problem

The statusline JSON payload only includes message/cache tokens in context_window.current_usage, but doesn't include the full context breakdown that /context command shows:

  • System prompt tokens
  • System tools tokens
  • MCP tools tokens
  • Memory files tokens
  • Autocompact buffer tokens

This means custom statusline scripts show inaccurate context percentages. For example, my statusline shows ~58% when /context reports 105%.

Current JSON structure

{
  "context_window": {
    "context_window_size": 200000,
    "current_usage": {
      "input_tokens": 7,
      "cache_creation_input_tokens": 214,
      "cache_read_input_tokens": 117145
    }
  }
}

Requested enhancement

Add a field with the total real context usage that matches what /context reports:

{
  "context_window": {
    "context_window_size": 200000,
    "total_context_tokens": 209000,  // NEW: total including all components
    "current_usage": {
      "input_tokens": 7,
      "cache_creation_input_tokens": 214,
      "cache_read_input_tokens": 117145
    },
    // Optional: breakdown like /context shows
    "breakdown": {
      "system_prompt": 3900,
      "system_tools": 15300,
      "mcp_tools": 26400,
      "memory_files": 1300,
      "messages": 117100,
      "autocompact_buffer": 45000
    }
  }
}

Use case

Users with custom statusline scripts (bash, Python, etc.) want to display accurate context usage without having to estimate overhead or parse transcript files.

Workaround

Currently estimating ~90k overhead, but this varies based on MCP servers configured and is inaccurate.

View original on GitHub ↗

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