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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.32-cp313-cp313-manylinux_2_17_aarch64.whl (105.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.32-cp313-cp313-macosx_11_0_arm64.whl (103.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.32-cp312-cp312-manylinux_2_17_x86_64.whl (113.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.32-cp312-cp312-manylinux_2_17_aarch64.whl (105.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.32-cp312-cp312-macosx_11_0_arm64.whl (103.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.32-cp311-cp311-manylinux_2_17_x86_64.whl (113.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.32-cp311-cp311-manylinux_2_17_aarch64.whl (105.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.32-cp311-cp311-macosx_11_0_arm64.whl (103.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 951e7083a2a809f6bc8e42eb7a73439ac22e4bfcc214312377edb69b7760be88
MD5 b733c18cd25aa81f3b970163e963b2c1
BLAKE2b-256 1287a6aee5d71f3e932ad1a74cff31ba99a1d5eafd8c4ae8fb23f7fa7cd24adf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 0f7e78c17ff607101181c72436ba3a76fdd499b36bac7d8115187c11399c1cdc
MD5 110650ef0e4d2331b3ba6aa421cba80a
BLAKE2b-256 b7ca57e38f518187e187687fef19caddc5e78bca978eb78533349b41bb23a9ba

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f883583df6ea15e03ef453d01079b13401ec35542559a12fd443c2157ba126ce
MD5 0d3cfbf71aab70348aff8254b59be850
BLAKE2b-256 306947078fa87486936dd9dbb4b74a64fd279103e802c5428c3ec5688b841698

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a01673138bd9f2511f155b18caae1d5bf4d218243c1596a1ce1110135d68c002
MD5 90e131892ef1e0a63cf246cdbf5911be
BLAKE2b-256 e1414dfeaac26e8560925144a57f60211146807b2e4d7565b4feed85e11b3535

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 3db9fa22e8a813ff3257e8dcc1a999347eb2940f98b597a1c0d2da4d142140b0
MD5 265926bd8a03347f5eee6ffccdf4ddcd
BLAKE2b-256 7b1809c3ecceb45618ee98fcbcf7084bb2bd2abafe5cbb427d511d07c5d109f1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9cc81f858300cf4f2051e7321822987deae6d649a91da6b0446cfb9daa341df5
MD5 b7615818395955e2390c441fbb4d77b4
BLAKE2b-256 a4dc4408be39d3bf9acd107fdf3d4823d3655e0eaf16a5e211ee5b171aef0fca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fd99fc67bab68c15bbb0fa345d1cd11e5e752634bea25843dc1e902b9dd42ee9
MD5 05eaaaf08c2fcf4ee16ef5411a9d7f35
BLAKE2b-256 534ece828f0404da0563609666af4fa5b0106806c31ceedb402b6b6101f596f9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 cdc98725c72c2d3900373428975995a2c4c01ee16a4b41f015cbdfbbdc0becfe
MD5 e273a695e67384622ce15a56ffd47be3
BLAKE2b-256 a69b0b9e8cc64837aa22ce2e978a7ed4762929760a87e397ceced15268f792f3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.32-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11a9ff12cac2e8f9d9c37683c37c3f193321e04e9c6d7bb5a5fb5c4f689c7f60
MD5 708a1d931a38a9c3b097e1eeebf8b916
BLAKE2b-256 2fed8597f1707cf166faeeddde92c00a4b4488c74238d7987a2a3ce1a7b1c6bb

See more details on using hashes here.

Provenance

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