Improving agent with semantic search
Nov 6, 2025Stefan Heule, Emily Jia & Naman Jain

Summary
This post details the integration of semantic search into Cursor's coding agents to improve their understanding of codebases. It describes the training of a custom embedding model using agent session traces and LLM-generated rankings to align similarity scores with actual agent behavior. The post presents offline evaluation results (Cursor Context Bench) showing an average of 12.5% higher accuracy and online A/B test results indicating a 0.3% increase in code retention (up to 2.6% on large codebases) and a 2.2% decrease in dissatisfied user requests when semantic search is available. The combination of semantic search with grep is highlighted as crucial for optimal agent performance.