CLAUDE_AUTOCOMPACT_PCT_OVERRIDE in settings.json env block silently ignored by autocompact logic
Open 💬 5 comments Opened May 28, 2026 by rasatpetabit
Bug
Setting CLAUDE_AUTOCOMPACT_PCT_OVERRIDE in the env block of settings.json has no effect on the autocompact threshold. The variable is visible to subprocess tool calls (e.g. Bash) but is not applied to the Claude Code application's own autocompact logic.
Steps to reproduce
- Add
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "75"to theenvsection of~/.claude/settings.json - Start a long session until context exceeds 75%
- Observe: autocompact does not fire
- Run
Bash(echo $CLAUDE_AUTOCOMPACT_PCT_OVERRIDE)— confirms subprocess sees75 - Session continues past 86% with no autocompact trigger
Expected behavior
Either:
- The
envblock insettings.jsonshould apply to app-level configuration knobs (including autocompact threshold), not only to subprocess invocations, OR - The docs/settings UI should clearly distinguish between "subprocess env vars" and "app configuration vars" and provide a separate mechanism for the latter
Actual behavior
Autocompact threshold is not respected. The only workaround is to export the variable in the shell before launching Claude Code (export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=75 in .bashrc/.zshrc).
Environment
- Claude Code CLI (headless Linux server)
- Model: claude-sonnet-4-6
settings.jsonenv injection confirmed working for subprocess calls- Context reached 86% (172.6k/200k) without autocompact firing despite threshold set to 75%
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗