Session Search: Find Past Conversations and Reopen Context
Learn how to use sessions_search to scan past session transcripts, retrieve matching excerpts, and reopen full conversation context with sessions_history. Essential for developers needing to recall or resume prior interactions.
Read this when
- You need to find something discussed in an earlier session
- You want to understand session search privacy or indexing
Session search
sessions_search scans the user and assistant text from your previous sessions. Every result provides a sessionKey, a timestamp, the role, and a short excerpt that matches the query. When you need the full conversation context, hand the returned sessionKey to sessions_history.
Visibility and output
The search applies the same session visibility rules that sessions_history uses. Any results that fall outside the caller's visible session tree are filtered out before result limits take effect. Sandboxed agents are restricted to sessions they originally created when spawned-session visibility is turned on.
Excerpts are sanitized before being sent back to the model. The results are also constrained by a maximum count, a maximum excerpt length, and a total response size limit.
Index lifecycle
OpenClaw keeps a full-text index alongside the transcript rows inside each agent's SQLite database. New user and assistant messages get indexed within the same transaction that persists them, so the index always stays current with live conversations. Tool results, reasoning blocks, and images are not included. Only the active branch of the transcript is available for searching.
Transcripts created before the index existed (for instance, sessions imported by openclaw doctor) and sessions where the active branch was rewound are reindexed through a background reconciliation process that starts the next time a search runs. Because of this, a response with indexing: true might be incomplete. Retry after the indexing finishes. Deleting a session removes its index entries in the same transaction.
Search currently relies on SQLite's Unicode word tokenizer with diacritic removal. Trigram tokenization for matching substrings in CJK text is planned as a future enhancement.
Session search vs. memory search
For exact words or phrases from raw session transcripts, use sessions_search. For durable memory files and semantic recall, use memory_search. The experimental session-memory corpus provides the semantic counterpart to this exact transcript search.