Expand description
grep tool — search file contents by regex across the project.
Why: Content search is the other discovery primitive the engineer lacked, so
every grep -r went through the bash tool — part of the dominant agent-turn
sink on the L1 bake-off. A structured grep tool returns file:line: text
hits the harness can pin, instead of raw shell output. (#1027.)
What: GrepTool walks the working directory with a gitignore-aware walker
(ripgrep’s ignore crate) and returns each line matching the supplied regex.
An optional path scopes the walk and an optional glob filters which files
are searched.
Test: See #[cfg(test)] below — covers a content hit, regex semantics, the
glob filter, subdirectory scoping, no-match, bad-regex, and path traversal.
Structs§
- Grep
Tool ToolExecutorthat searches file contents by regex.
Constants§
- MAX_
GREP_ HITS - Maximum number of matching lines
GrepToolreturns in a single call.