[FEATURE]: --format json does not print reasoning_content. #4362

Open
opened 2026-02-16 17:43:34 -05:00 by yindo · 6 comments
Owner

Originally created by @hksdpc255 on GitHub (Jan 7, 2026).

Originally assigned to: @rekram1-node on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

--format json does not print reasoning_content for now:

$ opencode run --log-level DEBUG --format json --model xiaomi/mimo-v2-flash-thinking 'Using browser tool to close the browser.'
{"type":"step_start","timestamp":1767790882247,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c2dc6001bXsFv0OrsMkp8a","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c1a5f001fxnzwEnS8bqiNq","type":"step-start"}}
{"type":"tool_use","timestamp":1767790883443,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c31f9001fsXAlUj7wQVAkN","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c1a5f001fxnzwEnS8bqiNq","type":"tool","callID":"call_d46153bfcf1f4f5c9e90347f","tool":"browser_browser_close","state":{"status":"completed","input":{},"output":"{\n  \"message\": \"Browser closed successfully\"\n}","title":"","metadata":{},"time":{"start":1767790883323,"end":1767790883439},"attachments":[]}}}
{"type":"step_finish","timestamp":1767790883443,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c327100194VEblCc5wCY8h","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c1a5f001fxnzwEnS8bqiNq","type":"step-finish","reason":"tool-calls","cost":0.00121912,"tokens":{"input":16954,"output":85,"reasoning":69,"cache":{"read":5,"write":0}}}}
{"type":"step_start","timestamp":1767790885083,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c38db001sNqLOAk31H8Hyn","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c3275001ZD3deWquk5ki3r","type":"step-start"}}
{"type":"text","timestamp":1767790885769,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c3ab3001x6ZfK5RGGaAyze","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c3275001ZD3deWquk5ki3r","type":"text","text":"The browser has been closed successfully.","time":{"start":1767790885768,"end":1767790885768}}}
{"type":"step_finish","timestamp":1767790885769,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c3b88001dZqZV5k9fXzd6P","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c3275001ZD3deWquk5ki3r","type":"step-finish","reason":"stop","cost":0.00106589,"tokens":{"input":15011,"output":41,"reasoning":31,"cache":{"read":2055,"write":0}}}}

I have already verified the reasoning_content can be displayed correctly in TUI.

Originally created by @hksdpc255 on GitHub (Jan 7, 2026). Originally assigned to: @rekram1-node on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request `--format json` does not print `reasoning_content` for now: ``` $ opencode run --log-level DEBUG --format json --model xiaomi/mimo-v2-flash-thinking 'Using browser tool to close the browser.' {"type":"step_start","timestamp":1767790882247,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c2dc6001bXsFv0OrsMkp8a","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c1a5f001fxnzwEnS8bqiNq","type":"step-start"}} {"type":"tool_use","timestamp":1767790883443,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c31f9001fsXAlUj7wQVAkN","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c1a5f001fxnzwEnS8bqiNq","type":"tool","callID":"call_d46153bfcf1f4f5c9e90347f","tool":"browser_browser_close","state":{"status":"completed","input":{},"output":"{\n \"message\": \"Browser closed successfully\"\n}","title":"","metadata":{},"time":{"start":1767790883323,"end":1767790883439},"attachments":[]}}} {"type":"step_finish","timestamp":1767790883443,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c327100194VEblCc5wCY8h","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c1a5f001fxnzwEnS8bqiNq","type":"step-finish","reason":"tool-calls","cost":0.00121912,"tokens":{"input":16954,"output":85,"reasoning":69,"cache":{"read":5,"write":0}}}} {"type":"step_start","timestamp":1767790885083,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c38db001sNqLOAk31H8Hyn","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c3275001ZD3deWquk5ki3r","type":"step-start"}} {"type":"text","timestamp":1767790885769,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c3ab3001x6ZfK5RGGaAyze","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c3275001ZD3deWquk5ki3r","type":"text","text":"The browser has been closed successfully.","time":{"start":1767790885768,"end":1767790885768}}} {"type":"step_finish","timestamp":1767790885769,"sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","part":{"id":"prt_b988c3b88001dZqZV5k9fXzd6P","sessionID":"ses_46773e5bcffergbbCsAcLxPFQh","messageID":"msg_b988c3275001ZD3deWquk5ki3r","type":"step-finish","reason":"stop","cost":0.00106589,"tokens":{"input":15011,"output":41,"reasoning":31,"cache":{"read":2055,"write":0}}}} ``` I have already verified the `reasoning_content` can be displayed correctly in TUI.
yindo added the discussion label 2026-02-16 17:43:34 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 7, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #4609: [FEATURE]: add option to Export thinking and tool use inputs/outputs - requests exporting reasoning and tool use information in exports
  • #6337: [FEATURE]: support extracting reasoning XML - requests parsing and displaying reasoning content in the UI
  • #5577: DeepSeek V3.2: reasoning_content not cleared from message history - involves handling reasoning_content in message structures
  • #3274: Can I get an easily human readable log file - requests accessible output formats including conversation history

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 7, 2026): This issue might be a duplicate of existing issues. Please check: - #4609: [FEATURE]: add option to Export thinking and tool use inputs/outputs - requests exporting reasoning and tool use information in exports - #6337: [FEATURE]: support extracting reasoning XML - requests parsing and displaying reasoning content in the UI - #5577: DeepSeek V3.2: reasoning_content not cleared from message history - involves handling reasoning_content in message structures - #3274: Can I get an easily human readable log file - requests accessible output formats including conversation history Feel free to ignore if none of these address your specific case.
Author
Owner

@hksdpc255 commented on GitHub (Jan 7, 2026):

claude-code uses a different json schema but have the thinking content:

{"type":"assistant","message":{"id":"05ad8e108c6bfe8a1eaf435a522609e7","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"The user wants me to use the Glob tool to check the current directory. Let me do that.","signature":"40508f0504a4977eaa9335ad315b1eb9ff2c5a162e856c5eab4900fb5ce0f8b9"}],"model":"MiniMax-M2.1","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":174,"output_tokens":0,"cache_creation_input_tokens":19480,"cache_read_input_tokens":0},"service_tier":"standard","context_management":null},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"ab97f8b1-abd3-486b-bcec-e040a8950daa"}
{"type":"assistant","message":{"id":"05ad8e108c6bfe8a1eaf435a522609e7","type":"message","role":"assistant","content":[{"type":"tool_use","id":"call_function_b4q5ychg2ism_1","name":"Glob","input":{"pattern":"*"}}],"model":"MiniMax-M2.1","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":174,"output_tokens":46,"cache_creation_input_tokens":19480,"cache_read_input_tokens":0},"service_tier":"standard","context_management":null},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"b39d6ecf-ee22-4864-83ad-1ce2654b4fa8"}
{"type":"user","message":{"role":"user","content":[{"tool_use_id":"call_function_b4q5ychg2ism_1","type":"tool_result","content":"No files found"}]},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"5ee5fd17-2d27-45a5-ba67-f3853921394c","tool_use_result":{"filenames":[],"durationMs":5,"numFiles":0,"truncated":false}}
{"type":"assistant","message":{"id":"05ad8e12b18cc5bec09eeeeaf93f6826","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"The current directory appears to be empty. Let me check if there are any files including hidden ones.","signature":"1143edc7d6cc0a27122dee6ef1b8c65e08bae55bcc92a01334f81b1907d1925d"}],"model":"MiniMax-M2.1","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":188,"output_tokens":0,"cache_creation_input_tokens":247,"cache_read_input_tokens":19284},"service_tier":"standard","context_management":null},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"2e0711f4-057f-4782-87e9-e258976ae9b4"}
@hksdpc255 commented on GitHub (Jan 7, 2026): `claude-code` uses a different json schema but have the `thinking` content: ``` {"type":"assistant","message":{"id":"05ad8e108c6bfe8a1eaf435a522609e7","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"The user wants me to use the Glob tool to check the current directory. Let me do that.","signature":"40508f0504a4977eaa9335ad315b1eb9ff2c5a162e856c5eab4900fb5ce0f8b9"}],"model":"MiniMax-M2.1","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":174,"output_tokens":0,"cache_creation_input_tokens":19480,"cache_read_input_tokens":0},"service_tier":"standard","context_management":null},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"ab97f8b1-abd3-486b-bcec-e040a8950daa"} {"type":"assistant","message":{"id":"05ad8e108c6bfe8a1eaf435a522609e7","type":"message","role":"assistant","content":[{"type":"tool_use","id":"call_function_b4q5ychg2ism_1","name":"Glob","input":{"pattern":"*"}}],"model":"MiniMax-M2.1","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":174,"output_tokens":46,"cache_creation_input_tokens":19480,"cache_read_input_tokens":0},"service_tier":"standard","context_management":null},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"b39d6ecf-ee22-4864-83ad-1ce2654b4fa8"} {"type":"user","message":{"role":"user","content":[{"tool_use_id":"call_function_b4q5ychg2ism_1","type":"tool_result","content":"No files found"}]},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"5ee5fd17-2d27-45a5-ba67-f3853921394c","tool_use_result":{"filenames":[],"durationMs":5,"numFiles":0,"truncated":false}} {"type":"assistant","message":{"id":"05ad8e12b18cc5bec09eeeeaf93f6826","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"The current directory appears to be empty. Let me check if there are any files including hidden ones.","signature":"1143edc7d6cc0a27122dee6ef1b8c65e08bae55bcc92a01334f81b1907d1925d"}],"model":"MiniMax-M2.1","stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":188,"output_tokens":0,"cache_creation_input_tokens":247,"cache_read_input_tokens":19284},"service_tier":"standard","context_management":null},"parent_tool_use_id":null,"session_id":"ae9675f2-e988-4dc9-9fba-823121faf6a4","uuid":"2e0711f4-057f-4782-87e9-e258976ae9b4"} ```
Author
Owner

@hksdpc255 commented on GitHub (Jan 7, 2026):

If any of the terminal output I upload contains sensitive information, please remind me to remove it.

@hksdpc255 commented on GitHub (Jan 7, 2026): If any of the terminal output I upload contains sensitive information, please remind me to remove it.
Author
Owner

@levabala commented on GitHub (Jan 23, 2026):

+1 as it would be really nice to have for ralph-loop-like implementations on top of opencode

@levabala commented on GitHub (Jan 23, 2026): +1 as it would be really nice to have for ralph-loop-like implementations on top of opencode
Author
Owner

@hksdpc255 commented on GitHub (Jan 26, 2026):

@levabala Try PR #7434. I don't know why still no maintainers look review this. It just 3 lines additions.

@hksdpc255 commented on GitHub (Jan 26, 2026): @levabala Try PR #7434. I don't know why still no maintainers look review this. It just 3 lines additions.
Author
Owner

@foglerek commented on GitHub (Jan 26, 2026):

+1, I rely on this in my harness that I'd like to wire opencode to.

@foglerek commented on GitHub (Jan 26, 2026): +1, I rely on this in my harness that I'd like to wire opencode to.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4362