Code Search
Use rg (ripgrep) and find to locate code patterns, symbols, and files in the codebase.
Process
- Define search criteria - What symbol, pattern, or file are you looking for?
- Choose search tool -
rgfor content,findfor file names - Add context - Use
-Cflag to see surrounding lines - Filter by file type - Use
-gpattern to limit scope - Review results - Check line numbers and context
- Read specific files - Use
read_filewith line ranges for details
Examples
# Find a symbol with line numbers
rg -n "SymbolName" .
# Show a few lines of context
rg -n -C 2 "functionName" path/to/dir
# Search only specific file types
rg -n "TODO" -g "*.hs" Omni/
File discovery
# List files by pattern
rg --files -g "*.md" Omni/
# Find files by name
find Omni -name "*Agent*.hs" -print
Combine with read_file
After locating a file and line range, use read_file with start_line/end_line for a tight slice.