Environment Variables to Adjust Claude's Context Window

mattyp · x · 2026-07-07

Introduces two environment variables for adjusting Claude Code's auto-compaction threshold: CLAUDEAUTOCOMPACTPCTOVERRIDE accepts a percentage integer (e.g., setting it to 20 triggers auto-compaction for Fable at 200k/20%), and CLAUDECODEAUTOCOMPACTWINDOW can be set directly to a token count (e.g., 200000).

The author notes that a smaller window might reduce costs, decrease usage, or improve model performance.

Original post →

More from coding & agent

coding & agent channel →