Index-free grep-based retrieval primitives for AI agent tool loops
Project description
grepsearch
Index-free, grep-based retrieval primitives for AI agent tool loops. The engine is the ripgrep search core, compiled into a native Python extension, so every query runs at Rust speed with no subprocess overhead and no index to build or sync.
Grep-based retrieval works by running search tools in a reasoning loop instead of pre-embedding a corpus into a vector index. Every query reads the live filesystem, so results are never stale. This package provides the search side of that loop; your agent framework provides the reasoning.
Installation
pip install grepsearch
Prebuilt wheels cover Linux (x86_64, aarch64), macOS (Apple silicon, Intel), and Windows (x64) for Python 3.9 and newer.
Usage
from grepsearch import SearchEngine
engine = SearchEngine("path/to/repo")
# Content search with budgets sized for a context window
result = engine.grep(
"fn authenticate",
literal=True,
context_after=5,
max_results=40,
max_bytes=32_000,
)
for file in result.files:
for match in file.matches:
print(f"{file.path}:{match.line_number}: {match.line}")
# The result serializes straight into a tool output for a model
tool_output = result.to_json()
# Follow up around a promising hit
piece = engine.read_lines("src/auth.rs", 40, 80)
# Orient in the repository
for entry in engine.list_dir(".", max_depth=2):
print(entry.path)
# Find files by name
hits = engine.find_files("**/*.toml")
Every grep result carries a truncated flag. When a budget cap stops the search early, the flag tells the caller that more matches may exist, which prevents an agent from mistaking a capped result for a complete one.
Behavior
- Gitignore, ignore, and hidden file rules are honored by default; disable per engine with
respect_gitignore=Falseorinclude_hidden=True - Binary files are detected and skipped
- Searches run in parallel across files and release the interpreter lock while running
- Result ordering is deterministic: files with more matches first, then shallower paths, then lexicographic
- Errors map to familiar Python exceptions:
ValueErrorfor bad patterns, globs, and line ranges;FileNotFoundErrorfor missing paths
Rust
The same engine ships as a Rust crate for agents and CLIs built in Rust: https://crates.io/crates/grepsearch
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grepsearch-0.1.54.tar.gz.
File metadata
- Download URL: grepsearch-0.1.54.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a7eb4760b023fbb0029975fab16903df645f7a062bfb7847e63c147d512c349
|
|
| MD5 |
79cc80d30b863ea74d10a5db5bf64fd3
|
|
| BLAKE2b-256 |
368e3192bc080e4bd12b764c25057dcf433268d48390681dcb9fc91ef82922fe
|
Provenance
The following attestation bundles were made for grepsearch-0.1.54.tar.gz:
Publisher:
release.yml on jagguvarma15/grepsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grepsearch-0.1.54.tar.gz -
Subject digest:
9a7eb4760b023fbb0029975fab16903df645f7a062bfb7847e63c147d512c349 - Sigstore transparency entry: 2210260287
- Sigstore integration time:
-
Permalink:
jagguvarma15/grepsearch@8c461559b77171b9751b644b46b436b2cbf34bcd -
Branch / Tag:
refs/tags/v0.1.54 - Owner: https://github.com/jagguvarma15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c461559b77171b9751b644b46b436b2cbf34bcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file grepsearch-0.1.54-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: grepsearch-0.1.54-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b72c840452f0aee97c3467d057638e3db09b6386fbbe2563bf3ef197020eeab6
|
|
| MD5 |
0eda9308ecec280a178029d77926b23e
|
|
| BLAKE2b-256 |
2e0feafeeeec4486476396931ad283fe0492da17f09e4ba2434de5228948c3e2
|
Provenance
The following attestation bundles were made for grepsearch-0.1.54-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on jagguvarma15/grepsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grepsearch-0.1.54-cp39-abi3-win_amd64.whl -
Subject digest:
b72c840452f0aee97c3467d057638e3db09b6386fbbe2563bf3ef197020eeab6 - Sigstore transparency entry: 2210260432
- Sigstore integration time:
-
Permalink:
jagguvarma15/grepsearch@8c461559b77171b9751b644b46b436b2cbf34bcd -
Branch / Tag:
refs/tags/v0.1.54 - Owner: https://github.com/jagguvarma15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c461559b77171b9751b644b46b436b2cbf34bcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35cff4694abc8cdc87e6d82e006f7a310b376dd85606d654f1af96b53900b11a
|
|
| MD5 |
05f449ee303404cb7d579f41ce1cda37
|
|
| BLAKE2b-256 |
51eb79a22a8cb60246de0bd2c8dd68282931cba7c885d7bbf7ee2846d5025c85
|
Provenance
The following attestation bundles were made for grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on jagguvarma15/grepsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grepsearch-0.1.54-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
35cff4694abc8cdc87e6d82e006f7a310b376dd85606d654f1af96b53900b11a - Sigstore transparency entry: 2210260381
- Sigstore integration time:
-
Permalink:
jagguvarma15/grepsearch@8c461559b77171b9751b644b46b436b2cbf34bcd -
Branch / Tag:
refs/tags/v0.1.54 - Owner: https://github.com/jagguvarma15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c461559b77171b9751b644b46b436b2cbf34bcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70cf7bc37067a9cc545e43538972d04047a444042c8f11f19aa22f00639f5f89
|
|
| MD5 |
f02fa6846b6010fe3a3fc1faaa3ac638
|
|
| BLAKE2b-256 |
180510853d03b34e079471254f6d46e76324a66909dce2abdfff627f97e0e1f0
|
Provenance
The following attestation bundles were made for grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on jagguvarma15/grepsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grepsearch-0.1.54-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
70cf7bc37067a9cc545e43538972d04047a444042c8f11f19aa22f00639f5f89 - Sigstore transparency entry: 2210260415
- Sigstore integration time:
-
Permalink:
jagguvarma15/grepsearch@8c461559b77171b9751b644b46b436b2cbf34bcd -
Branch / Tag:
refs/tags/v0.1.54 - Owner: https://github.com/jagguvarma15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c461559b77171b9751b644b46b436b2cbf34bcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cc145b056389237315019129609903b58e8c8a52418faa014407b9aed17b9aa
|
|
| MD5 |
787afa2fb58a7fa9f36f9ad724b2a9ec
|
|
| BLAKE2b-256 |
7a0a471c8094c7aa5c1a4a992f953741b8601208e26fcb0eaa0dc6fde07cd6a2
|
Provenance
The following attestation bundles were made for grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on jagguvarma15/grepsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grepsearch-0.1.54-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
4cc145b056389237315019129609903b58e8c8a52418faa014407b9aed17b9aa - Sigstore transparency entry: 2210260326
- Sigstore integration time:
-
Permalink:
jagguvarma15/grepsearch@8c461559b77171b9751b644b46b436b2cbf34bcd -
Branch / Tag:
refs/tags/v0.1.54 - Owner: https://github.com/jagguvarma15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c461559b77171b9751b644b46b436b2cbf34bcd -
Trigger Event:
push
-
Statement type:
File details
Details for the file grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e0a72b93f22a69d26dce377814c7a60fdc24bc85c5e8036acc1ea47933948b
|
|
| MD5 |
322e32d121e062a79d6e86122d67d24d
|
|
| BLAKE2b-256 |
35c3f611444648726a28096d4ac0570be3de1933eeac2986699bc08c513c1ff9
|
Provenance
The following attestation bundles were made for grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on jagguvarma15/grepsearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grepsearch-0.1.54-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
29e0a72b93f22a69d26dce377814c7a60fdc24bc85c5e8036acc1ea47933948b - Sigstore transparency entry: 2210260364
- Sigstore integration time:
-
Permalink:
jagguvarma15/grepsearch@8c461559b77171b9751b644b46b436b2cbf34bcd -
Branch / Tag:
refs/tags/v0.1.54 - Owner: https://github.com/jagguvarma15
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8c461559b77171b9751b644b46b436b2cbf34bcd -
Trigger Event:
push
-
Statement type: