Where Claude Code stores your usage data, and when it deletes it
The folder Claude Code keeps session logs in, what is inside them, why they disappear after 30 days by default, and how to keep them longer.
2 min read · updated 2026-10-02
Claude Code keeps a record of your sessions on your own computer. Knowing where it lives and how long it stays is useful for tracking usage, for resuming old conversations and for privacy.
Where the files are
Session logs are plain text JSON Lines files (.jsonl) in a folder named projects inside Claude Code's config directory:
~/.claude/projects/on most setups;~/.config/claude/projects/on some;- a different base folder if you set the
CLAUDE_CONFIG_DIRenvironment variable.
Inside, there is one folder per project and one file per session. Each line is one event with a timestamp and a session id. Replies from the model include a usage block with the input, output and cache token counts, which is what any usage tracker reads.
They are deleted after 30 days by default
Claude Code removes session files older than a set number of days when it starts. The setting is called cleanupPeriodDays and it defaults to 30. There is no warning and no trash, and people have been surprised to find old conversations and the history behind their usage totals gone (one report).
To keep logs longer, set a larger number in ~/.claude/settings.json:
{
"cleanupPeriodDays": 365
}Choose a large positive number. Avoid 0: it has been reported to stop transcripts from being written at all.
What this means for tracking usage
If you only read the local files, your history stops at about a month, however long you have used Claude Code. That is the reason showmytokens keeps your per-day counts on its own server: once a day has been synced, it stays on your receipt even after Claude Code deletes the logs behind it. Sync regularly, and nothing falls off the end.
What showmytokens reads and sends
The command line tool reads the same local logs and uploads, per day:
- message and session counts, and the length of your longest session;
- token totals per model (input, output and cache);
- messages per hour of the day;
- a random machine id, so several computers add up correctly.
It does not send prompts, replies, code, file names, project names or paths. Run npx showmytokens sync --dry-run to see the exact payload without sending anything, and read the whole script at /cli. Details are in the privacy policy.
Deleting what is already there
You can delete your receipt and all synced data at any time from your receipt page with Delete my data. That removes our copy. The files on your computer are yours and are not touched.