Description
aict grep -r currently walks the entire directory tree with no depth limit. On large monorepos this produces excessive output and is slow.
Proposed Solution
Add --max-depth N flag mirroring find's -maxdepth behavior.
Usage:
aict grep "func" . -r --max-depth 2
This would search only 2 levels deep from the search root.
XML Output Change
Add max_depth attribute to the root <grep> element:
<grep pattern="func" recursive="true" max_depth="2" ...>
Motivation
- Consistency with
find tool which already has -maxdepth
- Faster targeted searches in large codebases
- Reduces token count for AI agents that only need shallow results
Related
tools/grep/grep.go searchDirectory function
tools/find/find.go MaxDepth implementation (reference)
Description
aict grep -rcurrently walks the entire directory tree with no depth limit. On large monorepos this produces excessive output and is slow.Proposed Solution
Add
--max-depth Nflag mirroringfind's-maxdepthbehavior.Usage:
This would search only 2 levels deep from the search root.
XML Output Change
Add
max_depthattribute to the root<grep>element:Motivation
findtool which already has-maxdepthRelated
tools/grep/grep.gosearchDirectoryfunctiontools/find/find.goMaxDepthimplementation (reference)