Skip to content

mcp: filters for find_related, dedupe defs out of refs BM25 hits - #7

Merged
julymetodiev merged 1 commit into
mainfrom
mcp-find-related-filters-refs-dedupe
May 9, 2026
Merged

julymetodiev merged 1 commit into
mainfrom
mcp-find-related-filters-refs-dedupe

Conversation

@julymetodiev

Copy link
Copy Markdown
Owner

Two related improvements addressing audit-time friction in the "find related code" workflow.

find_related filters: VelesIndex::find_related now accepts filter_languages and filter_paths in the same shape as search. The historical "default to source chunk's language" stays in effect when both are None, so existing callers (CLI, gRPC, TUI) keep their behaviour without changes beyond the new None / None arguments.

The MCP find_related tool exposes lang / path / exclude args and threads them through filter::resolve_path_filter, so an agent can say "show me related code, but only under crates/veles-mcp/**" and have the candidate set restricted exactly that way.

refs dedupe: when a BM25 hit's chunk contains a definition's start line, the chunk is the same code the Definitions section already pointed at — drop it from the BM25 list. The handler now requests ~50% extra BM25 hits to compensate for dropped duplicates, so the post-filter result count is closer to the requested top_k.

Two related improvements addressing audit-time friction in the
"find related code" workflow.

find_related filters: VelesIndex::find_related now accepts
filter_languages and filter_paths in the same shape as `search`. The
historical "default to source chunk's language" stays in effect when
both are None, so existing callers (CLI, gRPC, TUI) keep their
behaviour without changes beyond the new None / None arguments.

The MCP find_related tool exposes lang / path / exclude args and
threads them through filter::resolve_path_filter, so an agent can
say "show me related code, but only under crates/veles-mcp/**" and
have the candidate set restricted exactly that way.

refs dedupe: when a BM25 hit's chunk contains a definition's start
line, the chunk is the same code the Definitions section already
pointed at — drop it from the BM25 list. The handler now requests
~50% extra BM25 hits to compensate for dropped duplicates, so the
post-filter result count is closer to the requested top_k.
@julymetodiev
julymetodiev merged commit 945ed4c into main May 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant