Skip to content
← All guides

Claude Code history and logs: where sessions live on Mac

Where Claude Code stores session transcripts, prompt history and debug logs on your Mac, how to find and resume a session, and how to set retention.

4 min read

Claude Code saves each session as a JSONL transcript at ~/.claude/projects/<project>/<session-id>.jsonl. The prompts you typed go to ~/.claude/history.jsonl. Debug logs go to ~/.claude/debug/ while debug logging is on. Transcripts are deleted after 30 days by default, and you change that with cleanupPeriodDays. All of it is plaintext.

What is stored and where

<project> is your working directory path with non-alphanumeric characters replaced by -, so /Users/you/my-project becomes -Users-you-my-project. Very long names are truncated and given a hash.

Path under ~/.claude/ContentsRetention
projects/<project>/<session>.jsonlMessages, tool calls and results, plus the system prompt, tool definitions and request parametersSwept after cleanupPeriodDays
projects/<project>/<session>/subagents/Subagent transcriptsRemoved with the parent
projects/<project>/<session>/tool-results/Large tool outputsSwept after cleanupPeriodDays
file-history/<session>/Pre-edit snapshots for checkpoint restoreSwept after cleanupPeriodDays
debug/Per-session debug logs, only while debug logging is onSwept after cleanupPeriodDays
history.jsonlPrompts you typed, with timestamp and project pathKept until you delete it

Each transcript line is a JSON object. The sessions page says the entry format is internal and changes between versions, so a script that parses these files can break on any release. It recommends /export or claude -p --output-format json for stable data.

If you set CLAUDE_CONFIG_DIR, every ~/.claude path above lives under that directory instead.

Find and resume a session

CommandWhat it does
claude --continueReopens the most recent session in the current directory
claude --resumeOpens the session picker
claude --resume <name> or <session-id>Resumes that session directly
/resumeSwitches session from inside Claude Code

In the picker, Ctrl+A widens to every project on the machine, Ctrl+W to all worktrees and Ctrl+B filters to the current git branch. Typing searches. Space previews a session. Name sessions with claude -n <name> or /rename so you can find them later. Sessions from claude -p, the Agent SDK and /loop stay out of the picker, but you can resume one by ID. To read a past session by hand, open its .jsonl file or run /export in a live session.

Check what happened afterward

Use the transcript to compare the tool call with its result. Start from the session ID, project folder and timestamp. Debug logs are separate. Start with claude --debug, or --debug-file <path> to write them to a file you choose. The installed help for Claude Code 2.1.322 lists both flags. Read a session by hand

Retention and cleanup settings

  • cleanupPeriodDays in settings sets how many days transcripts are kept. The default is 30 and the minimum is 1. Setting 0 fails validation.
  • desktopSessionCleanupPeriodDays gives Claude Desktop and Cowork transcripts an age limit. Without it, those transcripts are kept at any age.
  • CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 skips writing prompt history and transcripts. Those sessions do not appear in --resume.
  • claude -p --no-session-persistence skips writing for one non-interactive run.
  • claude purge [path] deletes one project’s transcripts, memory, tasks, file history, matching history.jsonl lines and its entry in ~/.claude.json. Add --dry-run first to see the plan. --all purges every project.

The docs warn that a transcript can hold anything that passed through a tool, including a .env file the agent read or a credential a command printed. Lower cleanupPeriodDays to shorten exposure, and deny reads of credential files. Keys and logs guide · Environment variables

Checked against the vendor documentation on November 25, 2026. Claude directory · Manage sessions · Data usage

Reading these logs with Excellent

Excellent’s free scan reads supported logs on the Mac and reports findings for review. Claude Code’s session logs are among them, along with Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code. For a local report without installing an app, run the free scan. Its script uses Python 3.9 or later when your Mac has it and the shell when it doesn’t, reads the logs locally and makes no network requests. See a sample report.

The Mac app runs on Apple silicon with macOS 14 or later. Manual scanning is free and needs no account. Check what your AI agents did

Related guides

View all