# cleanupPeriodDays

> The key that sets how many days old chat logs are kept.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** cleanupPeriodDays setting, transcript retention

## Think of it like

It is like a rule that old notes go in the bin each month.

## Definition

cleanupPeriodDays is a settings key that sets how many days Claude Code keeps old chat logs. That covers session transcripts and other saved data, which it then deletes. The default is 30 days and the smallest value is 1. Setting 0 fails, so pick a large number, such as 3650, to keep them a long time. The clean-up runs in the background after a session starts.

## Example

Lucy wanted to resume a chat from six weeks ago, but it was gone. She sets cleanupPeriodDays to 90.

## Example code

```json
{
  "cleanupPeriodDays": 90
}
```

Keep transcripts for 90 days.

## Why it matters

It decides how far back /resume can reach, and how long your logs sit on disk.

## Common mistake

Setting it to 0 to keep logs forever. 0 fails, so use a large number instead.

## Three principles

- **Days to keep.** Default 30.
- **At least 1.** 0 fails.
- **Runs in the background.** After start.

## Related terms

- [Session Transcript](https://learn.benibix.com/term/ai/session-transcript)
- [/resume Command](https://learn.benibix.com/term/ai/resume-command)
- [~/.claude Directory](https://learn.benibix.com/term/ai/home-claude-directory)

---

Source: https://learn.benibix.com/term/ai/cleanup-period-days-setting
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
