Grepai: Semantic Search
Finding code by intent, not by regex
PDF editions Β· Guide v3.44.1 Β· Updated
Principle: search by intent
Native Grep (ripgrep) is ideal when you know the exact text to find. Grepai takes over when you are looking for βthe code that handles Xβ without knowing the exact function or variable names. It relies on local embeddings via Ollama and the nomic-embed-text model, which keeps that indexing step local. Search results returned to Claude can still enter the configured model providerβs context.
Measure value: compare retrieval accuracy, returned context size and accepted-task cost on representative searches.
The 5 main tools
grepai_search: search by natural language description. Short queries (1-3 keywords) yield better results than long phrases.
grepai_search("payment flow")grepai_search("JWT validation")grepai_search("rate limiting middleware")grepai_trace_callers: finds all functions that call a given symbol.
grepai_trace_callees: lists what a function calls internally.
grepai_trace_graph: generates the full dependency graph around a symbol.
grepai_index_status: checks that the index is up to date before running searches.
Call graph in practice
The most powerful use case for grepai is dependency analysis. Before refactoring a function, knowing who calls it prevents silent regressions.
# Who calls validateJWT?grepai_trace_callers("validateJWT")β ApiGateway, AdminPanel, UserController
# What does validateJWT do internally?grepai_trace_callees("validateJWT")β decodeToken, checkExpiry, verifySignatureRecommended depth: 2 by default, 3 at most for complex analyses.
Grepai vs native Grep
| Situation | Recommended tool |
|---|---|
Exact pattern known ("authenticate") | Native Grep |
| Search by concept or intent | Grepai |
| Call graph analysis | Grepai (trace_callers) |
| Multi-file refactoring | Grepai + Serena |
| Advanced regex on AST structure | ast-grep |
Simple rule: if you can write the regex, use Grep. Otherwise, grepai.
Setup
# Install grepaicurl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | sh
# Initialize in the project (choose: ollama, nomic-embed-text)grepai init
# Check statusgrepai statusPrerequisites: Ollama installed with the nomic-embed-text model available. If βconnection refusedβ error: brew services start ollama.
Best practices
Always call grepai_index_status at the start of a session if the codebase has changed since the last indexing. Limit results to 5 by default and increase only if the first results are not relevant. Grepai discovers files, then native Grep refines with a precise regex: both tools complement each other naturally.
Enter your email to read the full card and get the complete PDF bundle.
All content is free and open-source. We just ask for your email.