Grep Tool
grep Tool PRD¶
As a next step, we want to build the GrepTool for LLMs to search for text in files. Following are the strict requirements:
GrepToolmust use the same permission mechanism in the codebase and used inReadFileandGlobtools.GrepToolmust be able to recursively search for the given pattern in the files in the directory tree starting from the working directory.- As input,
GrepToolmust accept apatternparameter and apathparameter. Thepathparameter is optional and defaults to the working directory. There will also be an optionalincludeparameter to specify aglobpattern to include files in the search. If it's empty or not provided, all text files in the current directory that are not blocked by the @guard.go and @gitawareness.go are included in the search. GrepToolwill have anoutput_modeparameter that can be one offileandcontent. Iffileis selected, the tool will return a list of file paths that match the pattern. Ifcontentis selected, the tool will return a list of lines that match the pattern along with the file name and line number.- If there is an error,
GrepToolmust return an error message and the error will be sent back to the LLM. Then the LLM can take proper actions.
Based on these requirements, create a design doc output-6_grep-tool.md and save it in @.ai-interactions/outputs/phase-3. In the design, don't include the complete impelementation. Rather, focus on the design and then include a granular todo list for the implementation.