News for hackers. Stuff that matters.

Show HN: cgrep – local, code-aware search for AI coding agents

https://github.com/meghendra6/cgrep

Hi HN — I built cgrep, a local-first, code-aware search tool for AI coding agents (and humans).

The goal is to reduce noisy retrieval loops and token waste in real repositories. cgrep combines BM25 + tree-sitter symbol awareness, with optional semantic/hybrid search, and returns deterministic JSON for agent workflows.

What it does: - Code navigation: definition, references, callers, dependents - Focused context tools: read, map - Agent flow: `agent locate` -> `agent expand` (small payload first, expand only selected IDs) - MCP support: `cgrep mcp serve` + host install helpers - Agent install support: claude-code, codex, copilot, cursor, opencode

Benchmark snapshot (PyTorch, 6 implementation-tracing scenarios): - Baseline (`grep`) tokens-to-complete: 127,665 - cgrep (`agent locate/expand`) tokens-to-complete: 6,153 - 95.2% fewer tokens (20.75x smaller) - Avg retrieval latency to completion: 1321.3ms -> 22.7ms (~58.2x faster after indexing)

Links: - Repo: https://github.com/meghendra6/cgrep - Docs: https://meghendra6.github.io/cgrep/ - Benchmark method/results: https://meghendra6.github.io/cgrep/benchmarks/pytorch-agent-...

I’d really appreciate feedback on: - Real-world agent workflows I should benchmark next - MCP/agent integrations I should add - Cases where cgrep retrieval quality still falls short

( 1 comment | 2 points | on HN )
Re:Show HN: cgrep – local, code-aware search for AI coding a... by Sea_reafused on Saturday February 14, 2026 @09:22AM (#47014763)
The two-step locate/expand pattern is smart — most agent loops I've debugged waste tokens because they pull full file contents way too early. Curious how well the tree-sitter symbol extraction holds up on messier codebases with lots of metaprogramming or dynamic imports (thinking Django or SQLAlchemy-style magic). That's usually where static analysis tools start returning noise. The PyTorch benchmark is impressive but it's also a relatively well-structured codebase would love to see numbers on something gnarlier. Have you tested it on monorepos with mixed languages?