AI News Daily한국어
← AI tool tips
Claude Code✓ Confirmed in official docsAdded Dec 5

How to show context usage against both the auto-compact window and the full window in the Claude Code status line

Starting with 2.1.336, released December 3, the context_window.used_percentage field that Claude Code passes to status line scripts measures something different. It used to be a percentage of the model's full context window (context_window_size). In a local session it's now a percentage of your auto-compact window, or of the full window when auto-compact is off. If the number jumped after you updated, this is why.

The new value uses the same basis as /context, so a reading near 100% means compaction is close. remaining_percentage is 100 minus this value. To track usage against the model's full window, compute total_input_tokens divided by context_window_size yourself. This setting shows both side by side (it needs jq):

// ~/.claude/settings.json
{
  "statusLine": {
    "type": "command",
    "command": "jq -r '\"compact \\(.context_window.used_percentage // 0 | floor)% · full \\((.context_window.total_input_tokens // 0) * 100 / (.context_window.context_window_size // 1) | floor)%\"'"
  }
}

used_percentage can be null early in a session, so // 0 falls back to 0. The status line uses counts from the last API response, while /context adds an estimate for messages since then, so /context can read a little higher until the next response. Set the auto-compact window size with the /autocompact command or the CLAUDE_CODE_AUTO_COMPACT_WINDOW environment variable.

Get notified when a new tip lands

Tip alerts only go out in the app. Install it and turn notifications on.

Get the app

All tips →