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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.31-cp313-cp313-manylinux_2_17_aarch64.whl (103.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.31-cp313-cp313-macosx_11_0_arm64.whl (101.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.31-cp312-cp312-manylinux_2_17_x86_64.whl (110.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.31-cp312-cp312-manylinux_2_17_aarch64.whl (103.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.31-cp311-cp311-manylinux_2_17_x86_64.whl (110.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.31-cp311-cp311-manylinux_2_17_aarch64.whl (103.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.31-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.31-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hhg-0.0.31-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 383576b3354910a085569a4c623c62809263be093ce30cce4810a4061d9d9f98
MD5 15853d5a784622d35843ccfa08d44265
BLAKE2b-256 dabd7a6f73c008421edac07912e344d45ab12fca6e2b15836385a2d34aa1d0c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 56452303d09011c181f34147ffe5ff1ed918b630134e21613d5c68830f77f90b
MD5 b5b18663628cba3ddc4ee43b4de0aaf1
BLAKE2b-256 06afb314d24f881a7d864b9f5c3297c1993a00aa178da4fe27ecf46a04a184c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad9a141ee6ccf81bca5f4460cbb455912d6f74be74f84562e0dce5a59226597b
MD5 119bed4e6456d36d64bdff1c3a73ef3b
BLAKE2b-256 da50b3581d8e0f73a017269b6ce091c03bfe1a6974fc1239763ee92607c16511

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 caeda9e65c8f4dbd57e21f469c09ae5452afb160641f531d5bcf10c427a9feab
MD5 591f296a00099ea3aab1096d44fd44e7
BLAKE2b-256 359434379264de78592e0991908a9c8c5ae545d588865e5111f15a9b692f3eda

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 a918949830fdca9074ac2f36604439e571117a327783a20d3ff3a06984b2e042
MD5 c1b8c3cdbb3e22f126bb86fa8b4a0247
BLAKE2b-256 ade0b7181ed16afc9149e8ed6ef052fe0f808ba44a5b42a49ce9b5d33ee71a02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fa1471829f3ad45940827485aed4db49b0a78019a51a5dff7987426e4770a79
MD5 b145d37648778c5ffb9e91daa05f57d1
BLAKE2b-256 eae55ee9caeb18ba7f6946fe18e345bddda8bc69be028c4c495457c047949452

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c3bd3aeefe9b20b3508c92feccb9aa2e95c50038d304f7a2b4b27ad5783ec632
MD5 bdf502ff90433deaf6b70da7729a1bbf
BLAKE2b-256 0e36f50c70e3b8894f0b19ba81f2c7d90ac48e6a48dbe3f2210b606743fbd168

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 3978135349823515707766a358b39082821200008add33aabf2a0e502957e777
MD5 da8c4eb135bf13aebad73fc613200926
BLAKE2b-256 cc38129d68da93cca2f823f61623c608bf4fc63997522dcc5e54f357de560d51

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.31-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e982c44d9d0eb1f19513340cfb21e58462f217f98189aabb960d92d14c6ba37
MD5 68029543041a80e7ae3dd2e7cd779e69
BLAKE2b-256 276af1d70a2e2c0aabe0bd8a6c012b96c8ed8a0b269145b9189d3e05bcdbaa68

See more details on using hashes here.

Provenance

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