claude-code - 💡(How to fix) Fix Collapsed transcript view drops assistant text that shares an API message with a tool_use block [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53239Fetched 2026-04-26 05:20:50
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

In Claude Code's collapsed (default) transcript view, assistant text content blocks emitted in the same API message as a tool_use block are not rendered. The same text shows up correctly after toggling to detailed view (ctrl+o).

Root Cause

The system prompt instructs the model to narrate before tool calls ("Before your first tool call, state in one sentence what you're about to do."). The collapsed renderer systematically erases that narration. The user sees only > Ran 1 shell command collapses and the final-answer text — never the "let me check X" preamble. The agent feels like a black box rather than a colleague explaining its work.

Fix Action

Fix / Workaround

Workaround for users

Code Example

{
  "role": "assistant",
  "content": [
    { "type": "thinking", "thinking": "..." },
    { "type": "text", "text": "PREAMBLE: ..." },
    { "type": "tool_use", "name": "Bash", "input": { "command": "date" } }
  ]
}
RAW_BUFFERClick to expand / collapse

Summary

In Claude Code's collapsed (default) transcript view, assistant text content blocks emitted in the same API message as a tool_use block are not rendered. The same text shows up correctly after toggling to detailed view (ctrl+o).

Why this matters

The system prompt instructs the model to narrate before tool calls ("Before your first tool call, state in one sentence what you're about to do."). The collapsed renderer systematically erases that narration. The user sees only > Ran 1 shell command collapses and the final-answer text — never the "let me check X" preamble. The agent feels like a black box rather than a colleague explaining its work.

Repro

Open a fresh Claude Code session and paste:

Before calling any tool, write this exact line on its own paragraph:

PREAMBLE: if you can read this, the renderer kept the assistant text that came before the tool call.

Then run `date` and tell me the output.

Once the response completes:

  1. Default (collapsed) view: the PREAMBLE: line is missing. View jumps from your prompt to Ran 1 shell command and the final timestamp.
  2. Press ctrl+o to toggle detailed view: the PREAMBLE: line appears above the Bash(date) call.

Screenshots

(Attaching: collapsed view — preamble missing; detailed view — preamble present.)

Why it's the message shape, not streaming

The text is present in the JSONL transcript (~/.claude/projects/<project>/<session>.jsonl). The model emitted it; the renderer chose to hide it. This is purely a render-time issue.

The affected assistant message has this content-block shape:

{
  "role": "assistant",
  "content": [
    { "type": "thinking", "thinking": "..." },
    { "type": "text", "text": "PREAMBLE: ..." },
    { "type": "tool_use", "name": "Bash", "input": { "command": "date" } }
  ]
}

Text in messages that contain no tool_use block (e.g., the post-tool final answer) renders correctly in both views.

Workaround for users

Send any user-facing narration as a standalone assistant message before invoking the tool. (This works against the system-prompt instruction to narrate inline, but is the only way to make preambles visible in the default view.)

Environment

  • Claude Code: v2.1.119
  • macOS Darwin 25.3.0 (arm64)
  • Model: Opus 4.7 (1M context)
<img width="905" height="342" alt="Image" src="https://github.com/user-attachments/assets/a38ddfb2-f7e9-456e-a1a7-d9e5c51da209" /> <img width="1001" height="414" alt="Image" src="https://github.com/user-attachments/assets/b87ea3ba-ca8b-4b8b-9c94-55172e7095a2" />

extent analysis

TL;DR

The issue can be worked around by sending user-facing narration as a standalone assistant message before invoking the tool.

Guidance

  • Verify that the issue is specific to the collapsed view by toggling to detailed view (ctrl+o) and checking if the preamble is rendered.
  • Check the JSONL transcript to confirm that the model emitted the text and it's not a streaming issue.
  • Consider modifying the system prompt to instruct the model to send narration as a separate message before tool calls.
  • Test the workaround by sending a standalone assistant message with the preamble before invoking the tool.

Example

No code snippet is provided as the issue is related to the rendering of text content in the Claude Code interface.

Notes

The issue seems to be specific to the rendering of text content in messages that contain a tool_use block. The workaround may not be ideal as it goes against the system-prompt instruction to narrate inline.

Recommendation

Apply the workaround by sending user-facing narration as a standalone assistant message before invoking the tool, as this is the only known way to make preambles visible in the default view.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Collapsed transcript view drops assistant text that shares an API message with a tool_use block [1 comments, 2 participants]