Feature request: automatic retention/cleanup policy for old session files (~/.claude/projects/)

Resolved 💬 3 comments Opened Apr 12, 2026 by makkax Closed Apr 16, 2026

Problem

Session files (.jsonl) accumulate indefinitely under ~/.claude/projects/ with no automatic cleanup.

After a few weeks of normal use, this directory can easily reach 100–130 MB — dozens of past conversation files that Claude Code never cleans up on its own.

The only way to reclaim space today is to manually identify and delete old .jsonl files, being careful not to accidentally delete the current session or important subdirectories (like memory/). This is error-prone and not obvious to most users.

Suggested fix

A simple retention policy would solve this:

  • Auto-delete session files older than N days (e.g. 30), configurable in .claude/settings.json
  • Or a claude --cleanup-sessions [--older-than 30d] CLI command
  • At minimum: surface total session storage size somewhere in the UI/CLI so users are aware

Context

Discovered this while manually cleaning up on macOS. Had to write a find command to safely remove old sessions while preserving the active one. Not ideal.

Environment

  • macOS (Apple Silicon)
  • Claude Code CLI + Desktop
  • ~/.claude/projects/ had 50 session files across 4 project directories

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗