Sandbox
@yoanbernabeu/grepai

Local semantic search and MCP server for code

grepai indexes your code on your machine, then lets you search by intent and trace call graphs from the CLI. It keeps the index fresh with a watcher and can serve the results to an agent through MCP.

1,857 stars155 forksCUpdated 7d ago
Who it's for

Builders who want agent tools to search a codebase by meaning and pull back useful context.

What it delivers

You can find the right code faster and give your agent less code to read.

What it does

Semantic code search

Search by intent instead of exact text, so queries like "authentication logic" can find related functions.

Call graph tracing

Trace callers and references before changing code, using `grepai trace` and `grepai refs` commands.

Local indexing

Keep code search on your machine with local embeddings and no source upload.

Background watch mode

Run a watcher and daemon that keep the index fresh as files change.

Agent integration

Expose grepai as an MCP server so Claude Code, Cursor, and other agents can use it as a tool.

Shell completion

Generate completions for zsh, bash, fish, and PowerShell with `grepai completion`.

How to get it

  1. 1Homebrew (macOS)
    brew install yoanbernabeu/tap/grepai
  2. 2Linux/macOS
    curl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | sh
  3. 3Windows (PowerShell)
    irm https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.ps1 | iex
  4. 4Ollama (recommended)
    ollama pull nomic-embed-text
  5. 5Run
    grepai init                        # Initialize in your project
    grepai watch                       # Start indexing daemon
    grepai search "error handling"     # Search semantically
    grepai trace callers "Login"       # Find who calls a function

README

grepai

grep for the AI era

Product Hunt

GitHub stars Downloads Go Go Report Card License: MIT

Search code by meaning, not just text.

Documentation · Installation · Quick Start


grepai is a privacy-first CLI for semantic code search. It uses vector embeddings to understand code meaning, enabling natural language queries that find relevant code—even when naming conventions vary.

Drastically reduces AI agent input tokens by providing relevant context instead of raw search results.

Features

  • Search by intent — Ask "authentication logic" and find handleUserSession
  • Trace call graphs — Know who calls a function before you change it
  • 100% local — Your code never leaves your machine
  • Always up-to-date — File watcher keeps the index fresh automatically
  • AI agent ready — Works with Claude Code, Cursor, Windsurf out of the box
  • MCP server — Your AI agent can call grepai directly as a tool

Installation

Homebrew (macOS):

brew install yoanbernabeu/tap/grepai

Linux/macOS:

curl -sSL https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/yoanbernabeu/grepai/main/install.ps1 | iex

Requires an embedding provider — Ollama (default), LM Studio, or OpenAI.

Ollama (recommended):

ollama pull nomic-embed-text

Quick Start

grepai init                        # Initialize in your project
grepai watch                       # Start indexing daemon
grepai search "error handling"     # Search semantically
grepai trace callers "Login"       # Find who calls a function

Shell Completion

grepai supports autocompletion for commands, flags, and dynamic values (workspace names, project names, providers, backends).

Zsh (add to ~/.zshrc):

eval "$(grepai completion zsh)"

Oh-My-Zsh plugin:

mkdir -p ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/grepai
grepai completion zsh > ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/grepai/_grepai
# Then add "grepai" to plugins=(...) in ~/.zshrc

Bash:

# Linux
grepai completion bash > /etc/bash_completion.d/grepai

# macOS (requires bash-completion@2)
grepai completion bash > $(brew --prefix)/etc/bash_completion.d/grepai

Fish:

grepai completion fish > ~/.config/fish/completions/grepai.fish

PowerShell:

grepai completion powershell | Out-String | Invoke-Expression

What developers say

"I just hit my limit and it took 13% of my max5 plan just to read my codebase. I am very, very excited about your new tool." — u/911pleasehold on r/ClaudeAI (280K+ views)

"It works great! Takes 5 minutes to install. Crazy!"@LesSaleGeek on X

"The results are incredible!"Kenny Nguyen on LinkedIn

Why grepai?

grep was built in 1973 for exact text matching. Modern codebases need semantic understanding.

grep / ripgrepgrepai
SearchExact text / regexSemantic understanding
Query"func.*Login""user authentication flow"
FindsPattern matchesConceptually related code

Documentation

Full docs, guides, and blog:

  • Documentation — Configuration, AI agents, MCP setup
  • Blog — Benchmarks, tutorials, release notes

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT License - Yoan Bernabeu 2026

Files in the repo

Repository payload41 top-level entries
  • .claude
  • .github
  • cli
  • cmd
  • config
  • daemon
  • docs
  • embedder
  • framework
  • fsharp
  • git
  • indexer
  • internal
  • mcp
  • rpg
  • scripts
  • search
  • stats
  • store
  • trace
  • updater
  • watcher
  • .editorconfig
  • .gitignore
  • .golangci.yml
  • .goreleaser.yml
  • CHANGELOG.md
  • CLAUDE.md
  • CODE_OF_CONDUCT.md
  • compose.yaml
  • CONTRIBUTING.md
  • flake.lock
  • flake.nix
  • go.mod
  • go.sum
  • install.ps1
  • install.sh
  • LICENSE
  • Makefile
  • README.md
  • SECURITY.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k