なぜ設定するのか
初期値だと、30日使っていないセッションの履歴は起動時に何の通知もなく削除され、/resume からも消えます。過去のやり取りを検索・再開したいなら大きくしておくのが安全です。
最小値は 1。大きくするとディスク使用量は増えます。
設定方法
~/.claude/settings.jsonを開く(なければ作る)- スニペットを JSON の中に統合する。既存の設定は消さず、キーを足す形で入れる
- Claude Code を起動し直す
- 既定値
- 30(日)
- 書く場所
~/.claude/settings.json- 型
- number of days, a whole number, minimum
1 - 置ける場所
- Any file
公式ドキュメントの説明
Set how many days Claude Code keeps session transcripts and other application data before deleting them. Claude Code runs the deletion as a background sweep after a session starts, as long as it can safely determine the retention period. The sweep deletes transcripts without showing a message, so a session you haven't used for longer than the retention period no longer appears in the /resume picker.