| name | chat-history |
| description | Search, inspect, and export Claude Code, Cursor, and Codex conversation history. Use when the user asks about past conversations, wants to find a previous session, needs to search chat history, wants a summary of what they worked on, or asks to resume a session. Also use when the user says "what did I work on", "find that conversation where I...", "show me my recent sessions", or "search my history for...". |
chat-history
Repo: https://github.com/ay-bh/chat-history
Install
cargo install chat-history
This installs both chat-history and ch (short alias) into ~/.cargo/bin/.
When to use
- User asks about past conversations or sessions
- User wants to find something they discussed before
- User needs a summary of recent work / accomplishments
- User wants to search across Claude Code, Cursor, or Codex history
- User wants to resume or export a previous session
Commands
chat-history
chat-history --from yesterday -s
chat-history --from "3 days ago"
chat-history --source claude
chat-history --source cursor
chat-history --source codex
chat-history -L
chat-history --branch feature-xyz
chat-history -k "auth" -v
chat-history search "auth error" --deep --json
chat-history search "fix" --scope errors --deep
chat-history search "trade" --scope similar
chat-history search <full-uuid>
chat-history inspect --last
chat-history inspect <partial-uuid>
chat-history view --last --plain
chat-history view <id> --tools
chat-history export <id> -o session.md
chat-history resume <id>
chat-history find <id>
The short alias ch works identically: ch search "auth", ch inspect --last, etc.
Search behavior
- Always use
--deep --json when calling from an agent for thorough results and structured output.
- Deep search (
--deep): Searches full transcript content across all messages in parallel.
- Snippets show context around the match, not the first N characters of the message.
- JSON output (
--json): Returns structured JSON with session_id, score, snippet, tools, files.
Interpreting output
CC = Claude Code session, CR = Cursor session, CX = Codex session
- Score (
★ N.N) = relevance score (higher = better match)
[summary], [first_prompt], [branch] = which field matched in index search
inspect shows: duration, message count, model name, token count, tools used, files touched, accomplishments, key decisions
- Claude Code titles come from modern
ai-title / custom-title JSONL records when available
- Cursor subagent transcripts under
agent-transcripts/*/subagents/ are hidden by default; pass --sidechains to list them (tagged [subagent])
- Codex commentary-phase assistant messages are hidden for turns that reached a final answer; interrupted turns keep their commentary
- Codex sessions are read from
$CODEX_HOME/sessions/YYYY/MM/DD/rollout-*.jsonl (or ~/.codex by default)
Date formats accepted
YYYY-MM-DD, today, yesterday, "3 days ago", "last week", "last month"