{"slug": "greppy-a-drop-in-grep-with-code-nav-subcommands-for-ai-agents", "title": "Greppy – A drop-in grep with code-nav subcommands for AI agents", "summary": "Greppy, a drop-in grep replacement with code-navigation subcommands for AI agents, improves agent accuracy on structural code questions from ~53% to ~87% while using fewer tokens. The Rust binary includes built-in symbol graph and semantic search, requiring no external indexing. Early benchmarks show 2.3× faster resolution and ~9× fewer input tokens compared to plain grep.", "body_md": "**Standard grep, plus a few commands your coding agent uses to navigate code — who-calls, impact, semantic-search, brief. On structural code-navigation questions the agent answers correctly ~87% of the time instead of ~53% with plain grep — using fewer tokens. One native Rust binary.**\n\n`greppy`\n\nis a drop-in `grep`\n\n— every flag works exactly as before — that *also*\nanswers the questions an agent normally burns rounds on: *who calls this\nfunction, what breaks if I change it, where is the code that does X.* One line in\nyour agent's config (below) tells it the extra commands exist, and it stops\nlooping through text matches.\n\n```\n# Standard grep — every command works, unchanged:\ngreppy -rn \"TODO\" src/\ngreppy -i \"connection refused\" server.log\n\n# A few extra commands, on the same binary:\ngreppy who-calls parse_config                  # who calls this function\ngreppy impact User --direction incoming        # what breaks if I change User\ngreppy semantic-search \"restrict a value to a range\"   # find code by meaning\ngreppy brief _split_blueprint_path             # definition + callers + callees\n```\n\nThe same coding agent (MiniMax-M3, driven by Pi Code) answers one who-calls question on a real repo — left with plain grep, right with greppy. greppy resolves the callers in a single greppy who-calls call instead of a grep-and-read spiral: 2.3× faster, 14 → 5 tool calls, ~9× fewer input tokens. Counters are live from the recorded run.\n\n**1. Install the binary.**\n\n```\ncargo build --release --bin greppy --features embedded-model\nsudo install -m 0755 target/release/greppy /usr/local/bin/greppy\n```\n\nEverything is automatic — the code graph and the semantic model are **built into\nthe binary** and build themselves on first use. Nothing to index, nothing to\ndownload, no flags to configure. (Prebuilt binaries for macOS / Linux / Windows\nare on the [Releases](/metric-space-ai/greppy/releases) page.) Want it as a transparent `grep`\n\ndrop-in too? Install it a second time as `grep`\n\n.\n\n**2. Tell your agent the extra commands exist.** Delegate it — in your agent's\nchat, say ** install https://github.com/metric-space-ai/greppy/** — or\npaste the snippet below into the file your agent reads for project instructions\n(\n\n`CLAUDE.md`\n\n, `AGENTS.md`\n\n, `.cursor/rules`\n\n, `.windsurfrules`\n\n, or the system\nprompt).\n\n```\nThis project has `greppy` — standard grep plus a few code-navigation commands\nover a prebuilt symbol graph and an on-device semantic index. Every normal grep\ninvocation (and flag) works exactly as usual.\n\nCODE-NAVIGATION COMMANDS. SYMBOL is a function / method / class / type name.\nThey return resolved results as `qualified_name file:line`, not text matches:\n  greppy who-calls SYMBOL        the callers of SYMBOL (incoming calls)\n  greppy callees SYMBOL          the functions SYMBOL calls (outgoing calls)\n  greppy find-usages SYMBOL      every reference to SYMBOL (calls, uses, imports)\n  greppy brief SYMBOL            SYMBOL's definition plus its callers and callees, in one call\n  greppy impact SYMBOL           the transitive set of code a change to SYMBOL reaches\n  greppy search-symbols NAME     definitions whose name matches NAME (a name or fragment)\n  greppy path --from A --to B    a call chain from symbol A to symbol B, if one exists\n\nSEMANTIC SEARCH — use when you do NOT know the symbol's name:\n  greppy semantic-search \"PLAIN-ENGLISH DESCRIPTION\"\n      Describe the behaviour or code you are looking for in plain English\n      (e.g. \"restrict a value to a range\", \"retry a failed HTTP request\").\n      Returns the closest-matching definitions by meaning (signature + file:line).\n\nEXPAND — get the full source in one call instead of opening files by hand:\n  greppy expand ID\n      who-calls / callees / impact / semantic-search may end their output with a\n      line `Expand: greppy expand <id>`. Run it to print the prepared evidence\n      pack — the full source of the top matches, bundled — in a single call,\n      instead of reading each file:line yourself.\n\nFLAGS (append to any command above):\n  --code            include each result's source lines (so no separate read is needed)\n  --all             return every result (turn off the default truncation)\n  --json            machine-readable output with exact counts\n  --root DIR        run against a repo other than the current directory\n  --kind KIND       (search-symbols) restrict to function|method|class|struct|enum|trait\n  --direction incoming|outgoing, --depth N   (impact) which way and how far to walk\n  --from A --to B   (path) the two endpoint symbols\n\nPrefer these over grepping a symbol name and reading every hit: who-calls /\ncallees / impact answer relationship questions directly, and semantic-search\nfinds code you cannot name.\n```\n\nWhat an agent actually pays for is **billed tokens** and **wall-clock time.**\n\nThe benchmark: **14 coding-agent models** (Claude Opus/Sonnet/Fable, GPT-5.5, Gemini, Grok, DeepSeek, Qwen, GLM, Kimi, MiniMax-M3, …), each driven by [Pi Code](https://pi.dev), answer **35 code-navigation questions** across **7 real repositories** (Rust `serde`\n\n+ `tokio`\n\n, Python `flask`\n\n+ `django`\n\n, Java `gson`\n\n, TypeScript `zod`\n\n, Go `hugo`\n\n). Every task runs twice — once with plain `grep`\n\n, once with `greppy`\n\n, **same agent, same prompt.** Answers are **floor-graded**: a pass must name the ground-truth symbol/file (each anchor rg-verified at generation time). The harness is in [ bench/agent_efficiency/](/metric-space-ai/greppy/blob/main/bench/agent_efficiency).\n\n**Correctness is the headline.** On **structural navigation** — *who-calls*, *callees*, *impact/blast-radius*, *find-symbol* — the agent answers correctly **87% of the time with greppy vs 53% with plain grep** (graded by the repo's own [ grade_answers.py](/metric-space-ai/greppy/blob/main/bench/agent_efficiency/grade_answers.py)). Across all 35 questions:\n\n**90% vs 63%.** Plain grep is cheap but frequently confidently wrong; greppy resolves the relationship in one call.\n\n| On structural navigation questions | grep | greppy |\n|---|---|---|\nAnswered correctly (floor-graded) |\n53% | 87% |\nInput tokens (median · mean saving) |\n1× | 1.2× · 2.3× fewer |\nSearch-context tokens (median · mean) |\n1× | 1.7× · 5.1× less |\nOutput tokens (median) |\n1× | 1.2× fewer |\n\nSo it is not a cost-for-accuracy trade: on structural questions greppy is **both more correct and cheaper.**\n\n**Where plain grep keeps up:** open-ended *\"how does this subsystem work\"* questions. Both tools reach the answer there (~98% correct either way), but greppy's precise locator makes the agent read more to explain the *mechanism*, so it costs a little **more**. greppy's edge is **pinpoint / structural** questions — the semantic path is being tuned to also lead the agent to the answer in one step.\n\n**The gain depends on the model.** Priced at each model's real OpenRouter list rate, the **actual dollar cost** of the structural tasks drops with greppy for most models — a **median of ~16%** cheaper — but it swings widely (from **+54%** on MiMo to **−84%** on Grok 4.3, which spirals) and does **not** track a model's general agentic-benchmark score. Benchmark your own model — most come out ahead, and every model gets the correctness lift.\n\nReal cost = each model's OpenRouter list price × tokens, summed over the structural tasks. The scatter shows the efficiency gain is real for most models but genuinely model-dependent, not something a model's agentic rank predicts.\n\n**Standard grep.** Any invocation that isn't one of the extra commands runs real`grep`\n\nand returns its output and exit code unchanged.**A precomputed code graph.** An indexed, typed symbol graph (`CALLS`\n\n/`USES`\n\n/`TYPE_REF`\n\n/`IMPORTS`\n\n) answers`who-calls`\n\n/`callees`\n\n/`find-usages`\n\n/`impact`\n\n/`path`\n\ndirectly — resolved relationships with`file:line`\n\n, not text matches — collapsing several grep+read rounds into one call.**Native semantic search.** For a natural-language query that shares no words with the code,`semantic-search`\n\nembeds the query with Google's**EmbeddingGemma** on greppy's own native Rust inference (CPU / Apple Metal / NVIDIA CUDA, auto-detected — no llama.cpp, no Python, no HTTP) and returns the nearest code spans by meaning. A small warm daemon keeps the model resident between calls and drops it after idle, so it never holds GPU memory while you're not searching.**One native Rust binary.** The EmbeddingGemma model is baked into the binary; tree-sitter parsers and SQLite are compiled in statically.\n\nEarly and evolving — the drop-in `grep`\n\ncore is solid; the intelligence layers around it are beta.\n\n**Solid:** the`grep`\n\ndrop-in and the code-graph commands (`who-calls`\n\n/`callees`\n\n/`find-usages`\n\n/`impact`\n\n/`path`\n\n/`brief`\n\n) on supported languages.**Supported languages (107):**`python`\n\n,`csharp`\n\n,`go`\n\n,`cpp`\n\n,`php`\n\n,`rust`\n\n,`swift`\n\n,`scala`\n\n,`c`\n\n,`java`\n\n,`javascript`\n\n,`typescript`\n\n,`ruby`\n\n,`bash`\n\n,`kotlin`\n\n,`fsharp`\n\n,`julia`\n\n,`ocaml`\n\n,`d`\n\n,`gdscript`\n\n,`zig`\n\n,`elm`\n\n,`erlang`\n\n,`crystal`\n\n,`gleam`\n\n,`objc`\n\n,`solidity`\n\n,`prisma`\n\n,`protobuf`\n\n,`css`\n\n,`dockerfile`\n\n,`json`\n\n,`groovy`\n\n,`lua`\n\n,`sql`\n\n,`make`\n\n,`nix`\n\n,`cmake`\n\n,`dart`\n\n,`fortran`\n\n,`elixir`\n\n,`scheme`\n\n,`vue`\n\n,`astro`\n\n,`svelte`\n\n,`verilog`\n\n,`glsl`\n\n,`hcl`\n\n,`matlab`\n\n,`r`\n\n,`purescript`\n\n,`racket`\n\n,`clojure`\n\n,`haskell`\n\n,`cuda`\n\n,`tcl`\n\n,`graphql`\n\n,`pascal`\n\n,`powershell`\n\n,`html`\n\n,`yaml`\n\n,`hlsl`\n\n,`cobol`\n\n,`fish`\n\n,`ini`\n\n,`vhdl`\n\n,`json5`\n\n,`awk`\n\n,`cairo`\n\n,`ada`\n\n,`hare`\n\n,`kdl`\n\n,`jsonnet`\n\n,`llvm`\n\n,`janet`\n\n,`jinja2`\n\n,`bicep`\n\n,`gotemplate`\n\n,`just`\n\n,`devicetree`\n\n,`liquid`\n\n,`assembly`\n\n,`hyprlang`\n\n,`gn`\n\n,`blade`\n\n,`cfml`\n\n,`cfscript`\n\n,`csv`\n\n,`bibtex`\n\n,`beancount`\n\n,`gitattributes`\n\n,`markdown`\n\n,`toml`\n\n,`xml`\n\n,`scss`\n\n,`perl`\n\n,`fennel`\n\n,`starlark`\n\n,`ron`\n\n,`dotenv`\n\n,`properties`\n\n,`po`\n\n,`diff`\n\n,`rst`\n\n,`mermaid`\n\n,`regex`\n\n,`linkerscript`\n\n. More land in each release.**Beta:**`semantic-search`\n\n— the on-device EmbeddingGemma inference is solid and the model ships inside the binary. Newer than the graph commands, so still labelled beta.\n\nNot yet production-ready — use it as a fast code-navigation aid, not a system of record.\n\nMIT — see [LICENSE](/metric-space-ai/greppy/blob/main/LICENSE). Third-party notices: [THIRD_PARTY.md](/metric-space-ai/greppy/blob/main/THIRD_PARTY.md).", "url": "https://wpnews.pro/news/greppy-a-drop-in-grep-with-code-nav-subcommands-for-ai-agents", "canonical_source": "https://github.com/metric-space-ai/greppy", "published_at": "2026-07-09 06:52:17+00:00", "updated_at": "2026-07-09 07:12:39.231258+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "ai-agents"], "entities": ["Greppy", "MiniMax-M3", "Pi Code", "Metric Space AI"], "alternates": {"html": "https://wpnews.pro/news/greppy-a-drop-in-grep-with-code-nav-subcommands-for-ai-agents", "markdown": "https://wpnews.pro/news/greppy-a-drop-in-grep-with-code-nav-subcommands-for-ai-agents.md", "text": "https://wpnews.pro/news/greppy-a-drop-in-grep-with-code-nav-subcommands-for-ai-agents.txt", "jsonld": "https://wpnews.pro/news/greppy-a-drop-in-grep-with-code-nav-subcommands-for-ai-agents.jsonld"}}