Bash tool output truncation should scale with model context window

Resolved 💬 3 comments Opened Mar 28, 2026 by lakinchris Closed Apr 30, 2026

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

  1. Bash command produces ~200KB stdout
  2. Claude Code truncates to ~2KB preview
  3. Remainder saved to a temp file
  4. 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_limit in settings.json)
  • Add a --force or --no-truncate flag on the Bash tool itself

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗