[BUG] BashOutput returns complete log instead of only new output since last check
Description
The BashOutput tool is documented to "Always returns only new output since the last check", but in practice, it appears to return the complete output buffer repeatedly instead of only incremental changes.
Environment
- Claude Code version: Latest (as of 2025-10-14)
- OS: macOS (Darwin 24.4.0)
- Shell: zsh
- Background process: Vite development server (
pnpm dev)
Steps to Reproduce
- Start a long-running development server in background:
pnpm dev
- Call
BashOutputwith the bash_id multiple times - Observe that each call returns the complete output buffer from the beginning, not just new lines
Expected Behavior
According to the tool description:
"Always returns only new output since the last check"
Each subsequent BashOutput call should only return:
- New stdout lines generated since the last check
- New stderr lines generated since the last check
Actual Behavior
Every BashOutput call returns:
- The complete stdout from the beginning (including old HMR updates)
- The complete stderr from the beginning (including old error messages)
- The same content is repeated across multiple calls
Example: After calling BashOutput 5+ times, each call still shows logs from timestamp 12:03:55 AM, even though current time is 00:17 (about 14 minutes later).
Impact
- Makes it difficult to identify truly new events in long-running processes
- Creates confusion about whether errors are current or historical
- Increases token usage by repeatedly processing the same log content
- Reduces the utility of background process monitoring
Additional Context
This behavior is particularly noticeable with:
- Vite/development servers that output frequently
- Long-running background tasks with substantial output
- Processes that have been running for more than a few minutes
The issue might be related to how the tool tracks the "last read position" in the output buffer, especially for processes with formatted/colored output (ANSI codes).
Workaround
Currently, users must manually track timestamps or pattern-match previously seen output to identify new content.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗