~/.claude is huge: what takes the space, what is safe to delete, and keeping the history
Published · Updated · Checked against Claude Code 2.1.319
Open du on a ~/.claude that has been in use for a few months and projects/, the session transcripts, will be most of it. Inside that, a few long sessions and their subagent logs usually carry the weight. Delete the caches and logs freely. Copy projects/ somewhere before you touch anything in it, because a deleted transcript cannot be brought back.
Measure first
du -sh ~/.claude
du -sh ~/.claude/* ~/.claude/.[!.]* 2>/dev/null | sort -rh | head
These numbers are from Claude Code 2.1.319 (macOS):
3.4G .
2.9G projects
74M file-history
57M jobs
47M plugins
7.4M history.jsonl
projects/ is 85 percent of the total. Go one level down, then to single sessions:
# per project, largest first (sizes in KB)
du -sk ~/.claude/projects/* | sort -rn | head
# biggest single files
find ~/.claude/projects -type f -size +50M -exec ls -lh {} +
# subagent logs per session
du -sh ~/.claude/projects/*/*/subagents | sort -rh | head
On one machine, one project folder holds 1.6 GB, and one session transcript is 388 MB. In another project, the subagents/ folders of two sessions come to 670 MB and 463 MB. That shape is typical: a handful of long sessions, and agents that fan out into many subagent transcripts.
Where the space goes
The application data section of the docs lists what lives under ~/.claude/ and which of it ages out:
| Path | Contents | Aged out by cleanup? |
|---|---|---|
projects/<project>/<session>.jsonl | Transcript: messages, tool calls, tool results, plus the system prompt and tool definitions of each request | Yes |
projects/<project>/<session>/subagents/ | Subagent transcripts | Yes, with the parent |
projects/<project>/<session>/tool-results/ | Large tool outputs and full-size MCP images | Yes |
file-history/<session>/ | Pre-edit snapshots for checkpoint restore | Yes |
debug/ | Debug logs, only while debug logging is on | Yes |
paste-cache/, shell-snapshots/, session-env/ | Caches and per-session metadata | Yes |
history.jsonl | Prompts you typed | No |
The sweep deletes these once they are older than cleanupPeriodDays (default 30, minimum 1), so on a working install projects/ should level off at about 30 days of work. If yours is far above that, the culprit is recent sessions, not old ones. The docs also note that transcripts are plaintext and include everything that passed through a tool, from file contents to command output to pasted text. The sweep pauses when Claude Code cannot determine the retention period, for example when settings do not parse, and auto memory under projects/<project>/memory/ is never swept.
Early 2026 looked worse. In issue 24486, opened 9 Feb 2026 and closed as not planned by a bot in May, a user measured 1.7 GB of growth in about three weeks, with projects/ at 924 MB and debug/ at 537 MB. A commenter on v2.1.42 reported that cleanupPeriodDays did not appear to touch those directories. The current docs list debug/ and the others as swept. That was not re-tested against old versions.
What you can delete
The docs have a delete table that says what each removal costs. Condensed:
| Safe, you lose nothing user-facing | Safe, but you lose a feature | Do not delete |
|---|---|---|
debug/, plans/, session-env/, shell-snapshots/, backups/ (earlier ~/.claude.json copies) | file-history/ (checkpoint restore), paste-cache/ (pasted text in recalled prompts), history.jsonl (up-arrow and Ctrl+R), stats-cache.json (/usage totals) | ~/.claude.json, settings.json, plugins/, .credentials.json, agent-memory/, jobs/, daemon/ |
Legacy todos/, statsig/, logs/, image-cache/ | tasks/ (your task lists, even in-use ones) | projects/<project>/memory/ (auto memory) |
The keep-list in the docs names .credentials.json, agent-memory/, and the jobs/ and daemon/ background session state, and says not to delete ~/.claude.json, settings.json and plugins/.
projects/ is the one that hurts. The docs say deleting it costs you "resume, continue, and rewind for past sessions, and auto memory for every project", and it is the only record of what Claude did. Do not rm -rf it to reclaim space.
Shrinking projects/ by age, project or size
If you want to shrink projects/ yourself, work narrowly.
The supported route is to lower cleanupPeriodDays in ~/.claude/settings.json to something like 14 and let Claude Code do the rest. It deletes history sooner, which is the opposite of what you want if the history matters.
To purge one project there is a command, per the docs. It prints the plan and asks first:
claude purge ~/work/my-repo --dry-run
claude purge ~/work/my-repo
It deletes that project's transcripts and auto memory, its per-session tasks/, debug/ and file-history/, matching lines in history.jsonl, and its entry in ~/.claude.json. Before v2.1.288 the command was claude project purge. Note that it takes auto memory with it.
Subagent logs and big tool outputs are the bulk of many sessions, and they are also part of the record. If you accept losing them for old sessions after backing up, list first and delete later:
find ~/.claude/projects -path '*/subagents/*' -name '*.jsonl' -mtime +14 -size +10M
Run it with -print and read the list. Nothing is documented about deleting a subagent file while its parent transcript remains, and what resume does afterwards is untested.
Copy first, then delete
The copy has to live on a different disk to count:
tar -czf /Volumes/Backup/claude-projects-$(date +%F).tar.gz -C ~/.claude projects
tar -tzf /Volumes/Backup/claude-projects-$(date +%F).tar.gz | head # confirm it reads back
JSONL is repetitive text and compresses well. Check that the archive reads back before you remove anything. Transcripts are plaintext, so an archive on shared storage should be encrypted; Back up Claude Code and Codex sessions compares rsync, git and encrypted archives.
Sealkeep automates this trade: it seals each session into an encrypted archive, verifies that a copy reached your storage, and only then lets the local original go, and sealkeep squeeze measures how much disk that would free. Reclaim is opt-in (sealkeep autopilot --reclaim) and needs Sealkeep Cloud today; with your own bucket every original stays on disk. It does not clean debug/, file-history/ or other caches, and it is not needed if all you want is a smaller ~/.claude.
To get a deleted session back for claude --resume, the docs allow resuming by a transcript path, so a restored file works once it sits under the right project folder. Where Claude Code stores sessions covers the folder naming, and Claude Code deletes transcripts after 30 days covers what the sweep does to history you want to keep. All guides: /guides/.
FAQ
Why does ~/.claude keep growing if cleanup runs every 30 days?
Because 30 days of heavy use can be gigabytes. The sweep only removes files older than cleanupPeriodDays, and a few long sessions with many subagents account for most of it.
Will lowering cleanupPeriodDays free space?
Yes, by deleting older transcripts sooner. It frees space and loses history in the same step. The minimum is 1, and 0 fails validation.
Can I move ~/.claude to another drive?
The docs say CLAUDE_CONFIG_DIR relocates every ~/.claude path. Moving an existing directory with a symlink is untested.