Examples

Code Review

Find all error handling patterns:

sgrep "error handling and recovery" src/

Refactoring

Find functions that do similar things:

sgrep "convert string to number" src/ --threshold 0.5
sgrep "setup instructions" README.md QUICKSTART.md docs/

Cross-File Discovery

Find related code across your entire project:

sgrep "recursively walk subdirectories" src/
# Finds: /// Recursive directory search

Zero-Shot Classification

Classify text chunks against labels:

sgrep -e "bug,feature,refactor,docs" CHANGELOG.md

Pipeline Integration

# Find similar files and open in editor
sgrep --json "authentication middleware" src/ | jq -r '.[0].path' | xargs $EDITOR

# Count semantic matches above threshold
sgrep --json "memory leak" src/ | jq length

Was this page helpful?