Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hhg-0.0.27-cp313-cp313-manylinux_2_17_x86_64.whl (107.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.27-cp313-cp313-manylinux_2_17_aarch64.whl (99.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.27-cp313-cp313-macosx_11_0_arm64.whl (97.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.27-cp312-cp312-manylinux_2_17_x86_64.whl (106.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.27-cp312-cp312-manylinux_2_17_aarch64.whl (99.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.27-cp312-cp312-macosx_11_0_arm64.whl (97.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.27-cp311-cp311-manylinux_2_17_x86_64.whl (107.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.27-cp311-cp311-manylinux_2_17_aarch64.whl (99.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.27-cp311-cp311-macosx_11_0_arm64.whl (97.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file hhg-0.0.27-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b551ac95e15b522407744927da3a745e3e6e72d115c367258839d5e47d1fdd8f
MD5 704828e80ec59ba4c833a7eb6ed55df8
BLAKE2b-256 47912584a4520a63cccfb1e22b043af1723e2e43873ba861eae3add6cef72d7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp313-cp313-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp313-cp313-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 5ba2e86e9b2262430ee54ec8c58b1d1d1325eef8ee7ea523ea8832a10215f74f
MD5 706066128399f44f6250b7520796df3c
BLAKE2b-256 0288cc945a36386b794e4b4b6ef61c2741719b267e290365ef2649e009f40d95

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp313-cp313-manylinux_2_17_aarch64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09c07117e3763894e2ce059ef235426db5fcbc40111d559aaf7bcce0155da7c3
MD5 5c6f066a24b1e9e4edc526655259931b
BLAKE2b-256 b4778a771563395d230bb808a26809b675f13fded6d687a4e3f4fc7b93eada38

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c135ad4be68735c2990bc0a50dac1fdad19810354169669872a1fbfd83f6ea82
MD5 27effd261d8d55aad296fb79e23c6c57
BLAKE2b-256 2018443108b4a0df9d955f289ce9a03e98b7180c77425c71f70cbe346fb67121

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp312-cp312-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp312-cp312-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 25f80fb43b598f6c49ec2dcb45a5839e55c0497816ec2dce4c2b94d0e89c385d
MD5 d4b4feefe646c00f28285da3d72a53f7
BLAKE2b-256 feb836b631704b5ed6b316455df588416a9430295f4db169a9383d6220b36d6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp312-cp312-manylinux_2_17_aarch64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 542adafa8aa90fb081a7c11e8bd70ced2407a23ca7e5fe5f95027532376534be
MD5 cc01a209b35964c91bc2297beb36126e
BLAKE2b-256 3898fead8046208e724954f2c6f8b3d35674695aa22c9f39871568c0c8850037

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 37041976450f5bdb54d6ee340f166b18ce1cf3be4593fe07d4953eabfdd17b26
MD5 44085173c0d2d5b4cce55962d71b7e1d
BLAKE2b-256 2f7bdb991d7d3a4792e385d96fd6fb7581f53244680da264ddf21d01ab6da6f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp311-cp311-manylinux_2_17_x86_64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp311-cp311-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 21586857bbe3078efaccaa38b31a964e0fd474826a7d162080e1268a58e4b29d
MD5 abc31b2f145f5fb3de251146f8833caf
BLAKE2b-256 04992fc73cc5a8c073a134722afa3ffbc020bb2390a393afd9b2da62dfe00941

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp311-cp311-manylinux_2_17_aarch64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hhg-0.0.27-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.27-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 168f171d8eda9aeec75dacf122f24560ddec53462bda5b6302d8c9b4fc5daced
MD5 f8be2df4af5541bafdd33918a729426b
BLAKE2b-256 e4a2e8efb3c79343b658e39425dd879cb772d807f3f63e544284a167a6a47208

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.27-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on nijaru/hygrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page