CLAUDE_AUTOCOMPACT_PCT_OVERRIDE
Updated by Alex Sorokoletov
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is a Claude Code environment variable: Set when auto-compaction triggers (percentage threshold). Present since v2.1.69 or earlier and still present in v2.1.294. It is listed in the official reference.
| Status | Present in v2.1.294 |
|---|---|
| Added | Present since v2.1.69 or earlier |
| Category | Context and compaction |
| Official docs | Listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "<value>"
}
}Release notes that mention it
- Claude Code v2.1.126 — `project purge`, Gateway Model Picker, and What's Actually New
- CLAUDE_CODE_ATTRIBUTION_HEADER: Fix Bedrock 400 Errors & Prompt Caching Issues
- CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: Complete Guide to Claude Code Auto-Compaction Control
- Claude Code v2.1.75 — 2 New Environment Variables: Auto-Compact Window & Plugin Options
- 165 Environment Variables in Claude Code 2.1.69 — What Changed in 50 Versions
- Why Your Claude Code Sessions Keep Dying (And How to Fix Them)
- Debugging Claude Code Issues: Undocumented Environment Variables Uncovered
- Improved Claude Code Settings Schema with Environment Variable Autocomplete
Related variables
CLAUDE_AFTER_LAST_COMPACT: Request only conversation logs after last compaction.CLAUDE_CODE_AUTO_COMPACT_WINDOW: Controls the token window threshold at which automatic context compaction kicks in.CLAUDE_CODE_AUTO_MODE_PRIOR_ASSISTANT_CONTEXT: Feeds prior assistant turns into the decision, so the classifier can see the reasoning behind an edit.CLAUDE_CODE_AUTO_MODE_SIBLING_CONTEXT: Includes sibling files (or sessions) when classifying.CLAUDE_CODE_DISABLE_1M_CONTEXT: Disable extended 1M token context window.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP: Disable skipping pre-compaction checks.CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT: Extra context passed to save hooks.CLAUDE_CODE_SKIP_PRECOMPACT_LOAD: Optimize large session file loading.
Frequently asked questions
What does CLAUDE_AUTOCOMPACT_PCT_OVERRIDE do?
Set when auto-compaction triggers (percentage threshold)
Which Claude Code version has CLAUDE_AUTOCOMPACT_PCT_OVERRIDE?
Present since v2.1.69 or earlier and still present in v2.1.294.
How do I set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE?
Export it before starting Claude Code (export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.