Answer: You can set the auto-compact window in several ways: run `/autocompact` with a value like `/autocompact 500k` for the current model, set `autoCompactWindow` in a settings file for every model, pass `--autocompact` for one launch, or set `CLAUDE_CODE_AUTO_COMPACT_WINDOW` in scripts and cloud environments. Status: Confirmed Entry: tool/claude-code/memory-and-context/auto-compact-window Revision: 6 Digest: sha256:cce5347d87b4e4dc (changes whenever the content changes) Timeline: Created: 2026-11-13T03:04:44Z Last changed: 2026-11-20T12:22:19Z (minimum window size: — → 100K tokens) Last verified: 2026-11-20T12:22:19Z Next check: 2026-11-21T12:22:19Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of command | /autocompact 500k | | [1] | 2026-11-20 settings key | autoCompactWindow | | [1] | 2026-11-20 CLI flag | --autocompact | | [1] | 2026-11-20 environment variable | CLAUDE_CODE_AUTO_COMPACT_WINDOW | | [1] | 2026-11-20 minimum window size | 100K tokens | tokens | [1] | 2026-11-20 Sources: [1] Anthropic. "Model configuration". https://code.claude.com/docs/en/model-config.md Role: primary. Accessed: 2026-11-20T12:22:19Z Quote: "run `/autocompact` with a value, like `/autocompact 500k`" (Supports: command) Quote: "set [`autoCompactWindow`](https://code.claude.com/docs/en/settings-reference#autocompactwindow) in a settings file, such as `"autoCompactWindow": 200000` in `~/.claude/settings.json`" (Supports: settings key) Quote: "pass [`--autocompact`](https://code.claude.com/docs/en/cli-reference#cli-flags) when starting Claude Code" (Supports: CLI flag) Quote: "set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](https://code.claude.com/docs/en/env-vars) to a token count such as `200000`" (Supports: environment variable) Quote: "The command and the flag accept a window size of 100K tokens or more" (Supports: minimum window size) Published: 2026-11-20T02:51:47Z Snapshot SHA-256: 0eb85bfd05da194833d741b15172de8430cee5920a4ecd11ec07787db8d2c0cf (captured 2026-11-20T12:22:16Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:22:19Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:22:19Z Last attempt: 2026-11-20T12:22:19Z Notes and limitations: Extracted automatically from a single official source (section "Set the auto-compact window"). Related: https://latestn.com/tool/claude-code/memory-and-context/auto-memory-storage-location Where does Claude Code store auto memory files? https://latestn.com/tool/claude-code/memory-and-context/check-session-context-usage How can I check my own Claude Code session's context usage? https://latestn.com/tool/claude-code/memory-and-context/choose-instruction-files How do I choose which CLAUDE.md or AGENTS.md instruction files Claude Code loads? https://latestn.com/tool/claude-code/integrations/v2-session-api-removal-version Which Claude Code TypeScript Agent SDK version removed the V2 session API functions like unstable_v2_createSession? https://latestn.com/tool/claude-code/integrations/when-install-prompt-appears When does the Claude Code plugin install prompt appear to users? https://latestn.com/tool/claude-code/memory-and-context/1m-token-context-window How do I enable the 1M token context window in Claude Code on Google Cloud's Agent Platform? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-20T12:22:19Z | changed | minimum window size: — → 100K tokens | [1] 2026-11-20T12:22:19Z | changed | minimum window: 100K tokens → — | [1] 2026-11-20T12:22:19Z | changed | settings key: "autoCompactWindow": 200000 → autoCompactWindow | [1] 2026-11-19T12:17:47Z | changed | command: — → /autocompact 500k | [1] 2026-11-19T12:17:47Z | changed | maximum window: 1M → — | [1] 2026-11-19T12:17:47Z | changed | minimum window: 100K → 100K tokens | [1] 2026-11-19T12:17:47Z | changed | settings key: autoCompactWindow → "autoCompactWindow": 200000 | [1] 2026-11-19T12:17:47Z | changed | command method: /autocompact 500k → — | [1] 2026-11-18T12:17:40Z | changed | maximum window: — → 1M | [1] 2026-11-18T12:17:40Z | changed | minimum window: — → 100K | [1] 2026-11-18T12:17:40Z | changed | command method: — → /autocompact 500k | [1] 2026-11-18T12:17:40Z | changed | maximum window size: 1M → — | [1] 2026-11-18T12:17:40Z | changed | minimum window size: 100K → — | [1] 2026-11-18T12:17:40Z | changed | command: /autocompact 500k → — | [1] 2026-11-15T12:22:26Z | changed | maximum window size: — → 1M | [1] 2026-11-15T12:22:26Z | changed | minimum window size: — → 100K | [1] 2026-11-15T12:22:26Z | changed | accepted window size range: 100K to 1M → — | [1] 2026-11-15T12:22:26Z | changed | settings key: "autoCompactWindow": 200000 → autoCompactWindow | [1] 2026-11-14T12:18:03Z | changed | accepted window size range: — → 100K to 1M | [1] 2026-11-14T12:18:03Z | changed | environment variable: — → CLAUDE_CODE_AUTO_COMPACT_WINDOW | [1] 2026-11-14T12:18:03Z | changed | CLI flag: — → --autocompact | [1] 2026-11-14T12:18:03Z | changed | settings key: — → "autoCompactWindow": 200000 | [1] 2026-11-14T12:18:03Z | changed | command: — → /autocompact 500k | [1] 2026-11-14T12:18:03Z | changed | reset to tuned window: /autocompact auto → — | [1] 2026-11-14T12:18:03Z | changed | maximum window size: 1M → — | [1] 2026-11-14T12:18:03Z | changed | minimum window size: 100K → — | [1] 2026-11-14T12:18:03Z | changed | environment variable example: 200000 → — | [1] 2026-11-14T12:18:03Z | changed | settings key example: "autoCompactWindow": 200000 → — | [1] 2026-11-14T12:18:03Z | changed | command example: /autocompact 500k → — | [1] 2026-11-13T03:04:44Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/memory-and-context/auto-compact-window/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/memory-and-context/auto-compact-window POST: https://latestn.com/dispute/tool/claude-code/memory-and-context/auto-compact-window with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/memory-and-context/auto-compact-window?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I set the auto-compact window in Claude Code? Revision 6, last verified 2026-11-20T12:22:19Z. https://latestn.com/tool/claude-code/memory-and-context/auto-compact-window (accessed 2026-11-21T09:54:30Z). @misc{LatestN_tool_claude_code_memory_and_context_auto_compact_window_r6, title = {How do I set the auto-compact window in Claude Code?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/memory-and-context/auto-compact-window}}, note = {Revision 6; digest sha256:cce5347d87b4e4dc; last verified 2026-11-20T12:22:19Z; accessed 2026-11-21T09:54:30Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/memory-and-context/auto-compact-window