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
Do not output more than 2000 lines in commands and file reads #1556
One of the reasons Claude Code works so well is that it prevents tool calls from eating up all your context window. All tool calls fail if the output size is longer than 2000 lines or 25k tokens. This way the LLM will repeat the commands and file reads to constrain output size, using for example head -n command
Claude Code also uses an LLM to summarize fetch results, adding a field in the fetch tool for the objective of the fetch call
Yes, bash tool output should be truncated (show last 2000 lines), trying to read a file too long should return an error message, so the LLM can try again and paginate it via line numbers
I've faced this problem too, but in my case with some web searches. Sometimes the model calls the web tool and I've seen my context going straight to 300k tokens when the limit of my model is 128k.
Activity
thdxr commentedon Aug 3, 2025
hm we should be doing this also - is this specifically with the bash tool that it's a problem?
remorses commentedon Aug 4, 2025
Yes, bash tool output should be truncated (show last 2000 lines), trying to read a file too long should return an error message, so the LLM can try again and paginate it via line numbers
DiogoDoreto commentedon Aug 4, 2025
I've faced this problem too, but in my case with some web searches. Sometimes the model calls the web tool and I've seen my context going straight to 300k tokens when the limit of my model is 128k.
thdxr commentedon Aug 12, 2025
fixed this