SharperFlow Open Source
lgrep
Local-first code intelligence for OpenCode. Search by meaning when you do not know the symbol yet; pivot to exact symbol tools when you do.
pip install git+https://github.com/Sharper-Flow/lgrep.git lgrep install-opencode
Python 3.11+. Semantic search needs a Voyage API key; symbol tools work without one.
the problem
Agents fail on the first move
AI coding agents usually fail early, not late. The first move is retrieval, and grep cannot answer a concept question. Full-file reads burn context on code the answer never needed.
- grep cannot answer "where is auth enforced?"
- Full-file reads waste tokens on irrelevant code
- The right symbol name is often unknown when the search starts
proof
A real query, a real result
Captured from the lgrep MCP server this site was built with. Machine-specific counters stripped.
src/lgrep/cli.py:function:_cmd_search_semantic kind: function "One-shot semantic search against an already-indexed project." src/lgrep/server/tools_semantic.py:function:search_semantic kind: function "Search code semantically using natural language." total_matches: 9
{"tool": "lgrep.tools.search_symbols",
"timing_ms": 124.35, "tokens_saved": 1350} What the symbol engine returned instead of reading the two files whole: two entries, 124 ms.
how it works
Two engines, one server
Semantic engine
Natural-language search over voyage-code-4 embeddings with local LanceDB storage. Ask the question you actually have.
Symbol engine
Tree-sitter parsing with a local JSON index: exact lookup, file and repo outlines, targeted source retrieval.
Hybrid retrieval
Vector similarity and keyword matching combined, with reranking, by default.
One warm server
A single MCP server shared across OpenCode sessions and agents, with per-repo caching.
under the hood
Local-first by design
Your working tree stays local and searchable as it evolves. Symbol lookup never leaves the machine and needs no API key. Only short semantic queries and indexing payloads go to the embedding provider.
- Install
- pip install from GitHub, then lgrep install-opencode wires the MCP server, tools, and skill into OpenCode.
- Engines
- Voyage Code 4 for meaning, tree-sitter for structure.
- License
- MIT, Python 3.11+.