Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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

Release files for hhg 0.0.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for hhg 0.0.32
File
hhg-0.0.32-cp313-cp313-manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
hhg-0.0.32-cp313-cp313-manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
hhg-0.0.32-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
hhg-0.0.32-cp312-cp312-manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
hhg-0.0.32-cp312-cp312-manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
hhg-0.0.32-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
hhg-0.0.32-cp311-cp311-manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
hhg-0.0.32-cp311-cp311-manylinux_2_17_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
hhg-0.0.32-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 963.9 kB

Release files / hhg-0.0.32-cp313-cp313-manylinux_2_17_x86_64.whl

Download URL hhg-0.0.32-cp313-cp313-manylinux_2_17_x86_64.whl
Size 113.2 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
951e7083a2a809f6bc8e42eb7a73439ac22e4bfcc214312377edb69b7760be88
BLAKE2b-256 checksum
How to use checksums
1287a6aee5d71f3e932ad1a74cff31ba99a1d5eafd8c4ae8fb23f7fa7cd24adf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp313-cp313-manylinux_2_17_aarch64.whl

Download URL hhg-0.0.32-cp313-cp313-manylinux_2_17_aarch64.whl
Size 105.0 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
0f7e78c17ff607101181c72436ba3a76fdd499b36bac7d8115187c11399c1cdc
BLAKE2b-256 checksum
How to use checksums
b7ca57e38f518187e187687fef19caddc5e78bca978eb78533349b41bb23a9ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp313-cp313-macosx_11_0_arm64.whl

Download URL hhg-0.0.32-cp313-cp313-macosx_11_0_arm64.whl
Size 103.0 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f883583df6ea15e03ef453d01079b13401ec35542559a12fd443c2157ba126ce
BLAKE2b-256 checksum
How to use checksums
306947078fa87486936dd9dbb4b74a64fd279103e802c5428c3ec5688b841698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp312-cp312-manylinux_2_17_x86_64.whl

Download URL hhg-0.0.32-cp312-cp312-manylinux_2_17_x86_64.whl
Size 113.2 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a01673138bd9f2511f155b18caae1d5bf4d218243c1596a1ce1110135d68c002
BLAKE2b-256 checksum
How to use checksums
e1414dfeaac26e8560925144a57f60211146807b2e4d7565b4feed85e11b3535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp312-cp312-manylinux_2_17_aarch64.whl

Download URL hhg-0.0.32-cp312-cp312-manylinux_2_17_aarch64.whl
Size 105.0 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
3db9fa22e8a813ff3257e8dcc1a999347eb2940f98b597a1c0d2da4d142140b0
BLAKE2b-256 checksum
How to use checksums
7b1809c3ecceb45618ee98fcbcf7084bb2bd2abafe5cbb427d511d07c5d109f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp312-cp312-macosx_11_0_arm64.whl

Download URL hhg-0.0.32-cp312-cp312-macosx_11_0_arm64.whl
Size 103.2 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9cc81f858300cf4f2051e7321822987deae6d649a91da6b0446cfb9daa341df5
BLAKE2b-256 checksum
How to use checksums
a4dc4408be39d3bf9acd107fdf3d4823d3655e0eaf16a5e211ee5b171aef0fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp311-cp311-manylinux_2_17_x86_64.whl

Download URL hhg-0.0.32-cp311-cp311-manylinux_2_17_x86_64.whl
Size 113.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fd99fc67bab68c15bbb0fa345d1cd11e5e752634bea25843dc1e902b9dd42ee9
BLAKE2b-256 checksum
How to use checksums
534ece828f0404da0563609666af4fa5b0106806c31ceedb402b6b6101f596f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp311-cp311-manylinux_2_17_aarch64.whl

Download URL hhg-0.0.32-cp311-cp311-manylinux_2_17_aarch64.whl
Size 105.0 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
cdc98725c72c2d3900373428975995a2c4c01ee16a4b41f015cbdfbbdc0becfe
BLAKE2b-256 checksum
How to use checksums
a69b0b9e8cc64837aa22ce2e978a7ed4762929760a87e397ceced15268f792f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log

Release files / hhg-0.0.32-cp311-cp311-macosx_11_0_arm64.whl

Download URL hhg-0.0.32-cp311-cp311-macosx_11_0_arm64.whl
Size 103.2 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
11a9ff12cac2e8f9d9c37683c37c3f193321e04e9c6d7bb5a5fb5c4f689c7f60
BLAKE2b-256 checksum
How to use checksums
2fed8597f1707cf166faeeddde92c00a4b4488c74238d7987a2a3ce1a7b1c6bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 17, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page