feat(search): add --git-branch, --model, --since, --until filter flags to query and MCP search_sessions - #51
Open
Adityakk9031 wants to merge 4 commits into
Conversation
…sions Add --git-branch, --model, --since, and --until filter flags to the CLI 'query' subcommand and to the MCP 'search_sessions' tool, mirroring the existing --cwd filter and the 'list' command's --since/--until. Library changes (src/search.rs): - Add cwd, git_branch, model, since, until fields to Query struct - Doc::selected() evaluates all five meta-filters; path_under() helper for component-wise prefix matching of cwd CLI changes (cli/src/lib.rs): - SessionCommand::Query gains --git-branch, --model, --since, --until args - cmd_query and build_index accept and thread the new params through; build_index applies all filters at session-discovery time MCP changes (cli/src/mcp.rs): - SearchSessionsRequest gains git_branch, model, since, until fields - search_sessions parses since/until via parse_since/parse_until helpers and passes all five new params into index_for; tool description updated Tests (tests/integration/search.rs): - query_filter_git_branch_exact_match: exact-match filter and no-match case - query_filter_model_case_insensitive_substring: case-folded substring filter - query_filter_since_and_until: timestamp lower/upper bounds and intersection - query_filter_cwd_path_prefix: parent-dir matches both, child-dir matches one Docs (docs/usage.md): document new flags for both CLI and MCP.
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.
Right now xcript query only lets you filter by harness and working directory. When working across multiple git branches or testing different models, searching turns up a lot of irrelevant matches.
This PR adds four new filter flags to narrow down sessions before scoring starts:
The same filters are also exposed on the MCP search_sessions tool (git_branch, model, since, until).
Examples
\\sh
Search for 'relay bug' specifically on the feature branch
txcript query 'relay bug' --git-branch relay-protocol-v6
Search sessions using Claude from the past week
txcript query --model claude --since 2025-06-10 --until 2025-06-17
Scope by repo directory and branch
txcript query --cwd ~/projects/myapp --git-branch main
\\
Summary of changes: