Plug slicegrep into Claude Code, Cursor, or Windsurf via MCP so the AI pulls only relevant code slices instead of full files.
Search a codebase from the command line with a regex or plain language question and get ranked, budget-capped results.
Import slicegrep as a Python library to build custom code-search tooling with structured output.
| haxo98098/slicegerp | 0xallam/my-recipe | 0xhassaan/nn-from-scratch | |
|---|---|---|---|
| Stars | 0 | — | 0 |
| Language | Python | Python | Python |
| Last pushed | — | 2022-11-22 | — |
| Maintenance | — | Dormant | — |
| Setup difficulty | easy | moderate | moderate |
| Complexity | 2/5 | 2/5 | 4/5 |
| Audience | developer | general | developer |
Figures from each repo's GitHub metadata at analysis time.
Zero dependencies for the core install, the MCP server needs Python 3.10 or newer.
slicegrep is a search tool built for AI coding assistants and the humans who work alongside them. Regular grep gives you matching lines with no surrounding context, and reading a whole file gives you context but wastes a lot of space on code that does not matter. slicegrep sits between those two options. It searches a file or folder, pulls out only the relevant pieces of code, ranks them by how useful they are, removes near duplicate results, and keeps the total output under a token limit you set. It also tells you when it did not find something, which is useful information on its own. You can use it three ways: as a command you type in a terminal, as a Python library you import into your own code, or as an MCP server that plugs directly into tools like Claude Desktop, Claude Code, Cursor, and Windsurf so an AI model can pull code context on its own. It accepts either a regex pattern or a plain language question, and longer phrases with several meaningful words are automatically expanded to catch related wording. The project has no required dependencies beyond Python's standard library, and needs Python 3.8 or newer, with 3.10 or newer if you want the optional MCP server. It also ships a shorter alias, fr, so you can type less. Under the hood, results are scored using signals like whether a match sits near other matches, whether it contains distinctive naming rather than generic boilerplate, and whether it is where something is actually defined rather than just referenced. Matches that are only declarations, mostly comments, or from generated or vendored code get pushed down the list. The README includes benchmark tables comparing slicegrep against other retrieval methods such as dense embeddings, BM25, and TF-IDF across several test suites, with slicegrep scoring competitively or best in most of them. This is a developer tool aimed at people building or using AI coding agents who want those agents to read less code while still finding the right answer.
A search tool that returns only the relevant, ranked pieces of code instead of whole files, built to save tokens for AI coding assistants.
Mainly Python. The stack also includes Python, MCP, CLI.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.