[FEATURE]: Allow plugins to register slash commands #7359

Open
opened 2026-02-16 18:06:57 -05:00 by yindo · 3 comments
Owner

Originally created by @nsoufian on GitHub (Jan 23, 2026).

Originally assigned to: @thdxr 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

Problem

Plugin authors currently have no mechanism to interact with users through the OpenCode interface.

Limitations

  • Plugins cannot register dynamic slash commands that appear in the command list
  • Plugins cannot trigger plugin-managed processes from user input
  • Plugins cannot update internal state through UI interactions

Impact

This limits what plugins can offer. Common use cases like toggling plugin modes, triggering syncs, or managing plugin configuration require workarounds outside the OpenCode interface.

Expected behavior

Plugins should be able to define slash commands that users can invoke directly, with the output persisted as session messages.

Originally created by @nsoufian on GitHub (Jan 23, 2026). Originally assigned to: @thdxr 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 ## Problem Plugin authors currently have no mechanism to interact with users through the OpenCode interface. ### Limitations - Plugins cannot register dynamic slash commands that appear in the command list - Plugins cannot trigger plugin-managed processes from user input - Plugins cannot update internal state through UI interactions ### Impact This limits what plugins can offer. Common use cases like toggling plugin modes, triggering syncs, or managing plugin configuration require workarounds outside the OpenCode interface. ### Expected behavior Plugins should be able to define slash commands that users can invoke directly, with the output persisted as session messages.
yindo added the discussion label 2026-02-16 18:06:57 -05:00
Author
Owner

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

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

  • #5305: [FEATURE]: Plugin Hook for Instant TUI Commands - Proposes allowing plugins to register instant commands that execute without agent involvement
  • #9911: [FEATURE]: Plugin Hooks for spawning dialogs - Requests plugin hooks for creating custom modals and dialogs for native feeling interactions
  • #5147: [FEATURE]: Plugin Support for Modal Human-in-the-loop Interactions - Proposes exposing modal infrastructure to plugins for interactive capabilities
  • #6330: [FEATURE]: Generic UI Intent Channel for cross-client plugin-driven UX - Suggests a comprehensive UI intent system that would enable plugins to drive interactions

These issues explore similar concepts of extending plugin capabilities for user interaction. Feel free to ignore if your specific use case differs from these.

@github-actions[bot] commented on GitHub (Jan 23, 2026): This issue might be a duplicate of existing issues. Please check: - #5305: [FEATURE]: Plugin Hook for Instant TUI Commands - Proposes allowing plugins to register instant commands that execute without agent involvement - #9911: [FEATURE]: Plugin Hooks for spawning dialogs - Requests plugin hooks for creating custom modals and dialogs for native feeling interactions - #5147: [FEATURE]: Plugin Support for Modal Human-in-the-loop Interactions - Proposes exposing modal infrastructure to plugins for interactive capabilities - #6330: [FEATURE]: Generic UI Intent Channel for cross-client plugin-driven UX - Suggests a comprehensive UI intent system that would enable plugins to drive interactions These issues explore similar concepts of extending plugin capabilities for user interaction. Feel free to ignore if your specific use case differs from these.
Author
Owner

@pablontiv commented on GitHub (Jan 29, 2026):

Use Case: Claude Code Compatibility Plugin

I'm building a plugin (claude-compat) that reads .claude/skills/ and exposes user-invocable skills as slash commands in OpenCode, without file duplication.

Current Workaround Limitation

Today, I can expose skills as tools via the tool hook, but this requires agent mediation. The user must say "use the investigar skill" instead of typing /investigar directly.

What I Need

The proposed command hook would allow:

export const ClaudeCompatPlugin: Plugin = async ({ worktree }) => {
  const skills = await discoverClaudeSkills(path.join(worktree, ".claude/skills"))
  
  const commands: Record<string, CommandDef> = {}
  for (const skill of skills.filter(s => s.userInvocable !== false)) {
    commands[skill.name] = {
      template: skill.content,
      description: skill.description,
      hints: skill.argumentHint ? ["$ARGUMENTS"] : [],
    }
  }
  
  return { command: commands }
}

Benefits

  • Zero file duplication (reads directly from .claude/)
  • Users migrating from Claude Code get the same /skill-name UX
  • Plugin can handle $ARGUMENTS substitution matching Claude Code behavior

Happy to help implement this if the design is approved.

@pablontiv commented on GitHub (Jan 29, 2026): ## Use Case: Claude Code Compatibility Plugin I'm building a plugin (`claude-compat`) that reads `.claude/skills/` and exposes user-invocable skills as slash commands in OpenCode, without file duplication. ### Current Workaround Limitation Today, I can expose skills as **tools** via the `tool` hook, but this requires agent mediation. The user must say "use the investigar skill" instead of typing `/investigar` directly. ### What I Need The proposed `command` hook would allow: ```typescript export const ClaudeCompatPlugin: Plugin = async ({ worktree }) => { const skills = await discoverClaudeSkills(path.join(worktree, ".claude/skills")) const commands: Record<string, CommandDef> = {} for (const skill of skills.filter(s => s.userInvocable !== false)) { commands[skill.name] = { template: skill.content, description: skill.description, hints: skill.argumentHint ? ["$ARGUMENTS"] : [], } } return { command: commands } } ``` ### Benefits - Zero file duplication (reads directly from `.claude/`) - Users migrating from Claude Code get the same `/skill-name` UX - Plugin can handle `$ARGUMENTS` substitution matching Claude Code behavior Happy to help implement this if the design is approved.
Author
Owner

@grota commented on GitHub (Feb 4, 2026):

Wouldn't an approach like this one fit the need?
Admittedly, since it seems too easy, I might have misunderstood the scope of the request.

@grota commented on GitHub (Feb 4, 2026): Wouldn't an approach like [this one](https://gist.github.com/ShamanicArts/b2ae98c0f51ff2e6f7cebc93fa37978f) fit the need? Admittedly, since it seems too easy, I might have misunderstood the scope of the request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7359