How to Delete Claude Code Session History
Claude Code keeps a full transcript of every session on your machine, in plaintext.
That is what makes --resume work, and it is also why people go looking for a
way to clear it: a laptop being handed over, a repository that should not leave a trace, or
simply years of accumulated JSONL nobody needs. There is a supported command for this, an
automatic sweep you may already be relying on, and a short list of files you should not
touch. Here is all three.
Different tool, different history. This page is about Claude Code, the CLI you run in a terminal. Deleting these files does nothing to the conversations in your claude.ai chat list, which live in your account rather than on your disk — for those, see how to delete all Claude chats.
What already gets deleted without you
Before deleting anything by hand, know that a sweep is running. Anthropic documents that
files under the application-data paths “are deleted on startup once they’re
older than cleanupPeriodDays,” and that
the default is 30 days.
That covers, among others:
projects/<project>/<session>.jsonl— the full conversation transcripts.projects/<project>/<session>/subagents/— subagent transcripts, removed with the parent.projects/<project>/<session>/tool-results/— large tool outputs spilled to their own files.file-history/<session>/— pre-edit snapshots used for checkpoint restore.paste-cache/,image-cache/— contents of large pastes and attached images.
Lowering cleanupPeriodDays in your settings is the least effort way to keep
history short-lived; Anthropic lists it first among the ways to reduce exposure. The
minimum is 1, and 0 fails with a validation error.
The gap worth knowing: ~/.claude/history.jsonl — “every prompt
you’ve typed, with timestamp and project path” — sits in the
“kept until you delete them” group and is not swept by age.
The one-command way: claude project purge
For a single project, Anthropic ships a purge command (documented as requiring Claude Code
v2.1.124 or later). Per the
Clear local data
documentation it deletes transcripts and auto memory under projects/, the
per-session tasks/, debug/ and file-history/
entries, the matching prompt lines in history.jsonl, and the project’s
entry in ~/.claude.json.
Preview first — this changes nothing:
claude project purge ~/work/my-repo --dry-run
The plan lists each matching item and why it is included, then, without
--dry-run, asks for a single confirmation before deleting. Useful variants:
claude project purgewith no path — pick a project from an interactive list.--yes— skip the confirmation prompt, for scripts.-i— step through the deletion plan one item at a time.--all— purge state for every project at once, which deleteshistory.jsonloutright rather than filtering it.
Two things it deliberately leaves alone, and warns about in the plan output:
shell-snapshots/ and backups/, because neither is project-scoped.
backups/ can still contain the project’s entry in old
.claude.json snapshots; at most five are kept and they rotate out.
Deleting by hand, and what it costs you
Anthropic states you can delete any of the application-data paths manually and that new sessions are unaffected. What you give up for past sessions:
~/.claude/projects/— resume, continue, and rewind for past sessions (and auto memory).~/.claude/history.jsonl— up-arrow prompt recall.~/.claude/file-history/— checkpoint restore for past sessions.~/.claude/stats-cache.json— the historical totals shown by/usage.-
debug/,plans/,paste-cache/,image-cache/,session-env/,tasks/,shell-snapshots/,backups/— nothing user-facing.
Do not delete these. Anthropic is explicit:
~/.claude.json, ~/.claude/settings.json, and
~/.claude/plugins/ hold your auth, preferences, and installed plugins.
Removing them logs you out and wipes your configuration; it does not make you more private.
Not writing the history in the first place
If the goal is that nothing hits the disk at all rather than cleaning up afterwards, Anthropic documents the switches for it:
-
CLAUDE_CODE_SKIP_PROMPT_HISTORY— an environment variable that skips writing transcripts and prompt history in any mode. -
--no-session-persistence— print mode only; “sessions are not saved to disk and cannot be resumed.” Pass it alongside-p. -
persistSession: false— the Agent SDK equivalent. - Permission rules that deny reads of credential files, so secrets never enter a transcript to begin with.
The trade-off is exactly what you would expect: no transcript means nothing for
--continue or --resume to reopen. See
where Claude Code stores chat history
for what those files buy you before you switch them off.
Local deletion is not server-side deletion
Worth being precise about, because the two are easy to conflate. Anthropic describes the
on-disk copies as local caching: Claude Code clients “store session transcripts
locally in plaintext under ~/.claude/projects/ for 30 days by default to
enable session resumption.” Server-side retention is a separate matter, set by
account type and data-use preference, and documented on Anthropic’s
data usage
page. Deleting a .jsonl file on your laptop does not reach into that; check
the terms that apply to your own account rather than assuming.
If it was actually claude.ai you wanted to clean up
A lot of people arrive at this question from the browser side. That history is not on your disk: it lives in your claude.ai account, and claude.ai has a built-in multi-select — open Chats, tick conversations, click Delete Selected. What it does not have is a select-all, a filter to select by, or a way to leave a long run unattended, so a few hundred conversations still means a few hundred manual ticks.
Folders & Bulk Delete Chats for Claude is our Chrome
extension that adds those missing parts on top of claude.ai — select all, filter by title,
then delete in one paced, cancellable batch. It works only in the browser on claude.ai; it
has nothing to do with the Claude Code CLI and does not touch anything in
~/.claude.
Folders, pins, search, and single delete are free. Bulk delete is part of Pro ($19/year or $12 lifetime — launch price, regularly $39). Unofficial; not affiliated with Anthropic.
FAQ
Is there a command to delete Claude Code history?
Yes. claude project purge deletes the local state Claude Code holds for one
project: transcripts and auto memory under projects/, the per-session
tasks/, debug/ and file-history/ entries, the
matching prompt lines in history.jsonl, and the project’s entry in
~/.claude.json. Anthropic documents it as requiring Claude Code v2.1.124 or
later. It prints the full deletion plan and asks for confirmation before removing anything.
Does Claude Code delete old sessions on its own?
It does. Files under the documented application-data paths are deleted at startup once
they are older than cleanupPeriodDays, and the default is 30 days. One
notable exception: history.jsonl, the record of every prompt you have typed,
is in the “kept until you delete them” group and persists indefinitely.
Is it safe to delete ~/.claude/projects/ manually?
Anthropic says you can delete any of the application-data paths by hand and that new
sessions are unaffected. Deleting ~/.claude/projects/ costs you resume,
continue, and rewind for past sessions, and it also removes auto memory. What you must not
delete is ~/.claude.json, ~/.claude/settings.json, or
~/.claude/plugins/ — those hold your auth, preferences, and installed plugins.
Does deleting local files remove my data from Anthropic's servers?
No. The files under ~/.claude are described by Anthropic as local caching to
enable session resumption; server-side retention is a separate policy that depends on your
account type and data-use preference. Deleting a transcript on your disk does not reach
back into that. Check Anthropic's data usage page and Privacy Center for the terms that
apply to your account.
How do I stop Claude Code from writing transcripts at all?
Anthropic documents the CLAUDE_CODE_SKIP_PROMPT_HISTORY environment variable
to skip writing transcripts and prompt history in any mode. In non-interactive mode you
can instead pass --no-session-persistence alongside -p, or set
persistSession: false in the Agent SDK. The trade-off is real: without a
transcript on disk there is nothing for --continue or --resume
to reopen.
Related guides
- Where does Claude Code store chat history? — the paths, the folder naming, and how to resume a session.
- How to delete all Claude chats — the browser side, where most cleanup questions actually belong.
- Does Claude really delete your chats? — what Anthropic commits to after you hit Delete on claude.ai.
- Delete files and images from Claude chats — when the attachment, not the chat, is the problem.