| name | tool-ripgrep |
| description | Use ripgrep for extremely fast text and regex search across repositories. Trigger when locating symbols, strings, or patterns at scale. |
tool-ripgrep
When To Use
- Search file contents across large codebases faster than grep.
- Find symbols, flags, and text patterns before opening files.
- Build parseable discovery pipelines for agent workflows.
Trusted Commands
rg "pattern" path/
rg -F "exact string"
rg "pattern" -t py
rg "pattern" -g '*.py'
rg "pattern" -C 3
rg -l "pattern"
rg -c "pattern"
rg -i "pattern"
rg "pattern" --json
rg --exit-status "pattern"
Safe Defaults
- Use
-n when actionable line references are needed.
- Use
-F for literal strings to avoid regex escaping mistakes.
- Use
--glob/-g and type filters to keep results relevant and fast.
Common Pitfalls
- Hidden and ignored files are skipped by default.
- Regex mode can over-match when fixed-string matching was intended.
--json emits begin/match/end/summary events, not a single flat schema.
Output Interpretation
- Default output is
path:line:column:matched_text.
- Exit code 1 means no matches and can be a valid outcome.
--exit-status is useful in conditional shell pipelines.
Why It Matters For Agents
rg --json produces structured, machine-parseable search events.
- It is the fastest practical first-pass search in repository workflows.
Repo Conventions
- Prefer ripgrep for discovery before semantic or AST-level tools.
- Include ignored files only when the task explicitly requires them.
Trigger Examples
- Should trigger: "Find where
--user-install is referenced."
- Should trigger: "Search all markdown docs for stale command examples."
- Should not trigger: "Rename a Python symbol across semantic references only."