[BUG] command.describe isHidden ignored in desktop app slash menu (SDK command list doesn't filter isHidden)
Summary
A plugin's command.describe hook that returns isHidden: true hides the command in the terminal typeahead, but the command still appears in the Claude desktop app (Code tab) / menu. The command list the CLI publishes to SDK hosts ignores isHidden entirely.
Version
Claude Code 2.1.286 (the CLI bundled with the Claude desktop app, macOS)
Repro
- A plugin ships namespaced skills (e.g.
my-plugin:plan,my-plugin:tasks) that are meant to be reached only through one registered command (/my-plugin <verb>), and hides them with:on('command.describe', async ($, e, next) => { const result = await next(e) if (e.command.startsWith('my-plugin:')) return { ...result, isHidden: true } return result }) - In a terminal
claudesession, type/my-plugin— themy-plugin:*skills are hidden. ✅ - In a desktop Code tab session with the same plugin enabled, type
/my-plugin— all themy-plugin:*skills are listed. ❌
Cause (from reading the 2.1.286 bundle)
The terminal typeahead skips hidden commands (if (r.isHidden) continue), after the command.describe hook has been applied.
The SDK-facing list (used for the initialize response's commands, commands_changed, and the init message's slash_commands) filters only on userInvocable and the "off" state:
function vAr(e){ return e.userInvocable !== false && !Tx(e) }
function Vnn(e){ return Al(e,"name").filter(vAr) }
function k4(e){ return Vnn(e).map(tsn) } // tsn -> {name, description, argumentHint, aliases, builtin}
isHidden is neither filtered on nor serialized, so the desktop host has no way to hide these commands. The same applies to any command hidden via isHidden, not only plugin skills.
Expected
Commands that command.describe (or a command's own isHidden) marks hidden should be left out of the SDK command list, or carry an isHidden flag the host can honor, matching the terminal typeahead.
Why the obvious workaround doesn't work
Setting user-invocable: false on the skills does remove them from the SDK list, but then the slash-command path refuses to run them ("This skill can only be invoked by Claude, not directly by users."), which breaks a plugin dispatching them via $.command.run. Hidden-but-runnable is exactly what isHidden documents ("a hidden command still runs when typed in full"), so the SDK list should respect it.
Still reproduces on 2.1.321 (the build bundled with the desktop app, macOS) and on 2.1.322.
It also affects built-in commands and bundled skills, not only a plugin's own skills.
Test: a mod whose hook marks every command hidden and relabels it,
export function register(on) {
on('command.describe', async ($, e, next) =>
next({ ...e, description: 'PROBE ' + e.description, isHidden: true }))
}
run with claude -p --input-format stream-json --output-format stream-json --verbose and an initialize control request, then once more with a one-line prompt.
initializeresponsecommands: every command comes back with the rewritten description. None is removed and no entry carries a hidden field.initmessageslash_commands: nothing removed.commands_changed: nothing removed, descriptions rewritten.
So the hook runs and its description reaches the SDK list. Only isHidden is dropped.
The 2.1.319 changelog entry "Fixed hidden commands appearing in the slash command menu of cloud sessions on mobile and web" doesn't cover local desktop sessions.
Still reproduces on Claude Code 2.1.325 (bundled with Claude desktop 5.11492.5, macOS). It also applies to a plugin's own markdown command, not only skills.
Minimal repro:
-
A plugin registers
/my-cmdwith$.command.registerinsession.startand answers it withon('command.run', { command: 'my-cmd' }, …). -
The same plugin ships
commands/my-cmd.md, so that something is listed on the new-session start page (where registered commands don't exist yet, see #99691). -
Inside a running session the two would be listed twice, so the plugin hides the file version:
on('command.describe', ($, e, next) => e.command === 'my-plugin:my-cmd' ? next({ ...e, isHidden: true }) : next(e))A hook without a matcher, catching the file command under either name, behaves the same.
-
In a new desktop Code session, type
/my.
Expected: only my-cmd. Actual: both my-cmd and my-plugin:my-cmd are listed.
Why it matters: with registered commands missing from the start page (#99691), honouring isHidden here is the one way a plugin can have one clean entry in both places: plugin:command on the start page, plain /command once the session runs.