Update search tools to redirect dotted queries to symbol references (#6) - #134
Open
Spandan-Mishra wants to merge 1 commit into
Open
Spandan-Mishra wants to merge 1 commit into
Spandan-Mishra wants to merge 1 commit into
Conversation
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
When search_content or grep_files receives a query containing a dot (e.g., "pkg.Symbol"), resolve the pattern against the indexed syntax parser and query LSP references. If references exist, return them directly with an educational note pointing the model toward find_references, skipping the expensive repository-wide filesystem regex walk. Fall back to the normal regex walk if the pattern contains no dot, does not resolve in the parser, yields zero references, or if parser or LSP dependencies are nil. Fixes unstablebuild#6 Signed-off-by: Spandan Mishra <spandanmishra69@gmail.com>
Spandan-Mishra
force-pushed
the
feat/agent-redirect-dotted-search-to-lsp-refs
branch
from
September 26, 2026 07:19
97cd381 to
2421cf0
Compare
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
Resolves #6 by intercepting dotted query patterns in
search_contentandgrep_files(e.g.pkg.Symbol) and redirecting them to indexed symbol resolution and LSP references.When an agent issues a dotted query, resolving via LSP references directly avoids expensive, slow filesystem walks across large repositories while prepending an educational note to guide the agent toward using
find_referencesdirectly.Behavior Matrix
pkg.Symbol(dotted)pkg.NonExistent(dotted)pkg.Unreferenced(dotted)Symbol(bare, no dot)pkg.Symbol(LSP or parsernil)Implementation Details
Dependency Plumbing:
agentools.DefaultTools,newSearch, andNewGrepFilesto acceptlsp semanticapi.LSPandparser syntaxapi.Parser.Resolution & References:
resolveIndexedSymbolincmd/rune-agent/agent/agentools/lsp.gousingparser.ResolveSymbol(ctx, symbol, nil)with strict indexed lookup (no fuzzy workspace fallback).resolveDottedReferencesto short-circuit non-dotted patterns, locate definitions, and querylsp.ReferenceswithIncludeDeclaration: true.Tool Execution:
search.go: When references are found, formats line snippets viarenderMultiLocation, tracks discovered files withFileTracker.TrackDiscovery, and prepends the educational note.grep_files.go: When references are found, collects deduplicated relative file paths, applies truncation limits, tracks discovery, and prepends the educational note.Testing
cmd/rune-agent/agent/agentools/search_redirect_test.goasserting all 5 behavior rows, walk skipping via atomicReadDircounters, parser call gating, and discovery tracking.