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

  1. Add "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "75" to the env section of ~/.claude/settings.json
  2. Start a long session until context exceeds 75%
  3. Observe: autocompact does not fire
  4. Run Bash(echo $CLAUDE_AUTOCOMPACT_PCT_OVERRIDE) — confirms subprocess sees 75
  5. Session continues past 86% with no autocompact trigger

Expected behavior

Either:

  • The env block in settings.json should 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.json env injection confirmed working for subprocess calls
  • Context reached 86% (172.6k/200k) without autocompact firing despite threshold set to 75%

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗