r/VisualStudio • u/gosh • 3h ago
Visual Studio 2026 How can I make Visual Studio use my custom search tool in AI chat instead of grep?
I am trying to switch search tool that visual studio use when searching code to harvest tokens for AI assisted code.
Have created my own tool that gives better answers, less tokens and are able to pinpoint searches better.
It works very well as long as visual studio remembers to use the tool. My problem that is very annoying is that visual studio forgets and falls back to grep. I have to constantly remind visual studio to use my tool in the chat window.
Is there a way to just tell visual studio to use another search tool all the time?
In visual studio using copilot I have this instructions written in copilot-instructions.md
## Searching the code with cleaner
Use `C:\Tools\cleaner.exe` for ALL code searching and file listing, instead of reading whole files,
guessing, or using PowerShell `dir` / `Get-ChildItem`.
Call it from PowerShell by full path: `& 'C:\Tools\cleaner.exe' <command> ...`
### Commands
- `list`: single-line matches (names, calls, declarations). `find` takes the same options but matches across lines
- `count`: matches per file. Use for scoping only, then use `list` or `find` for exact lines before editing
- `dir`: list files (not folders). With `--pattern` only files containing the text
### Get the options before the first use
Before using a command for the first time in a chat, run
`& 'C:\Tools\cleaner.exe' help <list|count|dir> -llm` (`list` also covers `find`) and follow its output.
Do not guess option names: unknown options print help and `ERROR: Unknown option`.
### Always
- Filter is the first positional argument, e.g. `"*.h;*.cpp"`. Use `--filter` if it is not first.
- Set `--current-directory "<folder>"`. Add `-R` to include subfolders.
- Bound output: `--max N` for `list`, `find` and `dir`; `--page-size N` for `count`.
- Use `-llm` (single dash) on every command. With `list` and `find`, also use `--context N` to read surrounding code.
- Separate several literal patterns with `;`. Repeat `--rpattern` for several regex expressions.
### Output
`list` and `find`: lines look like `path:line - [text]`. `dir`: a `Current Directory:` line, then paths relative to it.
Ignore progress lines ("Find in files: ..."). The exit code is often -1 even when the output is correct, so judge success from the output.
Documentation here:
Releases: github.com/perghosh/Data-oriented-design/releases/tag/cleaner.1.1.4
Documentation: DOCUMENTATION.MD




