Slash commands are not resolved when using "opencode run" #4443

Closed
opened 2026-02-16 17:43:48 -05:00 by yindo · 3 comments
Owner

Originally created by @jgordijn-ah on GitHub (Jan 8, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When running OpenCode interactively, slash commands (e.g. /mycmd) are correctly resolved by OpenCode before being sent to the LLM. The command is expanded or executed internally, and only the resolved result is passed to the model.

However, when using opencode run, slash commands are not resolved. Instead, the raw slash command (e.g. /mycmd) is forwarded verbatim to the LLM. Since the LLM has no knowledge of OpenCode-specific slash commands, it responds with a hallucinated error message.

This results in inconsistent behavior between interactive and non-interactive usage and makes opencode run unreliable for automation.

Expected Behavior

opencode run should behave the same as interactive mode.

Why this matters (Ralph Wiggum workflow)

This behavior is particularly annoying when using Ralph Wiggum–style workflows, where OpenCode is run repeatedly in a loop. I would like to run a slash command in a loop, without workaround

Plugins

No response

OpenCode version

1.1.6

Steps to reproduce

  1. Define a custom command /mycmd with the content: Say hello to the user
  2. Run OpenCode interactively and invoke /mycmd - Observe that the command is resolved and executed correctly
  3. Run:
opencode run "/mycmd"

Result:

Image

Screenshot and/or share link

No response

Operating System

MacOS

Terminal

Ghostty

Originally created by @jgordijn-ah on GitHub (Jan 8, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description When running OpenCode interactively, slash commands (e.g. /mycmd) are correctly resolved by OpenCode before being sent to the LLM. The command is expanded or executed internally, and only the resolved result is passed to the model. However, when using opencode run, slash commands are not resolved. Instead, the raw slash command (e.g. /mycmd) is forwarded verbatim to the LLM. Since the LLM has no knowledge of OpenCode-specific slash commands, it responds with a hallucinated error message. This results in inconsistent behavior between interactive and non-interactive usage and makes opencode run unreliable for automation. ## Expected Behavior opencode run should behave the same as interactive mode. ## Why this matters (Ralph Wiggum workflow) This behavior is particularly annoying when using Ralph Wiggum–style workflows, where OpenCode is run repeatedly in a loop. I would like to run a slash command in a loop, without workaround ### Plugins _No response_ ### OpenCode version 1.1.6 ### Steps to reproduce 1. Define a custom command /mycmd with the content: `Say hello to the user` 3. Run OpenCode interactively and invoke /mycmd - Observe that the command is resolved and executed correctly 3. Run: ```sh opencode run "/mycmd" ``` Result: <img width="1280" height="418" alt="Image" src="https://github.com/user-attachments/assets/ef7d48b4-dc00-4743-ab97-e10987df1927" /> ### Screenshot and/or share link _No response_ ### Operating System MacOS ### Terminal Ghostty
yindo closed this issue 2026-02-16 17:43:48 -05:00
Author
Owner

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

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

  • #7000: Slash commands are being incorrectly captured
  • #7337: Custom TUI actions/keybinds for shell commands (related automation feature request)

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

@github-actions[bot] commented on GitHub (Jan 8, 2026): This issue might be a duplicate of existing issues. Please check: - #7000: Slash commands are being incorrectly captured - #7337: Custom TUI actions/keybinds for shell commands (related automation feature request) Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Jan 8, 2026):

@jgordijn-ah use the "--command mycmd" and it works we dont resolve the /mycmd we expect the flag, we may change that tho

@rekram1-node commented on GitHub (Jan 8, 2026): @jgordijn-ah use the "--command mycmd" and it works we dont resolve the /mycmd we expect the flag, we may change that tho
Author
Owner

@jgordijn-ah commented on GitHub (Jan 9, 2026):

Ok, thanks. I missed that one. You may close this issue or keep it if you want to change that behavior. I'll leave that up to you.

@jgordijn-ah commented on GitHub (Jan 9, 2026): Ok, thanks. I missed that one. You may close this issue or keep it if you want to change that behavior. I'll leave that up to you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4443