Add configurable context window limit / auto-compaction threshold
Resolved 💬 4 comments Opened Mar 30, 2026 by shaun949 Closed Apr 3, 2026
Problem
Users on plans that default to 1M context windows have no way to opt into a smaller effective context window (e.g., 200K). This means auto-compaction only triggers near the 1M limit, which:
- Burns through token quotas faster — every request sends up to 1M tokens of context
- Slows down responses — more context = more processing time
- Reduces total work per session — tokens are spent on stale context instead of new work
For power users doing long iterative sessions, this is a significant cost/efficiency issue.
Proposed Solution
Add a configurable context window limit, e.g.:
Option A: settings.json
{
"contextWindowLimit": 200000
}
Option B: CLI flag
claude --context-window 200000
Option C: Both
This would cap the effective context window and trigger auto-compaction at the configured limit instead of the model maximum.
Use Case
- User has Opus 4.6 with 1M context by default
- User wants to compact aggressively at ~200K to maximize productive work per token budget
- Currently the only workaround is manually running /compact, which is easy to forget
Alternatives Considered
- Manual /compact — works but requires user discipline and is easy to forget
- Using subagents — helps but does not solve the core issue
- CLAUDE.md instructions to the model — unreliable since the model cannot actually measure its own context usage precisely
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗