What
New flag for --print mode that forwards subagent text and thinking blocks as structured assistant/user messages with parent_tool_use_id set, enabling callers to reconstruct the full agent conversation tree from the stream.
Usage
claude --print --output-format=stream-json --forward-subagent-text "your prompt"Details
- Requires both
--printand--output-format=stream-json. When explicitly specified on the CLI without those flags, the process exits with:"Error: --forward-subagent-text requires --print and --output-format=stream-json."When the option is supplied programmatically via the SDKforwardSubagentText: trueinit-config field, it silently degrades tofalserather than erroring if the output conditions are not met. - Without the flag, only
tool_useandtool_resultcontent blocks from subagent turns are forwarded upstream in the progress event stream. With the flag enabled, all content types — includingtextandthinkingblocks — are forwarded. - Forwarded subagent messages are emitted as
progressevents (data.type === "agent_progress") carrying the fullassistantorusermessage wrapper. The stream-json serializer converts these into top-levelassistant/usermessage events withparent_tool_use_idset to the spawning agent's tool-use ID, allowing callers to reconstruct the full agent conversation tree. - When
forwardSubagentTextis active, thinking blocks in subagent turns are not suppressed: the thinking configuration object is returned unchanged rather than having itsdisplayproperty overridden to"omitted"— which is the default behaviour for non-interactive stream-json sessions. - Allows external tooling (CI pipelines, orchestration layers) to receive the complete content of nested subagent turns rather than only the top-level result.
Evidence
New CLI flag added to the argument parser (search for "--forward-subagent-text"); forwarding gate (search for "forwardSubagentText" near "tool_use" and "tool_result" checks); thinking-config passthrough in Flc function
Strings lifted out of the shipped bundle, so the claim above can be checked against them.
One source agreesOne thing we can check says the same as this entry.
Anthropic's release notes agree
Added --forward-subagent-text flag and CLAUDE_CODE_FORWARD_SUBAGENT_TEXT environment variable to include subagent text and thinking in…