How often does Claude Code hit the context limit? Shows compaction frequency, pre-compaction token counts, and trigger type breakdown.
cc-compact — Claude Code context compaction stats
Total sessions: 755
Sessions compacted: 137 (18.1% of sessions)
Total compactions: 912
Avg per compacted: 6.7 compactions/session
Trigger: 883 auto / 29 manual
Pre-compaction context size:
Min: 71.1K tokens
Avg: 163.9K tokens
Median: 167.3K tokens
Max: 190.3K tokens
────────────────────────────────────────────────────────
Context size at compaction
<100K ░░░░░░░░░░░░░░░░░░░░░░░░ 9 (1.0%)
100–150K ░░░░░░░░░░░░░░░░░░░░░░░░ 9 (1.0%)
150–175K ████████████████████████ 870 (95.4%)
175K+ █░░░░░░░░░░░░░░░░░░░░░░░ 24 (2.6%)
npx cc-compact # Compaction frequency and token stats
npx cc-compact --json # JSON output- Compaction rate — percentage of sessions that hit the context limit
- Total compactions — how many times Claude Code auto-compacted
- Trigger breakdown — auto (limit hit) vs manual (/compact command)
- Pre-compaction size — context size at the moment of compaction
- Size distribution — where in the token range compactions happen
- Monthly trend — compaction frequency over time
- By project — which projects burn through context fastest
When Claude Code's context window fills up, it automatically compacts (summarizes) the conversation to free up space. This is called an "auto" compaction.
- Auto compaction (96.8% of cases): hit the limit, context summarized automatically
- Manual compaction (3.2% of cases): user typed
/compactbefore hitting the limit
95.4% of auto-compactions happen between 150K–175K tokens — just below the typical 200K context limit.
Reads session files looking for compaction event markers. No content is transmitted. Everything runs locally.
Drop your ~/.claude folder into cc-compact on the web — no install required.
Part of cc-toolkit — 87 free tools for Claude Code