Skip to main content

Grep + neural reranking for code search

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

hygrep (hhg)

Semantic code search with automatic indexing

pip install hygrep
hhg "authentication flow" ./src

What it does

Search your codebase using natural language. Results are functions and classes ranked by relevance:

$ hhg "error handling" ./tests/golden
No index found. Building...
Found 4 files (0.0s)
✓ Indexed 59 blocks from 4 files (5.4s)

Searching for: error handling
api_handlers.ts:127 function errorHandler
  function errorHandler(err: Error, req: Request, res: Response, next: NextFunc...
    console.error('API Error:', err.message);

errors.rs:7 class AppError
  pub enum AppError {
      /// Database operation failed.
      Database(DatabaseError),

2 results (0.60s)

Search Modes

Mode Flag Use Case
Semantic (default) Best quality, uses embeddings + index
Fast -f No index, grep + neural rerank
Exact -e Fastest, literal string match
Regex -r Pattern matching
hhg "auth flow" ./src           # Semantic (auto-indexes on first run)
hhg -f "validate" ./src         # Grep + neural rerank (no index needed)
hhg -e "TODO" ./src             # Exact match (fastest)
hhg -r "TODO.*fix" ./src        # Regex match

Install

Requires Python 3.11-3.13 (onnxruntime lacks 3.14 support).

pip install hygrep
# or
uv tool install hygrep --python 3.13
# or
pipx install hygrep

First search builds an index automatically (stored in .hhg/). Models are downloaded from HuggingFace and cached.

Usage

hhg "query" [path]              # Search (default: current dir)
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 status [path]               # Check index status
hhg rebuild [path]              # Rebuild index from scratch
hhg clean [path]                # Delete index

Note: Options must come before positional arguments.

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

Semantic mode (default):

Query → Embed → Vector search → Results
         ↓
    Auto-indexes on first run (.hhg/)
    Auto-updates when files change

Fast mode (-f):

Query → Grep scan → Tree-sitter extract → Neural rerank → Results

Exact/Regex mode (-e/-r):

Pattern → Grep scan → Tree-sitter extract → Results

Supported Languages

Bash, C, C++, C#, Elixir, Go, Java, JavaScript, JSON, Kotlin, Lua, Mojo, PHP, Python, Ruby, Rust, Svelte, Swift, TOML, TypeScript, YAML, Zig

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.

hygrep-0.0.11-cp313-cp313-manylinux_2_17_x86_64.whl (98.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hygrep-0.0.11-cp313-cp313-macosx_11_0_arm64.whl (88.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hygrep-0.0.11-cp312-cp312-manylinux_2_17_x86_64.whl (97.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hygrep-0.0.11-cp312-cp312-macosx_11_0_arm64.whl (88.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hygrep-0.0.11-cp311-cp311-manylinux_2_17_x86_64.whl (98.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hygrep-0.0.11-cp311-cp311-macosx_11_0_arm64.whl (88.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file hygrep-0.0.11-cp313-cp313-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.11-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1ea566eddddc32542fd02fd8ea032d1055f6a54da6ec7b2a14adeb908eb31bf3
MD5 0bc7ff6f376f7586717298ba8f0e27ff
BLAKE2b-256 269dc6ced41c56de4a70ce8c5e43b56db5439ea1807b689d1a89f137381e37aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.11-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 hygrep-0.0.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d989ed7c27e31e3cd437a5eebfac198f8dbadb625bb7cdd967c06be4c6e67a4
MD5 ae9ef445690d80395c24a5b3ff0b9036
BLAKE2b-256 1242593b9c90721b9f53a1806010a3f4de2cf8d30669fd28292d225b80b68913

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.11-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 hygrep-0.0.11-cp312-cp312-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.11-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 97cd65c568f1fa159f559f6b967d8a415c8871837a3809956493bf12fe06ed0e
MD5 936dc1b7aecc5669f54d79e05cc1f883
BLAKE2b-256 869be720f5597ba68e72fb3dd73649164459a23c334b846f62b07e15f66ca7bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.11-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 hygrep-0.0.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 44ba4f434036e099af0cf8bb97e8dd35a1ef7526e6b47035989ecab0189e2bb7
MD5 e4f4b1e1343b14df1ee10d2326b47e53
BLAKE2b-256 9873b99f2b10059016f2cbc85a61526cf7b1d5d45ea7c86401b3fa8ccacf7352

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.11-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 hygrep-0.0.11-cp311-cp311-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.11-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c7a9e141690bab57e492c164d52eff83e1e9e5e6c030daf785815c9516ceed77
MD5 fb9aea721abae57bb4b1dc7f09c4116f
BLAKE2b-256 839bad7810358b97a6d446ed0af6b374d8565d03b923d3046b8064c5294985db

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.11-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 hygrep-0.0.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hygrep-0.0.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 316df3378f0e815bca28bbb26b107eea4557bd543a40101a4b04c0b7a6cd3e03
MD5 7cef3a1b6c3f66a996a97302998aae39
BLAKE2b-256 0500640afbaeee037a9a60d7f5c3e1d82a805177e8a0de49c5cc4bed3baf9d00

See more details on using hashes here.

Provenance

The following attestation bundles were made for hygrep-0.0.11-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