2 min read
Ripgrep
Fast, recursive text search tool written in Rust. Drop-in replacement for
grepwith smarter defaults.
ripgrep (rg) is the standard text search tool across all of Kevin's projects. The root agent instructions and Cursor rules both require rg / rg --files for repo search because it is fast, recursive by default, and respects ignore files unless told otherwise. Source: AGENTS.md; config/cursor/rules/ripgrep.mdc; BurntSushi/ripgrep README
Why ripgrep over grep
| Dimension | grep |
rg |
|---|---|---|
| Speed | Single-threaded | Parallel by default |
| Recursion | Requires -r flag |
Recursive by default |
.gitignore |
Ignored | Respected by default |
| Binary files | Searched unless excluded | Skipped by default |
| Hidden/dot files | Searched | Skipped by default |
| Output | Plain | Colored, grouped, line-numbered |
| Unicode | Partial | Full UTF-8 support |
| Regex engine | POSIX/PCRE | Rust regex crate (fast, safe) |
When grep still makes sense
- Portability - POSIX shell scripts that run on minimal environments (Alpine Docker, embedded, CI containers without custom tooling).
- Simple stdin pipes - for trivial
echo x | grep yone-liners the performance difference is negligible, butrgworks here too.
Key flags
rg "pattern" # Recursive search
rg "pattern" -t py # Filter by file type
rg "pattern" -g "*.tsx" # Filter by glob
rg "pattern" -i # Case insensitive
rg "pattern" -l # Files with matches only
rg "pattern" -c # Count matches per file
rg "pattern" -A 3 -B 3 # Context lines
rg "pattern" --json # Machine-readable JSON output
rg -U "multi\nline" # Multiline matching
rg "pattern" --no-ignore # Include gitignored files
rg "pattern" --hidden # Include hidden/dot files
rg "pattern" -w # Whole word matching
rg "pattern" --type-add 'web:*.{html,css,js}' -t web # Custom type
Agent integration
- Cursor - repository rules enforce
rgin terminal usage. Source: config/cursor/rules/ripgrep.mdc - VS Code / Cursor search (Cmd+Shift+F) uses ripgrep as the search backend. Source: VS Code search implementation notes
- Claude Code / Codex - agents should use
rgfor all shell-based search. Source: AGENTS.md
Installation
brew install ripgrep # macOS
cargo install ripgrep # from source
Timeline
- 2026-06-17 | Added provenance and clarified that the repo-level rule, not this page, is the enforcement surface. Source: AGENTS.md; config/cursor/rules/ripgrep.mdc
- 2026-04-13 | Added Cursor rule
.cursor/rules/ripgrep.mdcenforcingrgovergrep. Created wiki page. Source: config/cursor/rules/ripgrep.mdc