TaskOutput dumps raw JSONL conversation transcript to terminal for background agents
Description
When using TaskOutput with block: false (non-blocking) to check on a background subagent launched via the Task tool with run_in_background: true, the terminal is flooded with pages of raw JSONL (JSON Lines) representing the internal conversation transcript of the subagent, rather than a clean status message or summary.
Steps to Reproduce
- Launch a subagent using the
Tasktool withrun_in_background: true - While the agent is still running, check its output using
TaskOutputwithblock: false - The terminal fills with hundreds of lines of raw JSON objects
Expected Behavior
A concise status message like "Task is still running..." or, if the agent has completed, a summary of its output — not the raw internal conversation transcript.
Actual Behavior
The entire internal JSONL conversation log of the subagent is dumped to the terminal. Each line is a JSON object representing internal events:
- Assistant messages (model responses with tool calls, token usage, cache stats)
- User messages (tool results fed back to the model)
- Hook progress events (PreToolUse/PostToolUse for every hook on every tool call)
- MCP progress events (server start/stop with elapsed times)
- Full metadata (UUIDs, parentUUIDs, timestamps, session IDs, agent IDs, slugs)
This output is completely unreadable to a human user and can be hundreds of lines long depending on how many tool calls the subagent has made.
Example snippet (truncated)
{"parentUuid":"a6d950d3-...","isSidechain":true,"userType":"external","cwd":"...","sessionId":"0f3dd3cd-...","version":"2.1.37","gitBranch":"master","agentId":"a897ff4","slug":"gleaming-munching-micali","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01WSmagJ3...","type":"message","role":"assistant","content":[{"type":"text","text":"I'll implement the file downloader module..."}],"stop_reason":null,...},...}
{"parentUuid":"...","isSidechain":true,...,"type":"progress","data":{"type":"hook_progress","hookEvent":"PreToolUse","hookName":"PreToolUse:Read","command":"~/.claude/hooks/pre-request.py"},...}
{"parentUuid":"...","isSidechain":true,...,"type":"progress","data":{"type":"mcp_progress","status":"started","serverName":"sequential-thinking","toolName":"sequentialthinking"},...}
This repeats for every tool call, hook execution, and MCP interaction the subagent performs.
Impact
- Terminal becomes unusable — pages of JSON scroll by
- No way to parse or understand agent progress without piping to
jq - Custom hooks (telemetry, usage tracking, pre-request) amplify the issue since each generates multiple progress event JSON objects per tool call
- The internal conversation transcript includes token usage, cache stats, and other metadata not intended for end users
Environment
- Claude Code version: 2.1.37
- OS: macOS (Darwin 24.6.0)
- Context: Multiple background subagents running in parallel via
Tasktool withrun_in_background: true, checked via non-blockingTaskOutput
Additional Context
The issue is exacerbated when a user has multiple hooks configured (e.g., I have telemetry, usage tracking, pre-request hooks) because each hook firing on each tool call generates additional progress event JSON objects in the transcript. A single Read tool call by the subagent can generate 6-8 JSON event lines in the output.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗