"This is the best thing ever thanks for this project." — @andrewle8
claude-history is a companion CLI for Claude Code. It lets you search recent
conversations recorded in Claude's local project history with a built-in
terminal UI, then view the selected transcript directly in the terminal with
scrolling, search, and export capabilities.
Run it from the project directory you work on with Claude Code and it will discover the matching transcript folder automatically.
Install · Features · Usage · Configuration · Changelog
- Fuzzy search across all conversations with field-aware relevance scoring, prefix matching, word boundary awareness, and tool output indexing
- Conversation viewer with vim-style scrolling, in-viewer search, message navigation, and markdown rendering
- Resume and fork conversations directly from the TUI with configurable keybindings
- Cross-project fork — fork a conversation from any project into your current working directory, useful when working across git worktrees
- Worktree-aware project filtering for workmux users
- Export and copy conversations or individual messages to clipboard
- Configurable display options, keybindings, and default resume arguments
curl -fsSL https://raw.githubusercontent.com/raine/claude-history/main/scripts/install.sh | bashbrew install raine/claude-history/claude-historycargo install claude-historyclaude-history updateHomebrew users should use brew upgrade claude-history instead.
Run the tool from inside the project directory you're interested in:
$ claude-historyThis opens a terminal UI listing all conversations, sorted by recency. Type to search across all transcripts. Each item shows a preview of the conversation and match context is highlighted when your search matches content not visible in the preview.
| Key | Action |
|---|---|
↑ / ↓ |
Move selection |
← / → |
Move cursor in search |
Ctrl+P / Ctrl+N |
Move selection (vi-style) |
Ctrl+D / Ctrl+U |
Half page down/up (vim-style) |
Page Up / Page Down |
Jump by page |
Home / End |
Jump to first/last |
Enter |
Open conversation viewer |
Ctrl+O |
Select and exit (for scripting) |
Ctrl+W |
Delete word before cursor |
Ctrl+R |
Resume conversation |
Ctrl+F |
Fork and resume conversation |
Ctrl+X |
Delete conversation |
Tab |
Toggle all / workspace scope |
? |
Show keyboard shortcuts |
Esc |
Clear search input, or quit |
Ctrl+C |
Quit |
| Key | Action |
|---|---|
j / ↓ |
Scroll down |
k / ↑ |
Scroll up |
J / ] |
Jump to next message |
K / [ |
Jump to previous message |
d / Ctrl+D |
Half page down |
u / Ctrl+U |
Half page up |
Page Down |
Full page down |
Page Up |
Full page up |
g / Home |
Jump to top |
G / End |
Jump to bottom |
/ |
Start search |
n |
Next search match |
N |
Previous search match |
t |
Cycle tools: off/truncated/full |
T |
Toggle thinking |
e |
Export conversation to file |
y |
Copy to clipboard (message if selected, else menu) |
p |
Show file path |
Y |
Copy file path to clipboard |
I |
Copy session ID to clipboard |
Ctrl+R |
Resume conversation |
Ctrl+F |
Fork and resume conversation |
Ctrl+X |
Delete conversation |
? |
Show keyboard shortcuts |
q / Esc |
Return to list (or quit in direct file input mode) |
Ctrl+C |
Quit |
Press J/K or [/] to enter message navigation mode. A teal ▌ marker
appears in the gutter showing which message is focused. While in this mode:
J/]— jump to next messageK/[— jump to previous messagey— copy the focused message to clipboard (raw markdown)Esc— exit message navigation mode
Searching with / also activates message navigation, focusing the message
containing each match as you move through results with n/N.
Search uses fuzzy word matching with the following features:
- Case-insensitive: "config" matches "CONFIG"
- Underscore as separator: "api key" matches "API_KEY"
- Prefix matching: "auth" matches "authentication", "authorize"
- Word boundary: matches start at word boundaries, so "red" won't match inside "fired"
- Multi-word AND logic: all query words must match, each word is highlighted individually
- Tool output indexing: search matches content inside tool results (bash output, file contents, grep results, etc.), not just user/assistant text
- UUID lookup: paste a full session UUID (e.g.
e7d318b1-4274-4ee2-a341-e94893b5df49) to jump directly to that session, even if it belongs to a different project
Results are ranked by relevance using field-aware scoring: matches in the title, project name, and summary are weighted higher than body text. Within equally relevant results, recent conversations rank first.
You can open a JSONL conversation file directly, bypassing the conversation selection UI:
$ claude-history /path/to/conversation.jsonlAll display options work in this mode:
$ claude-history --show-tools --show-thinking /path/to/conversation.jsonlPress q or Esc to quit when viewing a file directly.
Press Enter on a conversation to open the built-in viewer. The viewer displays
conversations in a ledger-style format with scrolling support.
Features:
- Scrolling: Navigate with vim-style keys (
j/k) or arrow keys - Search: Press
/to search within the conversation, thenn/Nto navigate matches - Cycle tools: Press
tto cycle tool display (off → truncated → full) - Toggle thinking: Press
Tto show/hide thinking blocks - Show path: Press
pto display the conversation file path - Light/dark theme: Automatically detects terminal background color and applies an appropriate color theme
Press q or Esc to return to the conversation list.
View Claude conversation history
Usage: claude-history [OPTIONS] [FILE]
claude-history [COMMAND]
Commands:
update Update claude-history to the latest version
Arguments:
[FILE] JSONL conversation file to view directly
Options:
-t, --show-tools Show tool calls in the conversation output
--no-tools Hide tool calls from the conversation output
-d, --show-dir Print the conversation directory path and exit
-l, --last Show the last messages in the TUI preview (default)
--first Show the first messages in the TUI preview
--show-thinking Show thinking blocks and subagent internals in the conversation output
--hide-thinking Hide thinking blocks and subagent internals from the conversation output
-c, --resume Resume the selected conversation in Claude Code
--fork-session Fork the session when resuming
-p, --show-path Print the selected conversation file path
-i, --show-id Print the selected conversation session ID
--plain Output plain text without ledger formatting
--delete <SESSION_ID> Delete a session by its UUID and exit
--debug-search <QUERY> Debug search result scoring for a query
--debug [<LEVEL>] Print debug information (optionally filter by level: debug, info, warn, error)
-L, --local Show only conversations from the current workspace directory
--pager Display output through a pager (less)
--no-pager Disable pager output
--render <FILE> Render a JSONL file in ledger format and exit
--no-color Disable colored output
-h, --help Print help
-V, --version Print version
claude-historyshows the last messages in the preview (default)claude-history --firstflips the preview to the first messages
In the TUI viewer, tool calls default to truncated mode — showing the tool
header plus the first few body lines with a "(N more lines...)" indicator. Press
t to cycle through modes: off → truncated → full. Use --show-tools (or -t)
to start in full mode, or --no-tools to start with tools hidden.
Extended thinking models (like Claude Sonnet 4.5) include reasoning steps in
their output. When Claude uses the Task tool to spawn subagents, the internal
tool calls and messages within those subagents are also hidden by default. Use
--show-thinking (or press T in the TUI) to display both thinking blocks and
subagent internals. Subagent messages appear dimmed with a ↳ prefix to
distinguish them from top-level conversation entries.
If you want to continue a conversation, launch claude-history with --resume
and it will hand off to claude --resume <conversation-id>.
To fork a conversation (creating a new session branching from the original), use
--resume --fork-session or press Ctrl+F in the TUI.
Within the same project, this passes --fork-session to claude, which creates
a new session ID branching from the original. When forking a conversation from a
different project, the session files are copied to your CWD's project directory
and resumed there — the copy continues independently without affecting the
original.
You can configure default arguments to pass to the claude command every time
you resume a conversation. This is useful if you typically run Claude with
specific flags (like --dangerously-skip-permissions) and want them applied
automatically when resuming:
# ~/.config/claude-history/config.toml
[resume]
default_args = ["--dangerously-skip-permissions"]With this configuration, when you resume a conversation, it will run:
claude --resume <conversation-id> --dangerously-skip-permissionsThis provides a cleaner alternative to shell aliases, as the arguments are
applied specifically when resuming through claude-history, without affecting
how you normally invoke Claude.
If you use a shell alias for claude with extra flags, you can use --show-id
to select a session and resume it manually:
claude --resume $(claude-history --show-id)In the viewer, press I to copy the session ID to clipboard.
Claude's responses are rendered with markdown formatting for better terminal
readability. Use --plain to disable rendering and get raw text output.
Use --plain to output conversations without ledger formatting:
$ claude-history --plainThis produces simple Role: content output without colors, text wrapping, or
markdown rendering, suitable for piping to other tools or LLMs:
You: How do I fix this bug?
Claude: Looking at the code, the issue is...
By default, conversation output is piped through a pager (less -R) when stdout
is a terminal. This enables scrolling through long conversations. Use
--no-pager to disable this behavior and print directly to stdout.
The pager respects the $PAGER environment variable. If not set, it defaults to
less -R (which preserves ANSI colors).
By default, claude-history shows all conversations from every project, sorted
by modification time (newest first). Each conversation shows its project path so
you can identify which project it belongs to.
Press Tab to toggle between all conversations and the current workspace only.
Use -L/--local to start with the workspace filter active.
For workmux users, worktree paths are
displayed in a compact format: [project/worktree] instead of just the worktree
folder name. The project filter (toggled with Tab) is worktree-aware: it
includes conversations from the main repo and all its worktrees, regardless of
which one you're currently in.
The --resume flag works across projects. It will automatically run Claude in
the correct project directory for the selected conversation.
You can integrate claude-history into other tools to pass conversation context
to new Claude Code sessions. This is useful when you want Claude to understand
what you were working on previously.
For example, a commit message generator script could use the conversation history to write more contextual commit messages:
# Get conversation history if --context flag is set
conversation_context=""
if [ "$include_history" = true ]; then
echo "Loading conversation history..."
conversation_history=$(claude-history --plain 2>/dev/null)
if [ -n "$conversation_history" ]; then
conversation_context="
=== START CONVERSATION CONTEXT ===
$conversation_history
=== END CONVERSATION CONTEXT ===
"
fi
fi
# Pass to Claude CLI with the conversation context
prompt="Write a commit message for these changes.
${conversation_context}
Staged changes:
$staged_diff"
claude -p "$prompt"You can set default preferences for display options in
~/.config/claude-history/config.toml. Command-line flags will override these
settings.
Create the config file:
mkdir -p ~/.config/claude-history
cat > ~/.config/claude-history/config.toml << 'EOF'
[display]
# Tool display: true = hidden, false = full (default: unset = truncated)
# no_tools = false
# Show last messages in TUI preview (default: true)
# last = true
# Show thinking blocks (default: false)
show_thinking = false
# Use plain output without ledger formatting (default: false)
plain = false
# Use pager for output (default: true when stdout is a terminal)
pager = true
[resume]
# Default arguments to pass to claude command when resuming
# Example: default_args = ["--dangerously-skip-permissions"]
[keys]
# Customize keybindings (default: ctrl+r, ctrl+f, ctrl+x)
# Supports ctrl+<key> and alt+<key> combinations
# fork = "alt+f"
EOFno_tools(boolean): Whentrue, hides tool calls; whenfalse, shows them in full. When unset (default), tools display in truncated modelast(boolean): Show last messages instead of first in TUI preview (default: true)show_thinking(boolean): Show thinking blocks and subagent internals in conversation output (default: false)plain(boolean): Output plain text without ledger formatting (default: false)pager(boolean): Pipe output through a pager for scrolling (default: true when stdout is a terminal)
default_args(array of strings): Arguments to pass to theclaudecommand when resuming conversations. Useful for flags like--dangerously-skip-permissionsthat you want applied every time you resume. Example:default_args = ["--dangerously-skip-permissions", "--verbose"]
Customize the keybindings for resume, fork, and delete actions. Values are key
combinations like "ctrl+r" or "alt+f". Only single-character keys with
ctrl+ or alt+ modifiers are supported.
resume(string): Resume conversation (default:"ctrl+r")fork(string): Fork and resume conversation (default:"ctrl+f")delete(string): Delete conversation (default:"ctrl+x")
Each display option has opposing flags for explicit override:
--no-tools/--show-tools--last/--first--hide-thinking/--show-thinking--plain(no opposite flag)--no-pager/--pager
For example, if your config has no_tools = false (showing tools), you can
temporarily hide them with --no-tools.
The tool filters out some noisy artifacts before showing conversations, so you only see transcripts that are likely to matter for your recent work.
- Skips the "Warmup / I'm Claude Code…" exchanges that are sometimes injected without user interaction
- Skips conversations that only contain the
/clearterminal command
The repository includes just recipes:
$ just checkThis runs cargo fmt, cargo clippy --fix, and cargo build in parallel.
- workmux — Git worktrees + tmux windows for parallel AI agent workflows
- git-surgeon — Non-interactive hunk-level git staging for AI agents
- consult-llm-mcp — MCP server that lets Claude Code consult stronger AI models (o3, Gemini, GPT-5.1 Codex)
- tmux-file-picker — Pop up fzf in tmux to quickly insert file paths, perfect for AI coding assistants
