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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hhg-0.0.23-cp313-cp313-manylinux_2_17_aarch64.whl (97.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

hhg-0.0.23-cp313-cp313-macosx_11_0_arm64.whl (95.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hhg-0.0.23-cp312-cp312-manylinux_2_17_x86_64.whl (105.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hhg-0.0.23-cp312-cp312-manylinux_2_17_aarch64.whl (97.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

hhg-0.0.23-cp312-cp312-macosx_11_0_arm64.whl (95.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hhg-0.0.23-cp311-cp311-manylinux_2_17_x86_64.whl (105.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hhg-0.0.23-cp311-cp311-manylinux_2_17_aarch64.whl (97.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

hhg-0.0.23-cp311-cp311-macosx_11_0_arm64.whl (95.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8e87249fbcd3a493fbd05b8eab61e9abce02e68a4bfd68ef5569845ccd171532
MD5 66d68c09363bc2e6feffc640fc52dc66
BLAKE2b-256 f375bd9f292145b89aaf6df28eef6fe47d0407abbcdcfcda0e6375a790e6da03

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp313-cp313-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 b93fca0c0c1bb6ec91d7e9c30021e5a30170ef9e9e00829fd2d0e47b4db6c5be
MD5 96ed8687d1300f82190d5504902ff8ef
BLAKE2b-256 5271aec2b43374c2aef985b14e70e7c90f265a92dbf5f7b03cf7d6203830979c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee4ee33189e585211c28ac052b7c46162ca549edf78a22400b69564f978a5df9
MD5 61048d4954d6e26369f656ca23ae9eff
BLAKE2b-256 5b4d7036247b781b57ad3aae8b45cf13354d7b82f4afd424a99b1003e8e98cce

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1658f05c1b9f09cc0ab1e5db2c3dd87985ba24edbeee1080f913047ffa6ce84c
MD5 66e610aed4deaf3453b7de07c7bf5587
BLAKE2b-256 6953fae044744ff08be5559c6c2a21ee58506f5f2374b03562f8e724bbca248a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp312-cp312-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 14e45785666d791e2d2dd2c13cf02e87bf17b28c351fc44586761ebc17d7fb7e
MD5 e2bbcace1d0b36ae18e50d9ae7e92c48
BLAKE2b-256 dde9851edc9fa03f373152668582657855e85a1ffb61736cc229456d5a5c1026

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13f685b5713ce98a50dcf1725a6c44398f46322b78ab50fd9abdfbdbd23c8045
MD5 b549062478f49923e3f0e08acbd60d9d
BLAKE2b-256 e2d48f024a9b30cf678071996c805c9f77142e17ec500ef85ea86f2cb4c25a37

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 12953e02f5888c15f7b87a558771e59572b73bea8b78bcecb5f9662a095fc87b
MD5 21add795e62f59669ec0cf0a74474c48
BLAKE2b-256 ffc29cf969737e32736093b14930b343715ec71cda3b9696bcf4e270ebe888cf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp311-cp311-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 300243acdbf54fa4c4b26779405ea853ad51c80a4a8e839d1d3d1a18e85ca119
MD5 86942404ffa972327faad4b34c18e4c3
BLAKE2b-256 9d24a99973906e19292aceace5d77d2d40df5bea414cb36d12df91af4e733164

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hhg-0.0.23-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4d7e71116dfaef7b395c81f213ff6a4772084b5e28ce14a2733d4faf4abca1f
MD5 ab2b0ded34229dce28d545261a61754e
BLAKE2b-256 4ac19fcff21e4b867f21e477dac378698cb7fdf8c9c03e547f420b62eb75743b

See more details on using hashes here.

Provenance

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