Overview
grepai is a privacy-first command-line tool for semantic code search — the project calls it "grep for the AI era". Where `grep` and `ripgrep` match exact text or regex, grepai embeds your code as vectors so a query such as "authentication logic" can find a function named `handleUserSession`, even when naming conventions vary. Its stated aim is to cut the input tokens an AI coding agent spends by handing it relevant context instead of raw search results.
Everything runs locally by default. `grepai init` creates a `.grepai/` directory with a `config.yaml`, and `grepai watch` scans the codebase, splits files into chunks, embeds each chunk and stores the vectors, then keeps watching for file changes so the index stays fresh. Embeddings come from Ollama (default model `nomic-embed-text`), LM Studio, or OpenAI; vectors live in a file-based GOB store by default, with PostgreSQL + pgvector or Qdrant as options for larger codebases and teams.
Beyond search, grepai traces call graphs — who calls a function, what it calls, and a depth-limited graph around it — using fast regex extraction by default or tree-sitter parsing in a precise mode. It exposes all of this to agents as an MCP server (`grepai mcp-serve`) with tools for search, tracing, property reads/writes, and an opt-in Repository Planning Graph that links files, symbols, chunks and feature hierarchy nodes. In a benchmark run by the maintainer on the Excalidraw repository with Claude Code, the project reports 97% fewer input tokens and 27.5% lower API cost than plain grep, and notes that results may differ on other codebases.
What it does
- Natural-language search over a local vector index, with optional hybrid search that fuses vector and keyword results via Reciprocal Rank Fusion
- Call-graph tracing: `trace callers`, `trace callees` and `trace graph --depth`, plus `refs` for property and state readers/writers
- File watcher that re-indexes changed files automatically
- Pluggable embedders (Ollama, LM Studio, OpenAI) and vector stores (GOB file, PostgreSQL + pgvector, Qdrant)
- MCP server for Claude Code, Cursor, Windsurf and other MCP clients, and `agent-setup` to add grepai instructions to CLAUDE.md, AGENTS.md, GEMINI.md or Cursor/Windsurf rules
- Workspaces that index and search several projects through one shared vector store
Getting started
Install the binary, pull an embedding model, then initialise and index a project. Ollama is the default embedding provider; LM Studio and OpenAI also work.
Install grepai
Homebrew on macOS, the install script on Linux/macOS, or the PowerShell script on Windows.
brew install yoanbernabeu/tap/grepai
# or
curl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | shPull an embedding model
With Ollama, the recommended provider, pull the default embedding model.
ollama pull nomic-embed-textInitialise and index your project
`init` writes `.grepai/config.yaml`; `watch` builds the index and keeps it updated as files change.
cd /path/to/your/project
grepai init
grepai watchSearch and trace
Query by meaning, then check who depends on a function before changing it.
grepai search "error handling"
grepai trace callers "Login"
grepai trace graph "ProcessOrder" --depth 3Give your agent access
Register grepai as an MCP server in Claude Code; Cursor, Windsurf and Opencode use the same `grepai mcp-serve` command in their MCP config.
claude mcp add grepai -- grepai mcp-serveCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Let a coding agent find relevant code by intent instead of reading whole files, to cut its input tokens
- Check a function's callers and callees before a refactor
- Search an unfamiliar codebase in plain English without guessing its function names
- Search across several services or a monorepo from one workspace, without sending code to a cloud service
How grepai compares
grepai alongside other open-source code indexing & search tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| CodeGraph | ★ 74.3k | Builds a local SQLite knowledge graph of a codebase with a Rust tree-sitter kernel, keeps it in sync through a file watcher, and serves symbols, call paths and blast radius to coding agents over MCP. |
| GitNexus | ★ 47.9k | Indexes a codebase into a knowledge graph of dependencies, call chains and execution flows, then exposes it to Claude Code, Cursor and Codex through MCP tools. |
| codebase-memory-mcp | ★ 46.7k | A native MCP server that indexes a repository into a persistent tree-sitter knowledge graph of functions, call chains and routes, queried by agents through 15 tools. |
| code-review-graph | ★ 32.2k | A local-first code intelligence graph built with Tree-sitter that serves precise, incrementally-updated structural context to AI coding tools over MCP, so they read only the code a task needs. |
| Claude Context | ★ 12.6k | An MCP server that indexes your codebase into a vector database so AI coding agents can find relevant code by meaning instead of loading whole folders. |
| Graft | ★ 10.2k | Builds a persistent knowledge graph of your codebase as linked markdown files, then feeds the matching nodes to coding agents so they stop re-exploring the repo on every task. |
| XERJ | ★ 7k | Single-binary, Elasticsearch-compatible search engine whose autoindex command turns any folder of code, docs, logs or PDFs into typed indices that AI coding agents query via CLI or MCP instead of grepping. |
| grepai | ★ 1.9k | Local semantic code search and call graphs for AI agents |