Skip to main content
Search every stored session transcript from the terminal — ranked by relevance, with a snippet centred on each match.

Quick Start

An agent recalls past sessions through the session_search tool — the CLI reaches the same engine from your terminal.
1

Search your sessions

Prints a table of matching sessions ranked by score, each with a snippet centred on the match:
An empty result prints:
2

Widen the search

Return more sessions and more context around each hit:
3

Get machine-readable output

Add the global --json flag for a structured result:
Each result is SessionHit.as_dict() — the same shape as the Cross-Session Recall Discovery return.

How It Works

session search delegates to SqliteSessionStore — the same FTS5/bm25 engine as the session_search agent tool — instead of a substring scan. The command iterates the CLI’s canonical stores via canonical_cli_stores() — the same helper session resume / show / delete / export use — so id resolution stays consistent across every sub-command. See Session Resume.

Cross-store dedup

A session resumed from the global default store keeps a project-side shadow, so the same id can match in both canonical stores. Without dedup those duplicate rows each consume a slot of --limit and crowd out distinct sessions. The command collapses by session_id, keeping the higher-scoring copy — mirroring the lineage dedup the store already applies inside a single directory.
Search never breaks: if a store can’t be indexed, that store is skipped and the remaining hits are still returned.

Flags

Text mode prints a table with columns ID | Title | Score | Snippet | When. JSON mode prints {"query": "...", "results": [...]} where each result is SessionHit.as_dict().

Common Patterns

From an agent tool to the terminal

The session_search agent tool and praisonai session search share the same store — pick whichever fits your workflow.

Pipe JSON into a script

Resume the top hit


Best Practices

Start with the default --window 5. Widen only when you need more surrounding context after finding the right session — then session resume it.
Scores are FTS5/bm25 ranks, not probabilities. A 5.0 beats a 2.0, but says nothing absolute — read the snippets to confirm the match.
Cross-store dedup collapses same-id shadows, but distinct sessions on the same topic still compete for slots. Raise --limit when a topic spans many sessions.
The --json output is SessionHit.as_dict() per result — pipe it into jq to feed ids straight into session resume, show, or export.

Session (CLI)

List, resume, show, delete, export, and share sessions

Session Resume

Continue a session with full state restored

Cross-Session Recall

The same engine as an agent tool (session_search)

Session Store

SqliteSessionStore — FTS5 + bm25 recall index