feat: Add noReply option to command.execute.before hook #6732

Open
opened 2026-02-16 18:05:05 -05:00 by yindo · 1 comment
Owner

Originally created by @arismoko on GitHub (Jan 18, 2026).

Originally assigned to: @thdxr on GitHub.

Problem

The command.execute.before plugin hook allows modifying command parts before execution, but there's no way to skip the LLM invocation entirely. This is needed for plugins that want to handle slash commands directly without invoking the LLM.

Currently, the only workaround is throwing an error in the hook, which is hacky.

Proposed Solution

Add an optional noReply field to the hook output object. When set to true, the command flow passes noReply: true to prompt(), which skips the LLM loop.

Changes:

  1. packages/plugin/src/index.ts - Add noReply?: boolean to hook output type
  2. packages/opencode/src/session/prompt.ts - Pass hookOutput.noReply to prompt()

Use Case

Plugins can implement custom slash commands (e.g., /tty list) that execute shell commands or other logic and display results without LLM involvement.

Originally created by @arismoko on GitHub (Jan 18, 2026). Originally assigned to: @thdxr on GitHub. ## Problem The `command.execute.before` plugin hook allows modifying command parts before execution, but there's no way to skip the LLM invocation entirely. This is needed for plugins that want to handle slash commands directly without invoking the LLM. Currently, the only workaround is throwing an error in the hook, which is hacky. ## Proposed Solution Add an optional `noReply` field to the hook output object. When set to `true`, the command flow passes `noReply: true` to `prompt()`, which skips the LLM loop. **Changes:** 1. `packages/plugin/src/index.ts` - Add `noReply?: boolean` to hook output type 2. `packages/opencode/src/session/prompt.ts` - Pass `hookOutput.noReply` to `prompt()` ## Use Case Plugins can implement custom slash commands (e.g., `/tty list`) that execute shell commands or other logic and display results without LLM involvement.
Author
Owner

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

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

  • #5305: [FEATURE]: Plugin Hook for Instant TUI Commands - Essentially requests the same capability to skip LLM invocation for custom slash commands, but proposes a more comprehensive new hook system rather than adding a noReply flag
  • #4475: Plugins using noReply seem to cause model to switch to agent default - This directly references noReply functionality and suggests it may already exist in the codebase

Feel free to ignore if these don't fully address your specific case.

@github-actions[bot] commented on GitHub (Jan 18, 2026): This issue might be a duplicate of existing issues. Please check: - #5305: [FEATURE]: Plugin Hook for Instant TUI Commands - Essentially requests the same capability to skip LLM invocation for custom slash commands, but proposes a more comprehensive new hook system rather than adding a noReply flag - #4475: Plugins using noReply seem to cause model to switch to agent default - This directly references noReply functionality and suggests it may already exist in the codebase Feel free to ignore if these don't fully address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6732