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.29-cp313-cp313-manylinux_2_17_x86_64.whl (112.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.29-cp313-cp313-manylinux_2_17_aarch64.whl (103.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.29-cp313-cp313-macosx_11_0_arm64.whl (102.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.29-cp312-cp312-manylinux_2_17_x86_64.whl (112.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.29-cp312-cp312-manylinux_2_17_aarch64.whl (103.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.29-cp312-cp312-macosx_11_0_arm64.whl (101.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.29-cp311-cp311-manylinux_2_17_x86_64.whl (111.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.29-cp311-cp311-manylinux_2_17_aarch64.whl (103.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.29-cp311-cp311-macosx_11_0_arm64.whl (101.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.29-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 89cb7ab1d2f4fa7034dd19d16b0c97818017ceb0219bd03db657653751e7e355
MD5 8487a201e0bfb66cb0eb3c02233ece7f
BLAKE2b-256 5ec59b3a2ce2111ae6a9d7fbc8cae391b5d3adf8aaadb55261346e8ba877c8d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp313-cp313-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9132ca370069d7ae4ffd56df7556d95e54a4b1674dd1122eb3e821c40975fe3e
MD5 9f02c769a05c8f81bd5dced5c21c2101
BLAKE2b-256 76a008e2063b7c1e8ed7534cdda70ecaef805440c8588ceec30bcf6b907d41df

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21072d9f6f71db036350577887a793b4c51c91d997a9be9be6d7d238f10d7081
MD5 f08cecdf558bf521c6ffd17cb2cd5cba
BLAKE2b-256 978dc827548f12fc526e7a23411a24475620677aed4213b36e405ac904143811

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 daaed9d0c245881b429ebe36f4079a7d5731b2fe5a6f06576486aca45c346660
MD5 e068d1bb75ac0807478cb8feed00870a
BLAKE2b-256 85ff7e22e85d750a892be68ab359bbd1d3904397d01667c18f50a06a7faf2ab0

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp312-cp312-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9a41f890ba153602969e676a08c547817d47763774b7f420ba270f9d74031473
MD5 31536cbe57a14a9fba30cceb7b960dfb
BLAKE2b-256 9eb661b7340127d71c5fa20563683ea0f1cf0cb294e978af57b275db788ac1f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75e52b1864633f0d9ae6cc7dc4041616f4276d1f46c41c516e2d3097625780fe
MD5 f22e4a7217e76fca7ae2777c6b09c4fc
BLAKE2b-256 e778109ece353bc1534376a752d7fc0074c6695a77e395bb0fb0e136b09ae8b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b51c4cadb9adbf071e65ea9d3d69cd6443f8c25be81ac77d7313ad9787c5e3d5
MD5 fbd6a283235b38b0ae75070f5ce3cd54
BLAKE2b-256 4e1c7e70a09322eee9adc842057d631b6a2c362315875fd09bd6a59a16b8b140

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp311-cp311-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 0f26bcd35d9a050a0b50ad174c0bffd792b2c5a6500c3d264ccf1332fd389799
MD5 40d21a27086775ca9b8226172daacfb7
BLAKE2b-256 2d34d4e2c80a8dbd8a4d7654f0d532db4f67ff660501d600fb93a45f771272a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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.29-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hhg-0.0.29-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3550bffa70d1d118ceb39ab6d54e48902eae58af4da31efb257427e3b2d3981a
MD5 73fb55c094b07f2fb826b24c78bc3701
BLAKE2b-256 2c225185179b138f82f8e3506d2d9f4bb2e8e0b447d2c1611daf0f898387a3f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hhg-0.0.29-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