Session health
Search old Claude Code conversations: picker, grep or jq
The Claude Code picker searches session names and titles, not what was said. I tested it, plus grep and a short jq script, on throwaway transcripts.
Kifah Abbad Published Last verified 9 min read
The short answer. The search box in Claude Code’s session picker matches the label of each session (the name you gave it, or a title or prompt Claude Code picked), not the text of the conversation. In my tests a word from the middle of a conversation found nothing. To find what was said, search the transcript files themselves: grep finds the file, and an 8-line jq script gives a clean answer and survives a damaged line.

Why this matters. A session you cannot find is a session you lost, even when the file is on disk. You need this when you remember what was decided but not the folder, the date or the title, and the picker shows a list that does not help.
What you get. A table of what the picker did and did not find, why grep over-counts, a script you can copy, and a short note on Codex and OpenCode.
Who needs this
Possible scenario. Three weeks ago you and the agent agreed why a webhook retries three times and not five. A reviewer now asks. You remember the conversation, not the folder or the title. You open the picker, type “retry”, and it shows nothing, because the word was in the conversation and the label says something else.
| Role | What changes for them |
|---|---|
| Junior software engineer | Finds the conversation in a minute and does not have to ask the agent the same question again. |
| Senior software engineer | Can point a reviewer to the exact session where a decision was made. |
| Architect | Knows decisions kept only in a conversation are not searchable by content, and records them elsewhere. |
Table: who gains what, my reasoning, not measured. I did not measure time saved for any role.
The problem, shown
I made three throwaway sessions with invented words in them and typed those words into the picker (Claude Code 2.1.173, 20 November 2026). Each row is one search.
| I typed | Where the word is | Picker |
|---|---|---|
DEEPWORD | the last prompt, which is the row label | found |
ZEPHYR | the first prompt only | no match |
OBSIDIAN | the prompt text, not the title | no match |
cache layer | the AI-written title | found |
echo | the AI-written title | found |
TOOLWORD | the prompt and a tool result | no match |
Überweisung | the prompt and the reply | no match |
webhook-signature | a name I set with --name | found |
PEBBLE | the prompt, session named | no match |
Table: what the picker search found. Tested, one search each, in a throwaway folder.
The pattern: it found a word only when the word was in what the row shows. The vendor’s sessions page, fetched the same day, says each row shows the first of these that exists: the name you set, the AI-generated title, a conversation summary, or one of your prompts. It describes the search as filtering sessions and does not say it reads the whole conversation. My result matches that.
Two ways to widen it, both tested. Ctrl+A shows sessions from every project on the machine, and searching there found rows from other folders by label (cache layer, webhook), with the folder path shown. Naming a session helps, because the name is the label: claude --resume <name> and /rename are the vendor’s routes.
How I tested it. I made the sessions with claude -p and a temporary CLAUDE_CONFIG_DIR, so my own storage was never touched. The vendor page says sessions from claude -p stay out of the picker, and I saw that (“No conversations found in this project”). So in my throwaway copies I changed the entrypoint field from sdk-cli to cli, then drove the picker in a pseudo-terminal and read the screen. These are not real interactive sessions. I used no real transcripts.
Search the files instead
Each session is one .jsonl file under ~/.claude/projects/<project>/ (see session formats for the layout). grep finds the file, with one catch I measured: one prompt appeared on 3 lines of the file, because the file also keeps a queue entry and a “last prompt” entry. grep -c therefore counts a prompt three times.
grep -rl "retry" ~/.claude/projects
That lists the files that contain the word, and it was the fastest way to find them. It cannot tell you whether the word was said by you, by Claude, or sits in a metadata line.
A script that counts only your messages and Claude’s, and prints only paths (never the text):
#!/bin/sh
# usage: find.sh "exact text" [projects-dir]
D=${2:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/projects}
for f in "$D"/*/*.jsonl; do
n=$(jq -R --arg w "$1" 'fromjson? | select(.type=="user" or .type=="assistant")
| select(.message.content | tostring | contains($w)) | 1' "$f" | wc -l)
[ "$n" -gt 0 ] && echo "$n hit(s) $f"
done
Run it as ./find.sh "retry"; the file name is the session id, and claude --resume <id> opens it (from another folder too on a current version). It needs jq.
What I ran it on, all throwaway data:
- A word in the middle of a session: 1 hit, in the right file.
- A word that appears nowhere: no output.
- A word that only a tool call and its result contain: 4 hits, so tool output is searched too (the picker did not find it).
- An accented word:
Überweisungfound,Uberweisungnot found. The match is exact, so type the word as it was written. - A damaged file (I cut one line in half): my first version of the script, without
-Randfromjson?, stopped at the broken line and found nothing, even thoughgrepstill found the word on 3 lines. The version above skips the bad line and found it. - Speed: 60 generated files, 5.4 MB in all, took 0.23 s with the script and 0.04 s with
grep -l. I did not test larger sizes, so I do not claim a number for a big history.
Other tools
- Codex CLI 0.170.0. Sessions are
rollout-*.jsonlfiles. On a throwaway session,grepfound both a first-turn word and a later one (5 lines each, again more than the number of messages). I did not find a search command in its--help, and I did not run the picker, so I do not know what its search matches. - OpenCode 2.3.2.
opencode session listhas no search option. Exporting a session and searching the JSON worked:grepandjqboth found a planted word in the export. I did not test the search in its session list.
Windows and Linux
Assumed, not tested. I ran nothing on Windows or Linux; this comes from the vendors’ pages and the issue trackers, read on 20 November 2026. The picker and its search are part of Claude Code, so I expect them to behave the same on every system it supports (assumed: the vendor’s page describes one picker). What differs is where the files are and which tool searches them.
- Linux. The same folder,
~/.claude/projects/(documented), so thegrepline and the script should run unchanged (assumed). The vendor lists Ubuntu 20.04 or later, Debian 10 or later and Alpine 3.19 or later. - Windows, native.
~/.clauderesolves to%USERPROFILE%\.claude(documented, the vendor’s.claudedirectory page), andCLAUDE_CONFIG_DIRmoves it. The project folder name replaces every character that is not a letter or digit with-(documented), so a project inC:\Users\me\projshould be stored under a name likeC--Users-me-proj(assumed: I applied the rule by hand). Windows has nogrep. PowerShell hasSelect-String, which Microsoft documents with-SimpleMatch,-CaseSensitiveand-List, and which takes files fromGet-ChildItem -Recurse:
Get-ChildItem "$env:USERPROFILE\.claude\projects" -Recurse -Filter *.jsonl |
Select-String -SimpleMatch "retry" -List | Select-Object Path
The -Filter use is my assumption; the page I read shows -Recurse and Select-String together, not this exact line. It lists files only. It does not do what my jq script does (count only your messages and Claude’s), and I did not check how jq installs on Windows.
- Windows, WSL. A Claude Code installed inside WSL uses that distribution’s Linux home, so its files are in the Linux
~/.claude, not under%USERPROFILE%(assumed from the vendor’s statement that the installer covers WSL). Search them from inside WSL. - Windows and the other tools. OpenCode keeps its database at
%USERPROFILE%\.local\share\opencode\(documented in the vendor’s troubleshooting text; two reports on 1.x versions agree, and I tested 2.3.2 on macOS only). Codex uses%USERPROFILE%\.codex(the vendor’s Windows setup page gives that as an exampleCODEX_HOME). The session formats page has the sources.
What does not exist today
Typing a phrase and getting the sessions whose text contains it, with a snippet around the match, would close the gap. The picker has a preview (the vendor says Space shows the session content), but the search I tested does not look inside. This is how it should work, not how it works now.
What to do on Monday
- Name sessions you may want again.
/rename retry-policyinside a session, orclaude --name retry-policyat the start. The name is what the picker searches. - Save the script and run it with a word you remember. It prints paths only, so it is safe to run in front of someone.
- Press
Ctrl+Ain the picker when the session may be in another folder. - Do not rely on old files existing. Claude Code deletes transcripts after 30 days by default, so a search finds nothing for a swept session; the 30-day page has the setting.
What I did not test
- Real conversations. There are none on this Mac. Every file was a short throwaway session made for this test, and the picker rows needed a changed
entrypointfield to appear. - Other versions. The picker was run on 2.1.173 only. The vendor page I read is current; I did not run the picker on 2.1.329.
- The prompt history. The vendor says
~/.claude/history.jsonlholds the prompts you typed and powers up-arrow recall andCtrl+Rsearch at the prompt. I tried one interactive prompt in a throwaway setup and nohistory.jsonland no transcript appeared; I did not find out why, so I did not test it. - Long histories. The script’s speed is one size: 60 files.
- Fuzzy or case-insensitive search. The script is exact and case-sensitive; I did not test options.
- Windows and Linux. Nothing was run there; the section above is documentation and reports, labelled as such.
- Sessions held in a database or a cloud service. Only local files were tested, on macOS.