-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Description
What would you like to be added?
packages/core/src/tools/ripGrep.ts hard-codes DEFAULT_TOTAL_MAX_MATCHES = 20000. Every search truncates at that threshold, regardless of repository size. Other tooling that influences context size already exposes knobs in settings.schema.json (e.g., tools.truncateToolOutputThreshold, tools.truncateToolOutputLines). Ripgrep should follow the same pattern so users can tune the limit without patching the CLI.
If you think this can be accept, I can help to implement this.
Why is this needed?
Some users want lower limits to protect context budgets.
We already document and support similar safeguards for shell output truncation, so the configuration pipeline exists all the way from settings.schema.json → CLI config loader → Config → runtime.
In my case, it finds 17000 matches and takes over than 400K context window since it search keywords for ha|HA, most of files in the directory contain such words, and it reach max context window for serval times search, I think it should be configurable.
Additional context
Proposal
-
Schema
Addtools.ripgrep.maxMatches(number, default 20000) toschemas/settings.schema.json, with the usual metadata (title, description, markdownDescription, category, restart requirement). Mention it in docs/CLI settings tables so autocomplete works in IDEs. -
Config plumbing
- Update
packages/cli/src/config/config.tsto readsettings.tools?.ripgrep?.maxMatches(or top-leveltools.ripgrepMaxMatches) and pass it intonew Config(...). - Extend
packages/core/src/config/config.tsto store aripgrepMaxMatchesfield with fallback to 20000 and a getter.
- Update
-
Runtime usage
Replace the direct reference toDEFAULT_TOTAL_MAX_MATCHESinRipGrepToolInvocation.executewithconst totalMaxMatches = this.config.getRipgrepMaxMatches()(falling back to the default when unset). Keep the constant as a default so tests remain deterministic. -
Tests & docs
- Cover the new getter in
config.test.ts. - Extend ripgrep tool tests to assert truncation respects the configured value.
- Document the new setting in
docs/cli/settings.mdand the VS Code completion schema.
- Cover the new getter in