ripgrep
$ rg Community Low Riskripgrep (rg) is the gold-standard local code search tentacle used inside virtually every coding agent harness. Zero side effects, millisecond Rust startup, .gitignore filtering, and structured --json match output.
brew install ripgrep Local rg searches thousands of files in milliseconds with zero RPC round-trips; there is rarely any reason to wrap local grep in an MCP server.
Agent-Readiness Checklist
Local Probe EvidenceCaptured --help excerpt
ripgrep 14.1.1 Andrew Gallant <[email protected]> ripgrep (rg) recursively searches the current directory for lines matching a regex pattern. By default, ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. Use -h for short descriptions and --help for more details. Project home page: https://github.com/BurntSushi/ripgrep USAGE: rg [OPTIONS] PATTERN [PATH ...] rg [OPTIONS] -e PATTERN ... [PATH ...] rg [OPTIONS] -f PATTERNFILE ... [PATH ...] rg [OPTIONS] --files [PATH ...] rg [OPTIONS] --type-list command | rg [OPTIONS] PATTERN rg [OPTIONS] --help rg [OPTIONS] --version POSITIONAL ARGUMENTS: <PATTERN> A regular expression used for searching. To match a pattern beginning with a dash, use the -e/--regexp flag. For example, to search for the literal '-foo', you can use this flag: rg -e -foo You can also use the special '--' delimiter to indicate that no more flags will be provided. Namely, the following is equivalent to the above: rg -- -foo <PATH>... A file or directory to search. Directories are searched recursively. File paths specified on the command line override glob and ignore rules. INPUT OPTIONS: -e PATTERN, --regexp=PATTERN A pattern to search for. This option can be provided multiple times, where all patterns given are searched, in addition to any patterns provided by -f/--file. Lines matching at least one of the provided patterns are printed. This flag can also be used when searching for patterns that start with a dash. For example, to search for the literal -foo: rg -e -foo You can also use the special -- delimiter to indicate that no more flags will be provided. Namely, the following is equivalent to the above: rg -- -foo When -f/--file or -e/--regexp is used, then ripgrep treats all positional arguments as files or directories to search. -f PATTERNFILE, --file=PATTERNFILE Search for patterns from the given file, with one pattern per line. When this flag is used multiple times or in combination with the -e/--regexp flag, then all patterns provided are searched. Empty pattern lines will match all input lines, and the newline is not counted as part of the pattern. A line is printed if
FCRS-1.0 6-Dimension Breakdown
Supports --json NDJSON output, --color never / NO_COLOR, non-TTY auto-plain formatting, and clean exit codes (0 match, 1 no match, 2 error).
- Native
--jsonNDJSON format and non-TTY plain stdout detection - Distinguishes no-match (exit 1) from syntax/IO errors (exit 2)
Strictly read-only with zero network calls, zero credential requirements, and automatic skipping of .gitignore / binary files.
- Pure local read-only binary; no write or network side effects
Zero-dependency Rust binary packaged everywhere (brew, apt, cargo, winget, and bundled inside major coding agents).
- Single static binary across macOS, Linux, and Windows
Unbeatable speed and token efficiency via -l, --max-count, and glob filters.
- Industry-standard codebase search tool for AI coding agents
Battle-tested OSS cornerstone (BurntSushi/ripgrep) with spotless reliability.
- Widely adopted OSS project under MIT/Unlicense
Comprehensive --help, man page, and GUIDE.md.
- Detailed GUIDE.md and man page
Security, Auth & Guardrails
None required; operates purely on local readable files.
100% free, offline, and open-source (MIT / Unlicense).
# ripgrep (rg) Agent Rules - Prefer `rg -l` first when scoping broad searches, then read targeted line ranges. - Use `--json` or `--vimgrep` when parsing structured positions programmatically. - Pass `--max-count` or `head` bounds on huge monorepos to avoid context bloat.
Agent-Ready Command Recipes
Safe Read-Only Queries
rg --json "export function" src/
Outputs line-delimited JSON objects with exact file path, line number, and submatches.
rg -l "TODO" src/
Returns only file paths so the agent avoids flooding context with match lines.
Strengths for Agents
- + Zero-risk, purely read-only local tentacle with millisecond startup.
- + Automatically disables ANSI colors when piped and provides
--jsonNDJSON. - + Respects
.gitignoreout of the box, keepingnode_modulesand secrets out of agent context.
Caveats & Pitfalls
- ! Returns exit code
1when zero matches are found (normal grep convention—agents should not treat exit 1 as a crash).