Browse and search Claude Code session history from the command line.
go install github.com/a2d2-dev/cc-history/cmd/cc-history@latestOr build from source:
git clone https://github.com/a2d2-dev/cc-history.git
cd cc-history
go build -o cc-history ./cmd/cc-historycc-historyScans ~/.claude/projects/ and prints all JSONL session file paths.
cc-history --path /custom/sessions/dirUse a custom session directory.
Export the current session as Markdown:
cc-history export
cc-history export --format markdownExport as JSON:
cc-history export --format jsonExport a specific session by ID:
cc-history export --session <session-id> --format markdown
cc-history export --session <session-id> --format jsonWrite to a file using shell redirection:
cc-history export --format markdown > session.md
cc-history export --session abc123 --format json > session.jsonMarkdown output includes:
- Timestamps for each message
- User and assistant message text
- Tool call names, arguments (pretty-printed JSON), and results
JSON output mirrors the internal data model exactly — suitable for programmatic processing.
Session detection (when --session is omitted):
- If
CLAUDE_SESSION_IDis set, that session is used. - Otherwise, the most recently modified session file is used.
| Flag | Default | Description |
|---|---|---|
--path |
~/.claude/projects |
Session directory |
--version |
— | Print version and exit |
| Flag | Default | Description |
|---|---|---|
--session |
current session | Session ID to export |
--format |
markdown |
Output format: markdown or json |
Each Claude Code session has a UUID. You can find it:
- In the JSONL filename under
~/.claude/projects/ - Via the
CLAUDE_SESSION_IDenvironment variable (set automatically by Claude Code) - In the first line of any session JSONL file (
sessionIdfield)