Populate context window usage fields in statusline JSON

Resolved 💬 3 comments Opened Feb 6, 2026 by danielrees8743 Closed Feb 10, 2026

Feature Request

The statusline script receives JSON input via stdin that includes context window fields, but current_usage, used_percentage, and remaining_percentage are always null:

"context_window": {
    "total_input_tokens": 47442,
    "total_output_tokens": 81754,
    "context_window_size": 200000,
    "current_usage": null,
    "used_percentage": null,
    "remaining_percentage": null
}

The only token data available (total_input_tokens, total_output_tokens) represents cumulative session totals, not the current context window occupancy. This makes it impossible to display accurate context usage in a custom statusline.

Why This Matters

The /context command already calculates and displays accurate free space (e.g., Free space: 98k (49.1%)), so the data exists internally. Exposing it through the statusline JSON would allow users to build custom statuslines that show real-time context usage — helping them decide when to /clear or /compact before running out of space.

Requested Change

Populate the existing current_usage, used_percentage, and remaining_percentage fields in the statusline JSON with the same values that /context uses internally. Ideally also include the autocompact buffer size so users can calculate true usable free space.

View original on GitHub ↗

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