Skip to content

CLAUDE_AUTOCOMPACT_PCT_OVERRIDE in settings.json env block silently ignored by autocompact logic #63186

Description

@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%

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workingduplicateThis issue or pull request already existsplatform:linuxIssue specifically occurs on LinuxstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions