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 (3.14 not yet supported due to onnxruntime).

pip install hygrep
# or
uv tool install hygrep
# 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.9-cp313-cp313-manylinux_2_17_x86_64.whl (98.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

hygrep-0.0.9-cp312-cp312-manylinux_2_17_x86_64.whl (98.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

hygrep-0.0.9-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.9-cp311-cp311-macosx_11_0_arm64.whl (88.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for hygrep-0.0.9-cp313-cp313-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 4e9a4638733444e36d91a4b57aca0446bc48d5f879f5313783ff99f7648588bf
MD5 941c89f8b415cf87da60e233ff219ca7
BLAKE2b-256 4e0f1bc3669841e50ee1d1f78e63e4dd1048397cead41f5e656d65ddf4002f49

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb7d614c4fbfcb8276082b1e3e398db213928deb9821fef587f0510aff6a8846
MD5 7205169cf7ead5d54554ef9908134cd9
BLAKE2b-256 b003c21f208f94367177f58a0d58b4ba0e73df47b235fd3c867034eadc006370

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.9-cp312-cp312-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 811a9189d681d44b9e3fde844273402f1f896f9a759128ba6dd09c971bbb6bf6
MD5 e80488ece99d89ada29eb29fa5da7cc1
BLAKE2b-256 a8aacd3e5d6e520c71883ee7c66dc082b4fd7490345a9a6e4846c5b8e9343781

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5da36568e6920f1e2c5c330b1cc6da528c1ea82c1cf54f35cdac2e592d375d89
MD5 d10a00db8e94d8f7e3e5a37d058050b3
BLAKE2b-256 330836673d53fbbeed23614bfe74e21d05016c6caec2a2c9e92cecab902353cc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.9-cp311-cp311-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9f160b9cfb0980062dbcecf9df4692a8ef48a83d30efa78b30446da73bf575dd
MD5 822ce0d7a54dc968d319ac2cc26568c4
BLAKE2b-256 3fc6abbfc72b63e3bce6298aee4c9ba1d71fdce147025ee9a9e85a992690e85b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hygrep-0.0.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a502d801f154fee8c9d67619113af449861f7023b7091cb0a47c7aa53eefb5a9
MD5 eae5df714244e5f84827f735602f68fb
BLAKE2b-256 7b8186d072c7ff77b6e0fef7f745595fd211e05000224be81f02284ac68cb735

See more details on using hashes here.

Provenance

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