CLI Flags

Basic Usage

sgrep [FLAGS] <query> <paths...>

Flags

FlagDefaultDescription
--threshold0.5Minimum similarity score (0.0–1.0)
--top-k10Maximum results to show
--modelautoEmbedding model alias
--hybridoffEnable BM25 + semantic hybrid search
--alpha0.7Hybrid blend (0.0 = pure BM25, 1.0 = pure semantic)
--jsonoffJSON output for piping
--colorautoColor mode: auto, always, never
-e, --classifyZero-shot classification labels (comma-separated)
-C, --contextShow N lines of context before and after
-B, --before-contextShow N lines before each result
-A, --after-contextShow N lines after each result
--chunk-sizeLines per chunk (overrides —granularity)
--granularitylineChunking: line or paragraph
-r, --recursiveoffRecursive directory search
-l, --filenames-onlyoffShow filenames only
-c, --countoffCount matches per file
--no-scoreoffHide similarity scores
--no-filteroffDisable junk line filtering
--no-ignoreoffDisable .gitignore filtering
--hiddenoffInclude hidden files
--filesoffSearch file paths instead of contents
--verboseoffShow backend, model, and timing info
--model-pathPath to a local model directory
--dtypef32Neural model precision: f32 or f16
--index.sgrep/index.dbPath to sqlite-vec index cache
--reindexoffForce re-embedding (ignore cache)
--no-cacheoffDisable caching entirely

Caching

sgrep caches embeddings in a local sqlite-vec database (.sgrep/index.db by default) so repeated searches are instant. The cache is keyed by file path + modification time.

# Force re-embed everything
sgrep --reindex "query" src/

# Skip cache entirely (useful for one-off searches)
sgrep --no-cache "query" src/

# Use a custom cache location
sgrep --index /tmp/my-index.db "query" src/
.md
All docs →

Was this page helpful?