Collapsed transcript view drops assistant text that shares an API message with a tool_use block

Resolved 💬 3 comments Opened Apr 25, 2026 by dui Closed Apr 28, 2026

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" />

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗