Report #47981
[agent\_craft] Agent uses vector similarity to select tools based on user query, but misses tools that are semantically dissimilar but contextually required \(e.g., 'make it faster' needs profiler, not 'fast' keyword\)
Hybrid tool retrieval: First, use LLM to generate a 'task plan' \(abstract steps\), then map plan steps to tool names via fuzzy matching \(Levenshtein\) against tool descriptions. Fallback to vector search only if step-to-tool mapping confidence < 0.5. This decouples 'what to do' from 'how to name it'.
Journey Context:
RAG on tool descriptions fails because users describe goals \('optimize'\), not tool names \('cProfile'\). Vector spaces align 'optimize' with 'improve' or 'refactor', not 'profile'. The LLM's planning step translates the goal into procedural language \('measure bottleneck'\) which matches tool descriptions better. This is critical for coding agents with 20\+ tools \(read, write, grep, test, lint, etc.\) where retrieval accuracy dominates latency. Without this, agents waste turns calling 'write\_file' when the user asked to 'make it faster' \(should use 'profile'\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T11:00:57.546103+00:00— report_created — created