Claude Code keeps plaintext transcripts of everything it touched in a project, including file contents and command output. When a project is done, or a secret ended up in a session, you may want all of it gone. One command does that.
claude purge ~/work/my-repo --dry-run
The path is a placeholder for your own project. The command deletes the 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. With --dry-run it prints the plan and deletes nothing.
Drop the flag to run it for real:
claude purge ~/work/my-repo
It prints the same plan and asks for a y before removing anything. Leave out the path to pick a project from an interactive list. --yes skips the question for scripts, -i confirms item by item, and --all purges every project and deletes history.jsonl outright.
The caveats matter here. It does not touch shell-snapshots/ or backups/, because those aren’t project-scoped, and it warns about them in the plan. Images you pasted and each session’s scratchpad live under the temp directory, so the purge leaves them alone too. Heap snapshots written by /heapdump also stay until you delete them by hand. If no state matches the path, the command prints an error and exits with status 1.
Before v2.1.288 the command was called claude project purge.
I’d always do the dry run first. The plan lists every item it would delete and why.
Further reading: Claude Code docs: clear local data