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.Each message carries an archived boolean β€” true marks a turn recalled from archived_messages (compacted out of the active window by the default retention="compact" policy). See Recall Across Compacted History.

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. One bad transcript on disk (unreadable, malformed JSON, or invalid UTF-8) is also skipped β€” so you don’t need to clean up ~/.praisonai/sessions/ before running the command. See Cross-Session Recall β†’ Resilience to Corrupt Transcripts.

Compacted history stays searchable

The CLI walks the same archived + active projection as the session_search agent tool. A detail rolled into archived_messages under retention="compact" is still recallable via praisonai session search β€” hits on archived turns come back with archived: true in each message entry (JSON mode) so the compaction boundary stays visible.
See Cross-Session Recall β†’ Recall Across Compacted History.

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