Excessive vertical spacing from agent task outputs in CLI
Description
When agents complete tasks, their output contains excessive blank lines that create hundreds of lines of vertical whitespace in the CLI. This makes it difficult to review task history and clutters the terminal.
Steps to Reproduce
- Spawn multiple Task agents (any subagent_type: general-purpose, Bash, etc.)
- Let agents complete their work
- Observe the completed task output in the CLI
Expected Behavior
Completed task output should be compact with minimal spacing between tasks, similar to:
⏺ Task(Implement feature A)
⎿ Done (23 tool uses · 42.8k tokens · 2m 5s)
⏺ Task(Implement feature B)
⎿ Done (36 tool uses · 62.7k tokens · 4m 38s)
Actual Behavior
Hundreds of blank lines appear between completed tasks:
⏺ Task(Implement feature A)
⎿ Done (23 tool uses · 42.8k tokens · 2m 5s)
[... ~100+ blank lines ...]
⏺ Task(Implement feature B)
⎿ Done (36 tool uses · 62.7k tokens · 4m 38s)
Root Cause
Agent final messages appear to contain excessive newline characters (\n\n\n...) that the CLI renders literally without stripping whitespace.
Impact
- Difficult to review task history
- Terminal becomes cluttered
- Requires excessive scrolling to see recent output
- Affects all agent types (general-purpose, Bash, custom agents, etc.)
Environment
- Claude Code Version: Latest (as of 2026-01-18)
- Platform: macOS (Darwin 25.2.0)
- Agent types affected: All (general-purpose, Bash, custom agents)
Suggested Fix
Strip/normalize excessive whitespace from agent final messages before rendering in CLI:
- Collapse multiple consecutive newlines to max 2-3
- Trim trailing whitespace from agent responses
- Add CLI flag to control verbosity if needed
Workaround
Use ctrl+b to background tasks and avoid visual clutter, but this doesn't solve the underlying issue.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗