環境変数
CLAUDE_CODE_AUTO_COMPACT_WINDOW
自動コンパクションの計算に使用するコンテキスト容量(トークン数)を設定します。
使い方・用途
- 1Mモデルを使用している際などに、物理的な上限(100万)ではなく仮想的な上限(例:50万)を基準にコンパクションを発生させたい場合に指定します。
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEによる割合計算の基準値をモデルの最大値から切り離すことができます。
英語原文(公式ドキュメントより)
Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model's context window: 200K for standard models or 1M for extended context models. Use a lower value like 500000 on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model's actual context window. CLAUDE_AUTOCOMPACT_PCT_OVERRIDE is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line's used_percentage, which always uses the model's full context window