How to Search Your Claude Code Conversation History
DEV Community

How to Search Your Claude Code Conversation History

Claude Code saves every conversation as JSONL under ~/.claude/projects/. Codex groups them by date under ~/.codex/sessions/. The full record is on your disk - your prompts, the agent's reasoning, every tool call. The problem isn't storage. It's retrieval.

What you can do today

Claude Code's --resume flag opens a session picker. You can scroll through recent sessions and select one to continue. It works when you remember roughly when the conversation happened and can recognize it in a list. It doesn't search content.

If you're looking for "that conversation where we discussed the migration" and it happened across three sessions over two days, --resume won't find it by topic.

The common workaround is grep:

grep -r "migration" ~/.claude/projects/

This works, technically. It also returns raw JSONL with tool-call metadata, system prompts, base64-encoded images, and content blocks nested several levels deep. Finding the actual conversation inside that output is its own project.

There are third-party tools that index these files - CLI searchers, desktop apps, VS Code extensions. They're useful, but they all live outside the terminal where the conversations happened. The conversations are on your disk. The search isn't.

What if search lived where you work?

PonyMux 0.10 added full-text search across your Claude Code and Codex conversation history, built into the same Cmd+K search you already use to find Terminals. Press Cmd+K, type a keyword, and results appear in two layers:

  • Layer 1 matches Terminal names and metadata - the same search from 0.9.
  • Layer 2 searches conversation content: every prompt you've typed, every response the agent gave, every tool it used.

Both layers share one search bar and one set of scope pills. The Transcripts pill filters to just conversation matches. Each result shows the session title, a matched snippet, the agent type, and when it was last active. Select one and the right side shows the matched messages with your search terms highlighted.

How the index works

The first time you launch 0.10, PonyMux builds a full-text index from your transcript files. It takes around 10-30 seconds depending on how many conversations you have. After that, new conversations are picked up within seconds via filesystem events.

The index uses FTS5 with trigram tokenization, which means it handles substring matches and CJK text without special configuration. A search for "migrat" finds "migration", "migrating", and "migrate". Chinese and Japanese terms match the same way.

The index is a separate SQLite database (search.db). It doesn't touch your metadata or your Terminals - you can rebuild it, pause it, or turn it off entirely from Settings → Advanced without affecting anything else.

What changes about ended Terminals

Before 0.10, selecting a sleeping Terminal showed a static screen capture - a frozen frame of whatever the terminal surface looked like when the process exited. It told you what was on screen, but not what the agent was thinking or what you'd asked it to do.

Now it shows the last conversation. The actual messages - your prompt, the agent's response, the tools it called - rendered directly in the Terminal area. You can read the exchange, decide whether to resume, and choose Resume or Shell Only.

A screenshot of a terminal says "the cursor was here." A conversation says "here's what we were working on and here's where we stopped."

Resume finds the right session

When you find a Terminal through search and hit Resume, PonyMux targets the matched session, not the most recent one. If search found a conversation from three days ago, that's what resumes. A banner at the top shows the session name and date so you're never guessing which conversation you're about to continue.

The state of agent conversation search

This is still early. Claude Code deletes transcripts older than 30 days by default, so the search window has a built-in limit. Codex compresses older files to .zst, which PonyMux can't index. And the index itself is local - there's no cloud sync or cross-machine search.

But for the conversations that are on your disk right now, having them searchable from the same place you run your agents changes the daily workflow more than I expected. I stopped grep-ing JSONL files on day two.

For the full details - scopes, ranking, index management - see the Search docs.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.