Coredence

Guide

Where Claude Code stores session history, and for how long

Claude Code saves each session as a plaintext JSONL file under `~/.claude/projects/`. By default it deletes these files once they are older than 30 days, without showing a message. The `cleanupPeriodDays` setting changes that period.

Ahmet Karaca ·

Where are Claude Code sessions stored?

Each session has its own file:

~/.claude/projects/<project>/<session-id>.jsonl

<project> is the working directory path with every non-alphanumeric character replaced by -, so /Users/you/my-app becomes -Users-you-my-app. On Windows, ~/.claude means %USERPROFILE%\.claude. If CLAUDE_CONFIG_DIR is set, the whole tree moves under that directory.

Every line in the file is a JSON object: a message, a tool call or result, a request sent to the model, or metadata. Anthropic describes this format as internal and says it changes between versions, so it recommends /export or claude -p --resume to scripts that need session data.

How long does Claude Code keep sessions?

Thirty days by default. A background sweep runs after a session starts and deletes transcripts older than that without showing a message, so a session unused for longer no longer appears in /resume.

The same period applies to other data under ~/.claude, including file snapshots used for checkpoints in file-history/ and plan files in plans/. Auto memory in projects/<project>/memory/ is not removed with them, and history.jsonl, which holds the prompts you typed, stays until you delete it, except under a HIPAA configuration. Sessions started in Claude Desktop or Cowork follow their own rule.

How do you keep sessions longer?

Set cleanupPeriodDays in ~/.claude/settings.json:

{
  "cleanupPeriodDays": 365
}

The value is a whole number of days with a minimum of 1. Setting 0 fails validation, so the documentation suggests a large value such as 3650 for long retention. If your organization sets this key in managed settings, its value takes precedence over yours.

A longer period protects only what is still on disk. To keep a copy elsewhere, a SessionEnd hook can archive the file at the transcript_path it receives.

How do you reopen an old session?

CommandWhat it does
claude --continueReopens the most recent session in the current directory
claude --resumeOpens the session picker
claude --resume <name>Resumes a named session directly
/resumeSwitches session from inside a running one
/exportCopies the conversation or saves it as a plain-text file

The picker starts with sessions from the current worktree. Ctrl+A widens it to every project on the machine, and typing filters the list. Sessions created with claude -p or the Agent SDK are left out, though claude --resume <session-id> still opens them. To make a session easier to find, name it with claude -n <name> at startup or /rename <name> during the session.

Does a new session remember the old ones?

No. Each new session starts with a fresh context window, without the conversation history of earlier sessions. What carries over is what was written down: CLAUDE.md files and auto memory, which the Claude Code memory guide covers.

Resuming is different, because it reopens the same conversation. If the session was compacted, Claude continues from the last summary and the messages after it; the messages that summary replaced are not loaded again.

What ends up in these files, and how do you remove it?

Transcripts are not encrypted, and operating system file permissions are their only protection. Anything that passes through a tool is written to disk, so if Claude reads a .env file or a command prints a credential, the value is in the transcript. The documentation lists these ways to reduce exposure:

  • Lower cleanupPeriodDays so that files are kept for less time.
  • Set the CLAUDE_CODE_SKIP_PROMPT_HISTORY environment variable to stop writing transcripts and prompt history.
  • Pass --no-session-persistence to a single claude -p run.
  • Use permission rules to deny reads of credential files.

To delete everything Claude Code holds for one project, including its transcripts and auto memory, use claude purge. The --dry-run flag shows the plan without deleting anything. The command requires v2.1.288 or later; earlier versions call it claude project purge.

claude purge ~/work/my-repo --dry-run

Sources, checked on

Where Coredence fits

These files record how you work, including each time you corrected Claude, and they are deleted on a timer. Coredence reads them and stores your own messages, with secrets masked, in a database on your machine, so those messages remain after Claude Code deletes the original file. It then consolidates them into memories that reach Claude Code as a skill, loaded in every session.

This is not a backup of your sessions. Coredence does not store Claude's replies or tool output, it cannot reopen a conversation, and it cannot read a session that was deleted before it was installed. Because it reads the same internal format, a change in Claude Code can also require a Coredence update.

Coredence runs on macOS 14 or later (Apple silicon) and Windows 10 or later, with no Coredence account. Consolidation needs a model, and you choose it: your Claude Code subscription, your own API key, or a local model through Ollama. On those paths Coredence itself is free to use. It is not open source, and its own paid plans are not on sale yet.

Try it in your browser