# grepai

> Privacy-first CLI for semantic code search and call graph tracing that gives AI coding agents relevant codebase context.

grepai is an open-source, MIT-licensed command-line tool by Yoan Bernabeu that indexes code using vector embeddings so developers and AI coding agents can search by meaning instead of exact text. It also traces function callers and callees and exposes an MCP server. The project states that it can run fully locally with Ollama.

## What It Is

grepai is a semantic code search CLI. Instead of matching literal strings like grep, it uses embeddings to find conceptually related code, so a query such as "user authentication flow" can surface relevant functions even when naming conventions differ. Results include file paths, line ranges, and relevance scores. The README states it reduces AI agent input tokens by supplying relevant context rather than raw search results.

## How the Workflow Runs

A user installs the binary, runs `grepai init` in a project, starts `grepai watch` to build and keep the index current via a file watcher, then runs `grepai search` with natural language. `grepai trace callers` and `trace callees` show call relationships, and the docs also list reference commands, a Repository Planning Graph, hybrid search, search boost, git worktree support, and workspace management.

## Embedding Backends and Privacy

An embedding provider is required: Ollama (default), LM Studio, or OpenAI. With a local provider such as Ollama, the project says code never leaves the machine. Configuration lives in `.grepai/config.yaml`, where the embedder provider and model are set.

## Agent Integration

grepai provides a native MCP server and JSON output, plus an agent-setup command. The docs describe integration with Claude Code (including a subagent), Cursor, Codex CLI, Windsurf and Gemini CLI, and list 27 agent skills. Call graph tracing is documented for languages including Go, TypeScript, JavaScript, Python, PHP, Java, C, C#, F#, C++, Rust and Zig.

## Features
- Semantic code search with natural language queries
- Call graph tracing (callers, callees, graph)
- Reference analysis (readers, writers)
- Repository Planning Graph
- Real-time file watching and index updates
- Native MCP server
- JSON output for AI agents
- Hybrid search and search boost
- Git worktree support
- Workspace management
- Local or cloud embedding providers
- Shell completion

## Integrations
Claude Code, Cursor, Windsurf, Codex CLI, Gemini CLI, Ollama, LM Studio, OpenAI, MCP

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v0.37.0

## Links
- Website: https://yoanbernabeu.github.io/grepai/
- Documentation: https://yoanbernabeu.github.io/grepai/getting-started/
- Repository: https://github.com/yoanbernabeu/grepai
- EveryDev.ai: https://www.everydev.ai/tools/grepai
