Since Copilot has transitioned to usage-based billing, it is recommended to document best practices for controlling token consumption somewhere.
To prevent the built-in tool grep_search, or #textSearch, from returning irrelevant results and filling the context window with noise, it is advisable to strictly configure files.exclude and search.exclude. This is recommended because grep_search respects these settings by default, which can help keep junk out of the search results.
Even if the agent does not read a file in the search results, if the file is in a format like jsonl, the search results alone will consume many tokens.
See:
"Whether to include files that would normally be ignored according to .gitignore, other ignore files and files.exclude and search.exclude settings. Warning: using this may cause the search to be slower. Only set it when you want to search in ignored folders like node_modules or build outputs."
Since Copilot has transitioned to usage-based billing, it is recommended to document best practices for controlling token consumption somewhere.
To prevent the built-in tool
grep_search, or#textSearch, from returning irrelevant results and filling the context window with noise, it is advisable to strictly configurefiles.excludeandsearch.exclude. This is recommended becausegrep_searchrespects these settings by default, which can help keep junk out of the search results.Even if the agent does not read a file in the search results, if the file is in a format like
jsonl, the search results alone will consume many tokens.See: