Repository navigation
v1.0.1 — 1M context window detection
1M context window detection
Claude Code appends [1m] to model IDs when using extended 1M context (e.g. claude-opus-4-6[1m]). Without this fix, the guard was firing at 150K tokens on a 1M session instead of 750K — triggering unnecessary prunes every few minutes and showing misleading diagnostics (50% context when it's actually 10%).
Changes
- Auto-detection:
[1m]-suffixed model IDs now map to 1M context window. Bracket-aware prefix matching handles versioned IDs likeclaude-opus-4-6-20260301[1m]. - Guard banner: shows detected context window (
Context: 1.0Mor200K) - Scaled thresholds: token thresholds now correctly compute as 75%/45% of 1M (750K/450K) instead of 200K defaults
- Overflow scaling: danger thresholds scale with context window size so reactive recovery doesn't trigger too early on large sessions
- Smarter hook:
SessionStarthook now readscontext_window_sizedirectly from Claude Code's stdin JSON and passes it to the guard — no inference needed
Zero breaking changes. 200K sessions are unaffected. COZEMPIC_CONTEXT_WINDOW env var still takes highest priority.