feat(session_search): add recent sessions mode when query is omitted#2533
Merged
feat(session_search): add recent sessions mode when query is omitted#2533
Conversation
When session_search is called without a query (or with an empty query), it now returns metadata for the most recent sessions instead of erroring. This lets the agent quickly see what was worked on recently without needing specific keywords. Returns for each session: session_id, title, source, started_at, last_active, message_count, preview (first user message). Zero LLM cost — pure DB query. Current session lineage and child delegation sessions are excluded. The agent can then keyword-search specific sessions if it needs deeper context from any of them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
session_searchis called without a query, it now returns metadata for recent sessions instead of erroring. The agent can quickly see what was worked on recently without needing specific keywords.How it works
Zero LLM cost for the recent mode — pure SQLite query via existing
list_sessions_rich. Current session lineage and child delegation sessions are excluded.Example output
{ "mode": "recent", "results": [ {"session_id": "20260321_...", "title": "PR review session", "preview": "Lets do 2264", "message_count": 47, ...}, {"session_id": "20260320_...", "title": null, "preview": "Can you check the ATM10 server?", "message_count": 12, ...} ] }The agent can then keyword-search specific sessions if it needs deeper context.
Test plan
queryparameter no longer required in schema