Feature Request: Populate used_percentage and remaining_percentage in statusline JSON

Resolved 💬 3 comments Opened Jan 20, 2026 by ChrisLehnen Closed Jan 24, 2026

Summary

The custom statusline JSON payload includes used_percentage and remaining_percentage fields in the context_window object, but they are always null. Meanwhile, Claude Code internally calculates and displays "Context left until auto-compact: X%" which uses a different (more accurate) calculation.

Current Behavior

"context_window": {
  "total_input_tokens": 3882,
  "total_output_tokens": 5414,
  "context_window_size": 200000,
  "used_percentage": null,      // Always null
  "remaining_percentage": null  // Always null
}

Custom statusline scripts must calculate usage manually from total_input_tokens + total_output_tokens, but this significantly underestimates actual context usage because it excludes:

  • System prompts (CLAUDE.md, etc.)
  • Tool definitions
  • File contents from Read operations
  • Other hidden context

This leads to discrepancies like showing "39% used" in a custom statusline while Claude Code internally shows "1% left until auto-compact".

Requested Behavior

Populate used_percentage and remaining_percentage with the same values Claude Code uses internally for auto-compact decisions. This would allow custom statuslines to display accurate context usage.

Workaround

None - the internal calculation is not exposed.

Environment

  • Claude Code version: 2.1.12
  • macOS

View original on GitHub ↗

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