Skip to content

Added /thinking slash command to toggle thinking blocks visibility in OpenTUI.#4424

Merged
rekram1-node merged 3 commits intodevfrom
opencode/issue3641-20251117202739
Nov 17, 2025
Merged

Added /thinking slash command to toggle thinking blocks visibility in OpenTUI.#4424
rekram1-node merged 3 commits intodevfrom
opencode/issue3641-20251117202739

Conversation

@opencode-agent
Copy link
Contributor

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

…in OpenTUI.

Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
@rekram1-node
Copy link
Collaborator

/oc should there also be an option in the command dialog? (the one opened by ctrl+p)?

@opencode-agent
Copy link
Contributor Author

opencode-agent bot commented Nov 17, 2025

Yes, the /thinking command should also be available in the command dialog (Ctrl+P). Looking at the code, I can see that the command dialog shows commands from sync.data.command (lines 189-201), while the slash commands in the autocomplete are hardcoded session-specific commands.

The /thinking command is currently only in the autocomplete list (lines 249-252). To make it available in the command dialog as well, it would need to be added to the command registry that populates sync.data.command.

New%20session%20-%202025-11-17T20%3A33%3A57.743Z
opencode session  |  github run

@rekram1-node rekram1-node merged commit d60102b into dev Nov 17, 2025
5 checks passed
@rekram1-node rekram1-node deleted the opencode/issue3641-20251117202739 branch November 17, 2025 21:16
@Lapin
Copy link

Lapin commented Nov 30, 2025

Has this been implemented on 1.0.122 or planned for future release? I'm on 1.0.122 and I still cannot toggle /thinking
Screenshot 2025-11-30 at 10 01 27

@rekram1-node
Copy link
Collaborator

@Lapin hit ctrl+p then type in thinking

@Lapin
Copy link

Lapin commented Dec 1, 2025

@Lapin hit ctrl+p then type in thinking

Screenshot 2025-12-01 at 00 52 32

@rekram1-node
Copy link
Collaborator

@Lapin it only shows up once you have started a session so navigate to any session to see it

p sure its called toggle thinking but ill double check

@Lapin
Copy link

Lapin commented Dec 1, 2025

Screenshot 2025-12-01 at 08 31 05
Oh it did show up while I'm in the project! Thanks! I assumed it would be a global setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenTUI: /thinking command is missing

2 participants