Statusline hook: context_window_size always reports 200k, even in extended context sessions

Resolved 💬 3 comments Opened Mar 8, 2026 by cadfan Closed Mar 11, 2026

Problem

The statusline hook receives context_window.context_window_size as 200000 even when the session is using extended context (1M tokens). This makes it impossible to build an accurate token usage display in custom statusline scripts.

Current behaviour

In a 1M extended context session, the JSON provided to the statusline command contains:

{
  "context_window": {
    "context_window_size": 200000,
    "used_percentage": 100,
    "remaining_percentage": 0
  }
}

Once usage exceeds 200k, used_percentage stays at 100 and remaining_percentage stays at 0. The statusline has no way to know the session actually has 800k+ tokens remaining.

Expected behaviour

context_window_size should reflect the actual session limit (e.g. 1000000 for extended context sessions), and used_percentage / remaining_percentage should be calculated against that real limit.

Impact

Custom statusline scripts show misleading information like 200k / 200k (0k left!) when the session is healthy with plenty of context remaining. Users relying on the statusline for context management get false signals to start new sessions or compact.

Workaround

Currently detecting the "at limit" state and showing 200k+ (compacting soon) instead, but this loses the useful remaining-tokens information entirely.

Environment

  • Claude Code CLI (latest)
  • macOS / zsh
  • Opus 4.6 model with extended context enabled

View original on GitHub ↗

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