Skip to content

v1.0.1 — 1M context window detection

Choose a tag to compare

@junaidtitan junaidtitan released this 15 Mar 15:38
· 540 commits to main since this release

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 like claude-opus-4-6-20260301[1m].
  • Guard banner: shows detected context window (Context: 1.0M or 200K)
  • 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: SessionStart hook now reads context_window_size directly 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.

Contributor: @ynaamane (PR #20)