Cursor builds local sparse n-gram indexes to accelerate regex search for AI agents in large monorepos
Regex search via ripgrep is too slow for large Enterprise monorepos, with individual agent search invocations routinely taking more than 15 seconds and stalling agentic coding workflows.
ripgrep must scan every file without index-based narrowing; classic trigram inverted indexes produce posting lists too large to query efficiently at scale; bloom-filter-augmented trigram indexes become saturated and lose their filtering power over time.
Providing text search indexes to fast models creates a qualitative difference for agentic workflows; removing search time from the workflow provides meaningful time savings, particularly when the agent investigates bugs, and allows for more effective iteration.
Frequently asked questions
What did this team achieve with this AI workflow?
Providing text search indexes to fast models creates a qualitative difference for agentic workflows; removing search time from the workflow provides meaningful time savings, particularly when the agent investigates bu…
What tools did this team use?
ripgrep, Composer 2.
What results were reported?
Ripgrep invocation latency on large repos: more than 15 seconds; Impact on agentic workflows: qualitative difference for Agentic workflows; Search time savings: meaningful time savings (source-reported, not independently verified).
What failed first in this deployment?
ripgrep must scan every file without index-based narrowing; classic trigram inverted indexes produce posting lists too large to query efficiently at scale; bloom-filter-augmented trigram indexes become saturated and l…
How is this workflow AI workflow structured?
Agent issues regex search → Query decomposed into sparse n-grams → Local index lookup narrows candidates → Regex matched on candidate files → Results delivered to agent.