Skip to main content

CLI tool to explore Claude Code conversation history

Project description

Claude History Explorer

CI

A Python CLI tool to explore, search and visualise your Claude Code conversation history. The history is stored locally at ~/.claude/projects/ and this tool turns raw JSONL files into searchable conversations and insights about your coding journey.

Highlights

  • Story Generation - Analyzes sessions to create narratives about work patterns, personality traits, and collaboration style
  • Concurrent Claude Detection - Identifies when you've used multiple Claude instances in parallel
  • Rich Terminal UI - Tables, panels, sparklines, and syntax highlighting
  • Multiple Export Formats - JSON, Markdown, plain text
  • Regex Search - Search across conversations with Python regex plus a basic ReDoS safety guard
  • Read-Only by Design - Never modifies your Claude history files (why trust this?)
  • Streaming JSONL - Line-by-line parsing handles large files efficiently

Example Output

📖 Keyboardia Project Story
============================

📅 3 days of development
🤝 heavy delegation (16 agents, 2 main sessions)
⚡ 1873 messages at 25.0 msgs/hour
🎯 steady, productive flow with marathon sessions
🎭 agent-driven, deep-work focused, high-intensity
🔀 Used up to 3 Claude instances in parallel

💡 Key insight: Most productive session: 1530 messages

Installation

Using uv (recommended):

# Install directly
uv tool install .

# Or run without installing
uv run claude-history --help

Using pip:

pip install .

Usage

Tip: Every command supports --example to show usage examples: claude-history search --example

projects

List all Claude Code projects sorted by last use.

claude-history projects
claude-history projects -n 10        # Limit to 10 projects
Option Description
-n, --limit Maximum projects to show (default: 20)

sessions

List sessions for a project. Search is a partial match on project path.

claude-history sessions myproject
claude-history sessions "Documents/work" -n 5
Option Description
-n, --limit Maximum sessions to show (default: 20)
--head Show most recent sessions (default)
-t, --tail Show oldest sessions

show

Display messages from a session. Session ID can be a partial match.

claude-history show e5c477f0
claude-history show e5c477f0 -n 100
claude-history show e5c477f0 --raw
claude-history show e5c477f0 -p myproject
Option Description
-p, --project Limit search to specific project
-n, --limit Maximum messages to show (default: 50)
--head Show first messages (default)
-t, --tail Show last messages
--raw Output raw JSON

search

Search for a regex pattern across all conversations.

claude-history search "TODO"
claude-history search "error.*fix"
claude-history search "bug" -p myproject
claude-history search "API" -c
claude-history search "function" -C 200
Option Description
-p, --project Limit search to specific project
-c, --case-sensitive Case-sensitive search
-n, --limit Maximum results to show (default: 20)
-C, --context Characters of context around match (default: 100)

export

Export a session to JSON, Markdown, or plain text.

claude-history export e5c477f0 -f markdown -o session.md
claude-history export e5c477f0 -f json -o session.json
claude-history export e5c477f0 -f text
claude-history export e5c477f0 -p myproject -f json
Option Description
-p, --project Limit search to specific project
-f, --format Output format: json, markdown, text (default: markdown)
-o, --output Output file (default: stdout)

info

Show Claude Code storage location and usage statistics.

claude-history info

stats

Show detailed statistics including message counts, duration, storage size, and agent usage.

claude-history stats
claude-history stats -p myproject
claude-history stats -f json
Option Description
-p, --project Show stats for specific project only
-f, --format Output format: table, json (default: table)
--show-worktype Include work type classification

summary

Generate a comprehensive summary with insights and charts.

claude-history summary
claude-history summary -p myproject
claude-history summary -f markdown -o report.md
Option Description
-p, --project Generate summary for specific project
-f, --format Output format: text, markdown (default: text)
-o, --output Output file (default: stdout)
--show-worktype Include work type distribution

story

Tell the story of your development journey with personality insights and patterns.

claude-history story
claude-history story -p myproject
claude-history story -f brief
claude-history story -f timeline -o journey.md
Option Description
-p, --project Tell story for specific project
-f, --format Story format: brief, detailed, timeline (default: detailed)
-o, --output Output file (default: stdout)

Generates narrative insights including project lifecycle, collaboration style, work intensity, personality traits, and timeline visualization with sparklines.

wrapped

Generate a shareable Wrapped URL containing your year's aggregate stats. The CLI encodes data into the URL and makes no network calls; the website decodes the URL to render it and uses no-store responses.

claude-history wrapped
claude-history wrapped -y 2024
claude-history wrapped -n "Your Name"
claude-history wrapped --raw
claude-history wrapped --decode "https://..."
Option Description
-y, --year Year to generate wrapped for (default: current year)
-n, --name Display name to show on wrapped cards
--raw Output raw JSON instead of URL
--no-copy Don't copy URL to clipboard
-d, --decode Decode and display a Wrapped URL

How Claude Code Stores History

Claude Code stores conversation history in:

~/.claude/projects/
├── -Users-username-path-to-project1/
│   ├── session-id-1.jsonl
│   ├── session-id-2.jsonl
│   └── agent-xyz.jsonl
├── -Users-username-path-to-project2/
│   └── ...
  • Project directories are named with an encoded filesystem path. Unix paths look like -Users-username-path-to-project, Windows drive paths like C--Users-username-path-to-project, and UNC paths like --server-share-project.
  • Decoding is ambiguity-aware: when possible, the tool probes existing filesystem components to preserve dots, spaces, underscores, and hyphenated names.
  • Each .jsonl file is a conversation session
  • Files prefixed with agent- are sub-agent conversations
  • Each line in a JSONL file is a JSON object representing a message or event

Development

# Clone and install in dev mode
git clone <repo>
cd claude-history-explorer
uv sync

# Install Wrapped website dependencies first so Python↔TypeScript bridge tests run
cd wrapped-website
npm ci
cd ..

# Run Python tests/lint
uv run --locked pytest -q
uv run --locked ruff check .

# Run privacy-preserving smoke test against your local Claude corpus
uv run --locked python scripts/smoketest_local_corpus.py

# Run Wrapped website tests/typecheck/lint/audit
cd wrapped-website
npm test
npm run typecheck
npm run lint
npm audit --omit=dev
npm audit
cd ..

# Run the CLI
uv run claude-history --help

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_history_explorer-0.2.1.tar.gz (231.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_history_explorer-0.2.1-py3-none-any.whl (52.7 kB view details)

Uploaded Python 3

File details

Details for the file claude_history_explorer-0.2.1.tar.gz.

File metadata

  • Download URL: claude_history_explorer-0.2.1.tar.gz
  • Upload date:
  • Size: 231.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for claude_history_explorer-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1110b4199a355cf9cd078e630e93e2b237b2cc085888388d479d25bc23177978
MD5 4eab24ec0932155b470afa5581ea746d
BLAKE2b-256 6beee11a6697d8e4c81cec6f0a1d9e0e0b1de8988a05e125beb1024e22428d1f

See more details on using hashes here.

File details

Details for the file claude_history_explorer-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: claude_history_explorer-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 52.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for claude_history_explorer-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 834f084234d97c3fea9519fa01850b425745a812d2f5b985b15c88b111d04e42
MD5 5e3bb6c59523a034811acdad63476ae6
BLAKE2b-256 0ed81192be9d1f2a070b90cfb4a8b81c989f206dc18495bc1bd038b665e0afcc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page