CLAUDE_CODE_DISABLE_1M_CONTEXT
Updated by Alex Sorokoletov
CLAUDE_CODE_DISABLE_1M_CONTEXT is a Claude Code environment variable: Disable extended 1M token context window. 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_CODE_DISABLE_1M_CONTEXT=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_DISABLE_1M_CONTEXT": "<value>"
}
}Release notes that mention it
- CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: Complete Guide to Claude Code Auto-Compaction Control
- 165 Environment Variables in Claude Code 2.1.69 — What Changed in 50 Versions
Related variables
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_PRECOMPACT_SKIP: Disable skipping pre-compaction checks.CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT: Extra context passed to save hooks.CLAUDE_CONTEXT_COLLAPSE: Collapses context on the fly, with a dedicated model to do it.DISABLE_AUTO_COMPACT: Disable automatic compaction only (manual /compact still works).DISABLE_CLAUDE_CODE_SM_COMPACT: Disable session memory compaction.DISABLE_COMPACT: Disable all compaction (manual + auto).
Frequently asked questions
What does CLAUDE_CODE_DISABLE_1M_CONTEXT do?
Disable extended 1M token context window
Which Claude Code version has CLAUDE_CODE_DISABLE_1M_CONTEXT?
Present since v2.1.69 or earlier and still present in v2.1.294.
How do I set CLAUDE_CODE_DISABLE_1M_CONTEXT?
Export it before starting Claude Code (export CLAUDE_CODE_DISABLE_1M_CONTEXT=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.