Pi Session Manager

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

Message-Level FTS5

Each message in a session is indexed individually in message_entries:

  • entry_id — unique message identifier
  • session_path — path to parent session
  • role — user or assistant
  • source_type — user, assistant, or thinking
  • content — original message text
  • search_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:

RoleDescription
AllSearch across all messages
UserOnly user messages
AssistantOnly AI responses

Sort Order

Results can be sorted by:

SortDescription
Relevance (default)Ranked by FTS5 BM25 score
NewestMost recent messages first
OldestOldest 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:

PluginSearches
Session PluginSession names and metadata
Message PluginMessage content (user, assistant, tool)
Project PluginProject 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

ShortcutAction
Cmd/Ctrl + KOpen command palette
Cmd/Ctrl + FFocus sidebar search
EscClear search / close palette

On this page