Bash tool output truncation should scale with model context window
Problem
The Bash tool truncates stdout to ~2KB, saving the rest to a file. With 1M token context now available on Opus, this cap is unnecessarily restrictive.
Example: A CLI tool returns ~200KB of structured text output (~50K tokens — 5% of the 1M context window). Instead of flowing into context, 99% of the output is truncated and saved to a temp file. Claude then needs to use the Read tool to access it, adding friction to what should be a single-step operation.
Current behavior
- Bash command produces ~200KB stdout
- Claude Code truncates to ~2KB preview
- Remainder saved to a temp file
- Claude must separately Read the file to see the full output
Expected behavior
Output that fits within the model's context window should flow directly into context without truncation. The threshold should scale with the model's available context (e.g., 200K for Sonnet, 1M for Opus) rather than being hardcoded at ~2KB.
Workaround
CLI tools detect large output, write to a temp file, and print a summary + file path so Claude can Read it. Works but adds an unnecessary extra step.
Suggestion
Either:
- Scale the Bash output cap with the model's context window
- Add a user-configurable setting (e.g.,
bash_output_limitin settings.json) - Add a
--forceor--no-truncateflag on the Bash tool itself
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗