Code Search

Use rg (ripgrep) and find to locate code patterns, symbols, and files in the codebase.

Process

  1. Define search criteria - What symbol, pattern, or file are you looking for?
  2. Choose search tool - rg for content, find for file names
  3. Add context - Use -C flag to see surrounding lines
  4. Filter by file type - Use -g pattern to limit scope
  5. Review results - Check line numbers and context
  6. Read specific files - Use read_file with 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.