GrepAI Search Basics
This skill covers the fundamentals of semantic code search with GrepAI.
When to Use This Skill
- Learning GrepAI search
- Performing basic code searches
- Understanding semantic vs. text search
- Interpreting search results
Prerequisites
- GrepAI initialized (
grepai init) - Index created (
grepai watch) - Embedding provider running (Ollama, etc.)
What is Semantic Search?
Unlike traditional text search (grep, ripgrep), GrepAI searches by meaning:
Basic Search Command
Example
Output:
Understanding Results
Result Format
Score Interpretation
Limiting Results
By default, GrepAI returns 10 results. Adjust with --limit:
Checking Index Status
Before searching, verify your index:
Output:
Search vs Grep Comparison
Traditional grep
- Finds exact text "authenticate"
- Misses synonyms (login, signin, auth)
- Returns all matches, unranked
GrepAI search
- Finds semantically similar code
- Includes related concepts
- Results ranked by relevance
What Makes a Good Query
Good Queries ✅
Describe the intent or behavior:
Less Effective Queries ❌
Too short or generic:
Natural Language Queries
GrepAI understands natural language:
Multiple Words vs Phrases
Both work, but phrases often get better results:
Quick Tips
- Use English: Models are trained on English
- Be specific: "JWT token validation" vs "validation"
- Describe intent: What the code DOES, not what it's called
- Use 3-7 words: Enough context, not too verbose
- Iterate: Refine query based on results
Common Search Patterns
Finding Entry Points
Finding Error Handling
Finding Data Access
Finding Business Logic
Troubleshooting
❌ Problem: No results ✅ Solutions:
- Check index exists:
grepai status - Run
grepai watchif index is empty - Simplify query
❌ Problem: Irrelevant results ✅ Solutions:
- Be more specific
- Use different words
- Check if code exists in the codebase
❌ Problem: Missing expected code ✅ Solutions:
- Check if file is ignored in config
- Ensure file extension is supported
- Re-index:
rm .grepai/index.gob && grepai watch
Output Format
Successful basic search:


