Skip to content

feat(cli): add /model slash command to show or set Claude model#603

Closed
metowolf wants to merge 1 commit intotiann:mainfrom
metowolf:feat/claude-model-slash-command
Closed

feat(cli): add /model slash command to show or set Claude model#603
metowolf wants to merge 1 commit intotiann:mainfrom
metowolf:feat/claude-model-slash-command

Conversation

@metowolf
Copy link
Copy Markdown
Contributor

@metowolf metowolf commented May 8, 2026

Summary

  • Add a new /model slash command that allows users to view or switch the Claude model during a session.
  • /model (no argument) — prints the currently active model (e.g. Claude model: claude-sonnet-4-6).
  • /model <name> — switches the session to the given model (e.g. /model claude-opus-4-7).
  • /model auto — resets the session to the default/auto model selection.

Changes

  • cli/src/parsers/specialCommands.ts — Added parseModel() function and ModelCommandResult interface; wired into parseSpecialCommand() which now returns type: 'model' and the optional model string.
  • cli/src/parsers/specialCommands.test.ts — Full unit-test coverage for parseModel and the /model cases in parseSpecialCommand.
  • cli/src/claude/runClaude.ts — Handle specialCommand.type === 'model': show current model when no argument is supplied, or call setModel / pushKeepAlive when a model name is given.
  • cli/src/modules/common/slashCommands.ts — Register /model in the built-in command list with a description so it appears in autocomplete / help.

Test plan

  • Run vitest — all existing and new tests pass.
  • Send /model in a session — response shows Claude model: <current>.
  • Send /model claude-opus-4-7 — response shows Claude model set to claude-opus-4-7 and subsequent messages use that model.
  • Send /model auto — resets to default model selection.
  • Confirm that /modeler and other partial matches do not trigger the command.

- Parse /model [name|auto] in specialCommands.ts with full test coverage
- Handle the command in runClaude.ts: show current model when no arg is
  given, or update the session model when a name/auto is provided
- Register /model in the built-in slash command list with a description
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings

  • No findings.

Summary

  • Review mode: initial
  • Reviewed the latest diff for the Claude /model parser, runner handling, slash-command registration, and parser tests. No high-confidence issues found in the modified lines.
  • Residual risk/testing gap: handler side effects in cli/src/claude/runClaude.ts (setModel, pushKeepAlive, consumed local id, emitted status message) are not covered by a focused runner test; current added coverage is parser-level only.

Testing

  • Not run (automation)

HAPI Bot

@tiann
Copy link
Copy Markdown
Owner

tiann commented May 9, 2026

I don’t think this is a good idea. Codex / Claude Code have slash-command functionality because they are TUIs, whereas we are on the web, with buttons and dialogs, so there’s no need to use this kind of interaction.

@tiann tiann closed this May 9, 2026
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.

2 participants