Quick Start
Get up and running with grepai in 5 minutes
1. Initialize grepai
Navigate to your project directory and run:
cd /path/to/your/project
grepai init
This creates a .grepai/ directory with a config.yaml file.
2. Start the Indexing Daemon
grepai watch
If you’re in an interactive terminal, this opens the watch UI by default. To force plain output (for scripts or logs), use:
grepai watch --no-ui
This 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 code
grepai search "user authentication"
# Find error handling
grepai search "how errors are handled"
# Find API endpoints
grepai search "REST API routes"
# Limit results
grepai search "database queries" --limit 10
# JSON output for AI agents (--compact saves ~80% tokens)
grepai search "authentication" --json --compact
4. Check Index Status
grepai status
For plain script-friendly status output:
grepai status --no-ui
This 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 context
func 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