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.

quick install
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.

lgrep_search_symbols — query "search_semantic"
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
_meta — per call
{"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+.

Give your agent a better first move

Install it, index the repo you are working in, and let the next session start with the right file instead of a guess.

lgrep is MIT-licensed Python. Source: github.com/Sharper-Flow/lgrep.