You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Glob/grep Tool Max Lines (Limit output of all tools?) #2375
By default, the glob/grep tool should have some kind of safety net to prevent the returned results from blowing the context window. (Limit param passed by LLM, default to something large but reasonable, say 500?) Usually ends up being accidentally including dist/node_modules results from grep, though if it's using rg, those should be excluded by default? 🤔
I wonder if it's reasonable for all tools to be clipped to some reasonable (10k?) token limit without explicitly bypassing it. Tools returning huge outputs is almost always accidental/unexpected. Could even buffer the output and make it optionally available through a tool only when requested. (Tool response says output has been clipped with instructions to use another tool with a specific ID to read from the remaining output.)
I have similar issues with codegen-ned files with long lines. a graphql schema in my case. I tried a Pr a few days ago that next to "lines" also tries to limit the amount of tokens. #2328
I do not think the PR is ok though thinking on it some more, as it limits on a percentage of the total context window for a provider (e.g. gemini can take a lot more than claude). However only in the case the tokens are larger than the line limits. But it will never successfully complete a task (what the user cares about) if it fills the 75% of the context window with a single file.
Activity
garrett-hopper commentedon Sep 2, 2025
I wonder if it's reasonable for all tools to be clipped to some reasonable (10k?) token limit without explicitly bypassing it. Tools returning huge outputs is almost always accidental/unexpected. Could even buffer the output and make it optionally available through a tool only when requested. (Tool response says output has been clipped with instructions to use another tool with a specific ID to read from the remaining output.)
[-]Glob/grep Tool Max Lines[/-][+]Glob/grep Tool Max Lines (Limit output of all tools?)[/+]roderik commentedon Sep 2, 2025
I have similar issues with codegen-ned files with long lines. a graphql schema in my case. I tried a Pr a few days ago that next to "lines" also tries to limit the amount of tokens. #2328
I do not think the PR is ok though thinking on it some more, as it limits on a percentage of the total context window for a provider (e.g. gemini can take a lot more than claude). However only in the case the tokens are larger than the line limits. But it will never successfully complete a task (what the user cares about) if it fills the 75% of the context window with a single file.
rekram1-node commentedon Dec 28, 2025
[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!