pub fn smart_context(
db: &Database,
analytics: &Analytics,
provider: &dyn EmbeddingProvider,
task: &str,
config: SmartConfig,
) -> Result<SmartContext>Expand description
Select files relevant to a task using semantic search and call graph analysis.
ยงAlgorithm
- Embed the task description
- Find top-N symbols matching the embedding
- For each matched symbol:
- Add the file containing the symbol
- Expand call graph (callers + callees) to specified depth
- Add files from expanded symbols
- Deduplicate files, keeping highest relevance
- Count tokens for each file
- Sort by relevance score descending
- Include files until token limit is reached