5 stable releases

Uses new Rust 2024

1.1.2 Dec 6, 2025
1.0.1 Dec 6, 2025

#1450 in Filesystem

MIT license

36KB
599 lines

semsearch

Semantic code search that just works. Ask questions in plain English, get ranked file locations.

Usage

semsearch "find the authentication handler"

Auto-indexes on first run, caches for instant subsequent searches.

Options

semsearch [OPTIONS] [QUERY]

Arguments:
  [QUERY]  Natural language search query

Options:
  -n, --limit <N>   Max results (default: 10)
  -p, --path <DIR>  Project path (default: walks up to .git)
      --json        Output as JSON
      --reindex     Force full reindex
      --stats       Show index statistics
  -v, --verbose     Show progress even when cached
  -h, --help        Print help

Examples

# Search current project
semsearch "error handling logic"

# JSON output for scripting
semsearch --json "database queries" | jq '.[] | .path'

# Search specific directory
semsearch -p /path/to/project "API endpoints"

# Check index status
semsearch --stats

Output

Human-readable (default):

src/auth.rs:42                     0.89  pub async fn validate_token...
src/handlers/login.rs:1            0.82  //! Login and authentication...

JSON (--json):

[
  {"path": "src/auth.rs", "line": 42, "score": 0.89, "snippet": "..."},
  ...
]

How It Works

  1. Detects project root (walks up to .git)
  2. Indexes all text files via fsindex
  3. Chunks content, embeds with BGE-small-en-v1.5 via fastembed
  4. Stores vectors in usearch index
  5. Caches at ~/.cache/semsearch/<project-hash>/
  6. Incremental updates on file changes

Install

cargo install --path .

License

None (unpublished)

Dependencies

~106MB
~2.5M SLoC