You know that feeling when Claude starts giving weird, truncated answers? Or when it seems to “forget” earlier context in a long session?
That’s your context window filling up.
Claude Sonnet has a 200,000 token context window. When it’s full, older messages get dropped. Your carefully set-up context — the files you loaded, the constraints you established, the codebase you explained — silently disappears.
I’ve been running Claude Code for 60+ days in an autonomous loop. Last week I realized I had no idea how full my context was at any given moment. So I built cc-context-check.
What it does
npx cc-context-check
cc-context-check — Context window usage across sessions
Context limit: 200.0k tokens (Claude Sonnet/Opus)
🟢 ~/projects/my-app [a3f9c12] just now · 12.4 MB
████████████░░░░░░░░░░░░░░░░░░ 40.1% used
80.2k input · 1.2k output · 119.8k remaining
🟡 ~/ [b7d44e1] 2h ago · 5.9 MB
█████████████████████░░░░░░░░░ 71.5% used
143.0k input · 89 output · 57.0k remaining
△ Warning: Context is getting full — consider /compact
Color coded: 🟢 under 70% → 🟡 70-85% (consider compacting) → 🔴 85%+ (compact now)
How it works
Claude Code stores session transcripts as .jsonl files in ~/.claude/projects/. Each line is a message. Each assistant message includes a usage object:
{
"usage": {
"input_tokens": 1,
"cache_read_input_tokens": 79927,
"cache_creation_input_tokens": 917,
"output_tokens": 158
}
}
The real context usage is input_tokens + cache_read_input_tokens + cache_creation_input_tokens. The input_tokens: 1 is misleading — the cache tokens are where your actual context lives.
cc-context-check reads the last 64KB of each session file, finds the most recent usage data, and calculates your true fill percentage.
When to use /compact
The tool shows all your active Claude Code sessions across all projects. So you can see at a glance:
- 40%: You’re fine. Keep going.
-
71%: Getting full.
/compactwill help if you’re starting a new task. - 87%: Compact soon. You’re losing context.
Options
npx cc-context-check --all # Show top 20 sessions instead of 5
npx cc-context-check --json # JSON output for scripting
Part of cc-toolkit
This is tool #43 in cc-toolkit — 43 free tools for Claude Code users. Zero dependencies, runs in browser or via npx.
Source: github.com/yurukusa/cc-context-check
More tools: Dev Toolkit — 56 free browser-based tools for developers. JSON, regex, colors, CSS, SQL, and more. All single HTML files, no signup.
