[FEATURE] Add tail/head/grep functionality to BashOutput
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I often run scripts that Claude reads the results of from BashOutput. It often can spew 1000 lines into context if I am not careful. I don't want it to pollute context in this way.
Proposed Solution
I could always remember to ask it to write to a log file and grep/tail/head it for info, but it would be better if this was inherent to the BashOutput tool, with a default of say max 10 lines giving Claude the option to see more or grep|head|tail it.
Alternative Solutions
Logging to files and giving special instructions, but its a flawed approach in that it takes time and needs to be remembered.
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
I'm building a data export script that processes 12,000+ records from an ERP system with batch queries of 500-1000 records each. When I run the script with verbose logging to debug data mapping issues, it outputs progress for every batch, calculation step, and data validation check.
Currently, all output lines flood into BashOutput. After running the full export, Claude's context contains thousands of "Processing batch 1/25...", "Fetching records 500-1000...", "Calculating derived fields..." messages that are irrelevant to diagnosing the actual issue.
With automatic truncation to 10 lines, I'd see:
[... 2,847 lines truncated ...]
Processing batch 23/25...
Fetching records 11500-12000...
Warning: Missing data for 3 records in batch
Calculating derived fields...
Export complete: 12,509 records processed, 3 warnings
Claude can see the summary and recent warnings without context pollution, then offer to grep the log for specific error patterns or batch numbers if needed. This prevents me from having to pipe through tail or redirect to files manually every time.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗