Feature: fuzzy search for --resume (session picker)
Problem
claude --resume <session-id> requires knowing the exact session ID. In practice, users need to find sessions by what they discussed, not by UUID. There's no built-in way to search, browse, or fuzzy-find past sessions.
With 300+ sessions across multiple projects, finding "that planning session from this morning" means manually scanning .claude/projects/ directories or grepping JSONL files.
Proposed Solution
Add an interactive session picker when --resume is called without an argument (or with a query):
claude --resume # browse all sessions, sorted by recency
claude --resume "auth bug" # search sessions by content
Key UX behaviors:
- Full-text search across session content (user messages, assistant responses, summaries)
- Exact phrase support:
"week 12"finds that exact phrase, not just sessions with "week" and "12" separately - Field-weighted ranking: matches in titles/first messages rank higher than matches buried in conversation
- Cross-project: searches all projects, shows project labels for context
- Live preview: see conversation excerpts before resuming
- Recency-aware: among equal relevance, newer sessions surface first
What this looks like
sessions > auth migration
> today Fix the login redirect bug — users are getting stuck in a loop...
1d Plan: Migrate to React Server Components · webapp
6d Week 12 Sprint Planning · webapp
today Morning standup — what's on my plate today? · Personal
4 matches · ctrl-/ toggle preview
Typing updates results live (not just filtering — re-ranking). Selecting a session resumes it.
Working Implementation
I built this as a standalone tool: claude-sessions
Architecture:
- SQLite FTS5 for full-text search (ships with Python's stdlib
sqlite3— no external dependencies) - BM25 ranking with field weights (title 10x, preview 5x, body 1x)
- Incremental indexing: ~180ms warm sync for 383 sessions, ~4ms search
- fzf as the interactive UI with
--phony+change:reloadfor live re-searching
The session data is already there (JSONL files in .claude/projects/). The indexer extracts text from user messages and assistant responses, stores it in an FTS5 virtual table, and searches it with BM25 ranking. The whole thing is ~400 lines of Python with no dependencies beyond stdlib.
Why this matters
Session resume is one of Claude Code's best features — but discoverability kills it. If you can't find the session, you can't resume it. Right now the only option is the compact --resume list which shows truncated summaries with no search. A content-searchable picker would make --resume genuinely useful for power users with many sessions.
Alternatives Considered
- Keyword extraction + TF-IDF: Built this first. Required constant patching (token length limits, custom phrase matching, stopword lists). FTS5 handles all of it natively.
- External search engine (Meilisearch, etc.): Overkill. SQLite FTS5 is zero-dependency and fast enough.
- Just use grep: Works but no ranking, no live preview, no cross-project awareness.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗