[PR #4424] Added /thinking slash command to toggle thinking blocks visibility in OpenTUI. #10970

Closed
opened 2026-02-16 18:15:44 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4424

State: closed
Merged: Yes


Perfect! My implementation follows the exact same pattern as the other commands. Let me also verify that the command is properly positioned - I placed it after /timeline which makes sense since both are session-related commands.

Now let me create a summary of what I've implemented:

Summary

I have successfully implemented the /thinking slash command for the OpenTUI. Here's what was done:

Changes Made

File: /home/runner/work/opencode/opencode/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

Added a new slash command entry in the autocomplete options:

{
  display: "/thinking",
  description: "toggle thinking blocks", 
  onSelect: () => command.trigger("session.toggle.conceal"),
},

How It Works

  1. Default Behavior: By default, all thinking blocks are shown in the TUI (the conceal signal is initialized to true)

  2. Command Trigger: When the user types /thinking and selects it, it triggers the existing session.toggle.conceal command

  3. Toggle Logic: The session.toggle.conceal command toggles the conceal signal between true and false

  4. Visual Effect: The ReasoningPart component (which renders thinking blocks) uses conceal={ctx.conceal()} to control visibility - when conceal is false, thinking blocks are hidden

Implementation Details

  • The command follows the same pattern as other client-side slash commands like /undo, /redo, /compact, etc.
  • It's positioned logically after /timeline in the autocomplete list
  • It reuses the existing session.toggle.conceal command that was already implemented for the "Toggle code concealment" functionality
  • The thinking blocks are controlled by the same conceal signal that controls code concealment, which makes sense since both are about hiding/showing content

User Experience

  • Users can type /thinking to toggle thinking blocks on/off
  • The command appears in the autocomplete list with description "toggle thinking blocks"
  • By default, thinking blocks are shown (addressing the issue that output is cluttered with thinking blocks)
  • Users can hide them when they want cleaner output, and show them again when they want to see the reasoning

This implementation directly addresses the GitHub issue requesting the missing /thinking command to help reduce clutter from thinking blocks in the TUI output.

Closes #3641

New%20session%20-%202025-11-17T20%3A27%3A38.265Z
opencode session  |  github run

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4424 **State:** closed **Merged:** Yes --- Perfect! My implementation follows the exact same pattern as the other commands. Let me also verify that the command is properly positioned - I placed it after `/timeline` which makes sense since both are session-related commands. Now let me create a summary of what I've implemented: ## Summary I have successfully implemented the `/thinking` slash command for the OpenTUI. Here's what was done: ### Changes Made **File: `/home/runner/work/opencode/opencode/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx`** Added a new slash command entry in the autocomplete options: ```typescript { display: "/thinking", description: "toggle thinking blocks", onSelect: () => command.trigger("session.toggle.conceal"), }, ``` ### How It Works 1. **Default Behavior**: By default, all thinking blocks are shown in the TUI (the `conceal` signal is initialized to `true`) 2. **Command Trigger**: When the user types `/thinking` and selects it, it triggers the existing `session.toggle.conceal` command 3. **Toggle Logic**: The `session.toggle.conceal` command toggles the `conceal` signal between `true` and `false` 4. **Visual Effect**: The `ReasoningPart` component (which renders thinking blocks) uses `conceal={ctx.conceal()}` to control visibility - when `conceal` is `false`, thinking blocks are hidden ### Implementation Details - The command follows the same pattern as other client-side slash commands like `/undo`, `/redo`, `/compact`, etc. - It's positioned logically after `/timeline` in the autocomplete list - It reuses the existing `session.toggle.conceal` command that was already implemented for the "Toggle code concealment" functionality - The thinking blocks are controlled by the same `conceal` signal that controls code concealment, which makes sense since both are about hiding/showing content ### User Experience - Users can type `/thinking` to toggle thinking blocks on/off - The command appears in the autocomplete list with description "toggle thinking blocks" - By default, thinking blocks are shown (addressing the issue that output is cluttered with thinking blocks) - Users can hide them when they want cleaner output, and show them again when they want to see the reasoning This implementation directly addresses the GitHub issue requesting the missing `/thinking` command to help reduce clutter from thinking blocks in the TUI output. Closes #3641 <a href="https://opencode.ai/s/G7q7bxBT"><img width="200" alt="New%20session%20-%202025-11-17T20%3A27%3A38.265Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTExLTE3VDIwOjI3OjM4LjI2NVo=.png?model=opencode/glm-4.6&version=1.0.68&id=G7q7bxBT" /></a> [opencode session](https://opencode.ai/s/G7q7bxBT)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/19443534098)
yindo added the pull-request label 2026-02-16 18:15:44 -05:00
yindo closed this issue 2026-02-16 18:15:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10970