Hybrid file search — semantic + keyword matching
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
hhg (hybrid grep)
Hybrid file search — semantic + keyword matching
pip install hhg
hhg build ./src
hhg "authentication flow" ./src
What it does
Search code and text using natural language. Combines semantic understanding with keyword matching (BM25) for accurate results:
$ hhg build ./src # Build index first
Found 40 files (0.0s)
✓ Indexed 646 blocks from 40 files (34.2s)
$ hhg "error handling" ./src # Then search
api_handlers.ts:127 function errorHandler
function errorHandler(err: Error, req: Request, res: Response, next: NextFunc...
errors.rs:7 class AppError
pub enum AppError {
Database(DatabaseError),
2 results (0.52s)
Why hhg over grep?
grep finds exact text. hhg understands what you're looking for.
| Query | grep finds | hhg finds |
|---|---|---|
| "error handling" | Comments mentioning it | errorHandler(), AppError |
| "authentication" | Strings containing "auth" | login(), verify_token() |
| "database" | Config files, comments | Connection, query(), Db |
Hybrid search combines semantic understanding (finds related concepts) with BM25 keyword matching (finds exact terms). Best of both worlds.
Use grep/ripgrep for exact strings (TODO, FIXME, import statements).
Use hhg when you want implementations, not mentions.
Install
Requires Python 3.11-3.13 (onnxruntime lacks 3.14 support).
pip install hhg
# or
uv tool install hhg
# or
pipx install hhg
The embedding model (jina-code-int8) downloads on first use (~154MB).
Usage
hhg build [path] # Build/update index (required first)
hhg "query" [path] # Semantic search
hhg status [path] # Check index status
hhg list [path] # List all indexes under path
hhg clean [path] # Delete index
hhg clean [path] -r # Delete index and all sub-indexes
# Options
hhg -n 5 "error handling" . # Limit results
hhg --json "auth" . # JSON output for scripts/agents
hhg -l "config" . # List matching files only
hhg -t py,js "api" . # Filter by file type
hhg --exclude "tests/*" "fn" . # Exclude patterns
hhg --exclude "*.md" "api" . # Code only (exclude docs)
# Model
hhg model # Check if model is installed
hhg model install # Download model (auto-downloads on first use)
Note: Options go before positional args, or use -- separator:
hhg --exclude "*.md" "api" . # Options first
hhg "api" . -- --exclude "*.md" # Or use -- separator
Output
Default:
src/auth.py:42 function login
def login(user, password):
"""Authenticate user and create session."""
...
JSON (--json):
[
{
"file": "src/auth.py",
"type": "function",
"name": "login",
"line": 42,
"end_line": 58,
"content": "def login(user, password): ...",
"score": 0.87
}
]
Compact JSON (--json --compact): Same fields without content.
How it Works
Query → Embed → Hybrid search (semantic + BM25) → Results
↓
Requires 'hhg build' first (.hhg/)
Auto-updates stale files on search
Supported Files
Code (22 languages): Bash, C, C++, C#, Elixir, Go, Java, JavaScript, JSON, Kotlin, Lua, Mojo, PHP, Python, Ruby, Rust, Svelte, Swift, TOML, TypeScript, YAML, Zig
Text: Markdown, plain text, RST — smart chunking with header context for docs, blog posts, research papers
Development
git clone https://github.com/nijaru/hygrep && cd hygrep
pixi install && pixi run build-ext && pixi run test
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 Distributions
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 hhg-0.0.18-cp313-cp313-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: hhg-0.0.18-cp313-cp313-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 103.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edaef21783cde6fcfc1be3e81df28fe50c045a2ed5729580bffe05bc39a046bf
|
|
| MD5 |
2ca86f3dc516cf221a77d02b11e3b7a8
|
|
| BLAKE2b-256 |
a9ddcb8c323d07706f3fe8c73e1875db137ff16e7f97a2dc2465c88d86fa0e7a
|
Provenance
The following attestation bundles were made for hhg-0.0.18-cp313-cp313-manylinux_2_17_x86_64.whl:
Publisher:
release.yml on nijaru/hygrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hhg-0.0.18-cp313-cp313-manylinux_2_17_x86_64.whl -
Subject digest:
edaef21783cde6fcfc1be3e81df28fe50c045a2ed5729580bffe05bc39a046bf - Sigstore transparency entry: 767397892
- Sigstore integration time:
-
Permalink:
nijaru/hygrep@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nijaru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file hhg-0.0.18-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: hhg-0.0.18-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 93.1 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc8834abb593182916ffe8b6d8391ed0fbd9b30a8d0eb648d7918e06ac5206c5
|
|
| MD5 |
1eaa26c8d7eef3a320813d5de0b3fe88
|
|
| BLAKE2b-256 |
91b162915684c5484c7c73d6d17b18cad1f9083ea31fef228baaafddcffec6d4
|
Provenance
The following attestation bundles were made for hhg-0.0.18-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
release.yml on nijaru/hygrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hhg-0.0.18-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
bc8834abb593182916ffe8b6d8391ed0fbd9b30a8d0eb648d7918e06ac5206c5 - Sigstore transparency entry: 767397922
- Sigstore integration time:
-
Permalink:
nijaru/hygrep@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nijaru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file hhg-0.0.18-cp312-cp312-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: hhg-0.0.18-cp312-cp312-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 103.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f738aec3eb7087cbfbf299878efe3a661aa8e14b0cd97a8fdcd9d3287636aaf0
|
|
| MD5 |
f6959e803f79d156471e4e70f9f41a84
|
|
| BLAKE2b-256 |
099c9596dc3309d13e1fcf1127753aa8951ecef43b0c62dce240814ca88ed846
|
Provenance
The following attestation bundles were made for hhg-0.0.18-cp312-cp312-manylinux_2_17_x86_64.whl:
Publisher:
release.yml on nijaru/hygrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hhg-0.0.18-cp312-cp312-manylinux_2_17_x86_64.whl -
Subject digest:
f738aec3eb7087cbfbf299878efe3a661aa8e14b0cd97a8fdcd9d3287636aaf0 - Sigstore transparency entry: 767397906
- Sigstore integration time:
-
Permalink:
nijaru/hygrep@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nijaru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file hhg-0.0.18-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: hhg-0.0.18-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 93.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eebd2572175264e45bbd8b738bb52cc8bf8b79a0e65e24e3db2d521cb1c86688
|
|
| MD5 |
89123d7eee8372b0bd1c1c61d40c47ea
|
|
| BLAKE2b-256 |
7b50c147098e35d46bfc12b7de20f685f703a248155cb147763141e709022bc0
|
Provenance
The following attestation bundles were made for hhg-0.0.18-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
release.yml on nijaru/hygrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hhg-0.0.18-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
eebd2572175264e45bbd8b738bb52cc8bf8b79a0e65e24e3db2d521cb1c86688 - Sigstore transparency entry: 767397946
- Sigstore integration time:
-
Permalink:
nijaru/hygrep@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nijaru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file hhg-0.0.18-cp311-cp311-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: hhg-0.0.18-cp311-cp311-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 103.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
767d8c449e89959353433ed774c20f05de1f6d2257d6c28b7301da0d7a4b9dd7
|
|
| MD5 |
f7bac796902790d652c4dc464eff1886
|
|
| BLAKE2b-256 |
527bd3b9ccb068c4447e10469edf3af1d1c91f3179a0cfbabe44e5bc563977c7
|
Provenance
The following attestation bundles were made for hhg-0.0.18-cp311-cp311-manylinux_2_17_x86_64.whl:
Publisher:
release.yml on nijaru/hygrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hhg-0.0.18-cp311-cp311-manylinux_2_17_x86_64.whl -
Subject digest:
767d8c449e89959353433ed774c20f05de1f6d2257d6c28b7301da0d7a4b9dd7 - Sigstore transparency entry: 767397929
- Sigstore integration time:
-
Permalink:
nijaru/hygrep@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nijaru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file hhg-0.0.18-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: hhg-0.0.18-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 93.1 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88166e6c9e36ab0bc7a83749845ca05c321026d210716c3f8f0a8fbd977e8439
|
|
| MD5 |
dfc55ea906c56b3909bc8116f76554c3
|
|
| BLAKE2b-256 |
e3880021195f5f534b52172c7d61924c7b2ac63eb25d4b5c480b8a103f050fb0
|
Provenance
The following attestation bundles were made for hhg-0.0.18-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
release.yml on nijaru/hygrep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hhg-0.0.18-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
88166e6c9e36ab0bc7a83749845ca05c321026d210716c3f8f0a8fbd977e8439 - Sigstore transparency entry: 767397954
- Sigstore integration time:
-
Permalink:
nijaru/hygrep@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nijaru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f357e884da105d2f6efcf8c1a39b110c8086a803 -
Trigger Event:
workflow_dispatch
-
Statement type: