環境変数
CLAUDE_CODE_MAX_TURNS
明示的な上限が渡されない場合のエージェント的なターン数を制限する。--max-turns を渡すのと同等であり、両方が設定された場合は --max-turns が優先される。正の整数でない値は、上限なしとして扱われず、起動時にエラーで拒否される
使い方・用途
- コンピュータがスリープした場合などに応答が止まったセッションで、ターン数が上限に達したことを示す 'Reached the turn limit' のメッセージが出るため、上限を引き上げたり解除したりしてタスクの続行を制御したい場合に使う。
英語原文(公式ドキュメントより)
Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing --max-turns, which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap