Quick Start
1. Initialize grepai
Navigate to your project directory and run:
cd /path/to/your/projectgrepai initThis creates a .grepai/ directory with a config.yaml file.
2. Start the Indexing Daemon
grepai watchThis will:
- Scan your codebase
- Split files into chunks
- Generate embeddings for each chunk
- Store vectors in the local index
- Watch for file changes and update the index in real-time
You’ll see a progress bar during the initial indexing.
3. Search Your Code
Open a new terminal and search:
# Find authentication codegrepai search "user authentication"
# Find error handlinggrepai search "how errors are handled"
# Find API endpointsgrepai search "REST API routes"
# Limit resultsgrepai search "database queries" --limit 10
# JSON output for AI agents (--compact saves ~80% tokens)grepai search "authentication" --json --compact4. Check Index Status
grepai statusThis shows:
- Number of indexed files
- Number of chunks
- Storage backend status
- Last update time
Example Output
$ grepai search "error handling middleware"
Score: 0.89 | middleware/error.go:15-45────────────────────────────────────────func ErrorHandler() gin.HandlerFunc { return func(c *gin.Context) { c.Next() if len(c.Errors) > 0 { err := c.Errors.Last() // ... handle error } }}
Score: 0.82 | handlers/api.go:78-95────────────────────────────────────────// handleAPIError wraps errors with contextfunc handleAPIError(w http.ResponseWriter, err error) { // ...}Tips for Better Searches
- Be descriptive: “user login validation” works better than “login”
- Use natural language: “where are users saved” instead of “save user”
- Think about intent: describe what the code does, not how it’s written
Next Steps
- Semantic Search Guide - Master natural language queries
- File Watching Guide - Understand the indexing daemon
- Call Graph Analysis - Explore function relationships
- Configuration - Customize chunking, embedders, and storage
- Commands Reference - Full CLI documentation
- AI Agent Setup - Integrate with Cursor or Claude Code