A beautiful terminal-based tool for browsing and searching your Claude Code chat histories.
- ๐ List all conversations with summary, date, message count, and branch info
- ๐ Search by summary, first prompt, or branch name
- ๐ Deep grep through all message content
- ๐๏ธ View full conversations with formatted messages
- ๐ Statistics about your chat history
- ๐จ Beautiful terminal UI using the
richlibrary - ๐๏ธ Filter by date range or branch
# Install the rich library for beautiful output
pip install richIf you don't have rich installed, the tool will still work with basic text output.
The tool uses wide tables for better readability. For best results, use a terminal width of at least 150 characters. If your terminal is narrower, some columns may be hidden. You can force a wider display by setting the COLUMNS environment variable:
# Force wide output (recommended)
COLUMNS=200 ./claude-history-browser.py list
# Or set it for all commands
export COLUMNS=200chmod +x claude-history-browser.pyYou can add an alias to your .bashrc or .zshrc:
alias claude-history='/path/to/claude-code-history/claude-history-browser.py'Or simply source the aliases file:
source /path/to/claude-code-history/claude-history-aliases.sh# List all conversations (sorted by date, newest first)
./claude-history-browser.py list
# Show only 10 most recent
./claude-history-browser.py list --limit 10
# Filter by branch
./claude-history-browser.py list --branch feature/my-branch
# Filter by date range
./claude-history-browser.py list --since 2026-01-20
./claude-history-browser.py list --until 2026-01-21# Search for conversations about CompilerConfig
./claude-history-browser.py search "CompilerConfig"
# Search for test-related conversations
./claude-history-browser.py search "test"
# Limit results
./claude-history-browser.py search "BFP8" --limit 5# Search through all message content
./claude-history-browser.py grep "pytest"
# Case-sensitive search
./claude-history-browser.py grep "CompilerConfig" --case-sensitive
# Limit results
./claude-history-browser.py grep "YAML" --limit 3# View by session number (from list command)
./claude-history-browser.py view 1
# View by session ID
./claude-history-browser.py view 81b9f767-88c1-4e70-9d90-4cc77c92b4f7# Show statistics about your chat history
./claude-history-browser.py stats# 1. List recent conversations
./claude-history-browser.py list --limit 10
# 2. Search for something specific
./claude-history-browser.py search "CompilerConfig"
# 3. View the details of conversation #3
./claude-history-browser.py view 3
# 4. Deep search through all content
./claude-history-browser.py grep "test_models.py" Claude Code Sessions
โญโโโโฌโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ # โ Date โ Summary โ Messages โ Branch โ
โโโโโผโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1 โ 2026-01-22 ... โ vLLM version control and v0.13.0 upgrade ... โ 8 โ feature/qwen3_embe... โ
โ 2 โ 2026-01-22 ... โ TTNN RMS Norm L1 Memory Overflow Debugging โ 4 โ feature/qwen3_embe... โ
โ 3 โ 2026-01-22 ... โ Fix JAX BFP8 training with nested jit ... โ 15 โ feature/bfp8_model... โ
โฐโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Total sessions: 15
Shows a beautiful panel with:
- Session metadata (summary, dates, branch, message count)
- All messages with role (user/assistant), timestamp, and content
- Syntax highlighting and formatted output
Shows:
- Which sessions contain your search term
- Number of matches per session
- Preview of the matching content
The tool reads from ~/.claude/ directory where Claude Code stores all chat histories:
- Sessions are stored in
~/.claude/projects/ - Each project has a
sessions-index.jsonwith metadata - Individual conversations are in
.jsonlfiles (JSON Lines format)
- Use grep for code/function searches: If you remember discussing a specific function or file, use
grepinstead ofsearch - Use search for topic searches: If you remember the topic but not exact terms, use
search - Pipe to less for long outputs:
./claude-history-browser.py view 1 | less - Combine with shell tools:
./claude-history-browser.py list | grep qwen
Install with: pip install rich
The tool will still work without it, just with basic text output.
Make sure Claude Code has been run at least once in your project directory.
Make the script executable: chmod +x claude-history-browser.py
Potential additions:
- Interactive mode with arrow key navigation
- Export conversations to Markdown/HTML
- Filter by message count range
- Search with regex patterns
- Tag/favorite system
- Delete old conversations
Feel free to extend this tool! The code is well-structured with separate classes for:
ClaudeHistoryBrowser: Core functionalityRichDisplay: Rich library UIBasicDisplay: Fallback text UI
Enjoy browsing your Claude Code history! ๐