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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.26-cp313-cp313-manylinux_2_17_aarch64.whl (99.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.26-cp313-cp313-macosx_11_0_arm64.whl (97.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.26-cp312-cp312-manylinux_2_17_x86_64.whl (106.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.26-cp312-cp312-manylinux_2_17_aarch64.whl (99.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.26-cp311-cp311-manylinux_2_17_x86_64.whl (107.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.26-cp311-cp311-manylinux_2_17_aarch64.whl (99.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.26-cp311-cp311-macosx_11_0_arm64.whl (97.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 37660fc4f0d332cb9364caef84976f1b7fbad4b7a0b2cae7f04540b05a3e14ee
MD5 485cda205ab0b61f2a1679a680ad3cf2
BLAKE2b-256 60dd9c01b32cf8b6a79bd9a2d08a99a80551262d03b947c504c8cedf61d838a6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 512203dd69cc8a6f566f2bcc8e5c03c612a3a1c02241745983362457c0cf6153
MD5 5879c08ca09f4e79f0735862ba478f66
BLAKE2b-256 8aa10962a7d93a75635ba2f3c8433657e2a2a9ac839da4422936c4520467ac96

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11e873b7e98dffaeb77587d98ee8492230f2b81f7b8ec6eb02e166bf138fdc5c
MD5 b26cec604ef8508ff2ab1bf385561f89
BLAKE2b-256 98c6dfbeecabb82a9589349b815d0b7467fa039539ad31903a1e037d0430d9b3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 80c4bc2d8d5239bf9dcec2557ece628f758233ae3383be01a78df6c8c64838ee
MD5 5ca5bea8ea5e109288de3a3607146ba0
BLAKE2b-256 6addca3146af0d1966aeb8cd9c8defca2403f2b577f1d3f4d06e2eed87e2df10

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 3f439c7938977b8e419b7afe964f4b63dcccf6cad517ba8b0734867a091e25b5
MD5 e52ce5467222a7ea695b002e0c947ac2
BLAKE2b-256 fdec7d349d2f300904928fd8e06bf7f1f0757861e06f540bc41ded8e1410d4fd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3447659546f416859af2ccdb5ba9aeea8345eadbf4f814b0b9a979da1ef64e8
MD5 d86b9d9e109400f15829cd068f95c719
BLAKE2b-256 d1038b810e5f01d08a7fc9d8010d36dc3e372de83e499ec5b13d90d13e817fee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6d8bd5274ee79b1a2815776aef0dbd07378f640c5a58e9c993bbd056ed69f5ab
MD5 e0ad87d0bf90295758cb8d72cfc5b019
BLAKE2b-256 22f44704792af0bc96e81f60f768e9fabbb15b8df0f56212d56a93ce42004a6c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 d66208b7cebeea8efd38df46df1820b10cda7220563d17ef3d4b843f39f3da27
MD5 7ca82f45c3d6f5b36203071c3be42d32
BLAKE2b-256 9c3529be7c0da98c05b60de9bd66ae855709c2afa0266cc086544e4485a9882b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.26-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1e2a820d7581e06b660ea964b551d874b38726d5b2cb8b2e8862e61c2af19c0
MD5 b19ba86734313952a7705206dadb2355
BLAKE2b-256 3bd9348a6f6efc5db5681a1f279a11315c2f36809c543f3d9fe25748bea6bfef

See more details on using hashes here.

Provenance

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