feat: codebase_search — symbol-aware code retrieval#38
Conversation
New tool: codebase_search - Searches codebase index for symbols (fn, struct, class, trait, impl) and file paths matching query terms - TF-IDF-style scoring: filename match (3x), symbol match (2x), path match (1x) - Returns ranked results with file paths and matching symbols - Agent can find relevant code before reading files Enhanced RepoMap: - Added search() method with multi-term scoring - Stored as struct (not String) so search is available at runtime - to_prompt_section() still used for system prompt injection Tests: 190→192 (search_finds_symbols, search_ranks_by_relevance)
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe changes implement a new codebase search feature by adding a Changes
Sequence DiagramsequenceDiagram
participant User
participant Runtime as ConversationRuntime
participant Dispatcher as Tool Dispatcher
participant RepoMap
participant Results
User->>Runtime: Call "codebase_search" tool<br/>(query, max_results)
activate Runtime
Runtime->>Dispatcher: dispatch_tool("codebase_search", input)
activate Dispatcher
Dispatcher->>Dispatcher: Parse query & max_results<br/>from input JSON
alt repo_map initialized
Dispatcher->>RepoMap: search(query, max_results)
activate RepoMap
RepoMap->>RepoMap: Tokenize query<br/>Score files by relevance<br/>Collect matching symbols
RepoMap-->>Dispatcher: Vec<SearchResult>
deactivate RepoMap
Dispatcher->>Dispatcher: Format results with<br/>paths and symbols
Dispatcher-->>Results: Formatted matches
else repo_map not initialized
Dispatcher-->>Results: "Repo map not initialized"<br/>(is_error: true)
end
deactivate Dispatcher
Runtime-->>User: Tool response
deactivate Runtime
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Smart Context Retrieval
New
codebase_searchtool for agents to find relevant code:{"query": "authentication handler config", "max_results": 5}Returns:
How it works
Why
Before: agent had to grep blindly or read files one by one.
After: agent searches symbols first, then reads only relevant files.
192 tests pass.
Summary by CodeRabbit
Release Notes
New Features
Tests