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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

hygrep-0.0.12-cp313-cp313-macosx_11_0_arm64.whl (89.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hygrep-0.0.12-cp312-cp312-manylinux_2_17_x86_64.whl (99.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hygrep-0.0.12-cp312-cp312-macosx_11_0_arm64.whl (89.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hygrep-0.0.12-cp311-cp311-manylinux_2_17_x86_64.whl (99.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hygrep-0.0.12-cp311-cp311-macosx_11_0_arm64.whl (89.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hygrep-0.0.12-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bdd1238c72f3c65583f64e88db5b412f37559163b6966563ed29820bf52c218b
MD5 147b9e169e24e31e6773768ccfaedf0c
BLAKE2b-256 dbcaf509c6beb7ed00382d6ba7a236d89a902cf9b7104464a23f8347f2c4de52

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18385a109b13e9146575d488a5dd6e3c0bb3ea5fdd6884ae59cefec9b71df8d6
MD5 91ac8f4035b15aceccb8fd2f94e72f5e
BLAKE2b-256 66208f8d6ecd076bd63e98336079373fbb8290b47a22db5c4cbc01c5ae0d0287

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.12-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6c1e1324475078f55a575ee48053734145a0622bd6f51349ec522ac0a59bbe5d
MD5 4cd2479e95e7d74e94cf4f37bcb1ad3d
BLAKE2b-256 cb8ed32ad30e07af30f30ebce4538d5ef8214a6fdbc2738fd0c7a9b89cfbc5dc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2183e7a275569f6aef6afdb454b300c79ed4b47820f90c14c00b9191ad7a29c
MD5 b75526d93f6720f8f049e7c9c46af20e
BLAKE2b-256 78636950471928aeaaa51d775cb9c61f1c8d0fcb122025a2320612e6c18ed021

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.12-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ebc8ad42e5721528d0aca809403b58b5307fde034c58b274688ac03b934371ae
MD5 bb538dc48a0edb0f445b2deeabc42324
BLAKE2b-256 3b249c4e95a7667ed40256d40fa5dcce586ad882ca25b7fa0da287b7c9307cec

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c98b8ce16ddd7bd3103b951caa1ecfea8e58cb158768a8ee6c93044e1b0865ea
MD5 dad72882df8caeef30eae11b4d4d37eb
BLAKE2b-256 b0d5cdd85da9fc1d29b53f44aca57206f1aa2a6c98539515e07b6273b52d3860

See more details on using hashes here.

Provenance

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