Search
Full-text search across all sessions with role filters, session ID matching, snippet highlighting, and command palette integration.
"Searching is half of finding." — Senegalese proverb
Pi Session Manager provides full-text search across all your sessions, powered by SQLite FTS5. The same index powers the search page, the command palette, and deeper workflow links from the session browser.
Search Engines
SQLite FTS5
The primary search engine. All session content is indexed into an FTS5 virtual table (message_fts) inside the SQLite database (~/.pi/agent/sessions/sessions.db). This provides:
- Fast prefix and phrase matching
- BM25 ranking (via
bm25()function) - Low memory footprint
- Auto-sync via
content='message_entries'(no manual triggers needed)
FTS5 can be toggled via the enable_fts5 setting in the configuration file.
Session ID Matching
In addition to FTS, the search system supports exact and prefix matching on session IDs:
- Exact match: score 1,000,000
- Prefix match (≥3 chars): score 999,000
- Session ID results are always ranked above content matches
Content Search
Message-Level FTS5
Each message in a session is indexed individually in message_entries:
entry_id— unique message identifiersession_path— path to parent sessionrole— user or assistantsource_type— user, assistant, or thinkingcontent— original message textsearch_text— normalized text used by FTS
Search results are deduplicated per (session_path, entry_id) and limited to 3 hits per session.
CJK Support
For Chinese/Japanese/Korean text, the index stores a normalized search_text representation and queries go through the same normalization path. That lets CJK and mixed-language queries stay on FTS5 instead of falling back to LIKE.
Filters
Role Filter
Narrow results to specific message roles:
| Role | Description |
|---|---|
| All | Search across all messages |
| User | Only user messages |
| Assistant | Only AI responses |
Sort Order
Results can be sorted by:
| Sort | Description |
|---|---|
| Relevance (default) | Ranked by FTS5 BM25 score |
| Newest | Most recent messages first |
| Oldest | Oldest messages first |
Snippet Highlighting
Search results display content with matching text context. Click a result to jump directly to the matching message in the Session Viewer.
When a match is inside a toolResult entry, the viewer automatically resolves it to the parent assistant message containing the matching tool call, then scrolls to the correct position.
Plugin System
The search system uses a plugin architecture with three built-in plugins:
| Plugin | Searches |
|---|---|
| Session Plugin | Session names and metadata |
| Message Plugin | Message content (user, assistant, tool) |
| Project Plugin | Project directories and paths |
Plugins are registered in src/plugins/ and can be extended to add custom search sources.
Command Palette
Press Cmd/Ctrl + K to open the command palette — a cmdk-based interface that combines search with quick actions:
- Search sessions by name or content
- Switch views (list, project, kanban)
- Open settings
- Toggle terminal
- Navigate to any session
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Cmd/Ctrl + K | Open command palette |
Cmd/Ctrl + F | Focus sidebar search |
Esc | Clear search / close palette |