[BUG] Slash command autocomplete should prioritize exact matches over prefix matches

Resolved 💬 3 comments Opened Dec 29, 2025 by christophercampbell Closed Jan 2, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When typing a slash command that exactly matches a user-defined command, the autocomplete incorrectly suggests a plugin command that has the user's command as a prefix.

What Should Happen?

Exact matches should be prioritized over prefix matches. Typing /optimize should suggest the /optimize command first, with /optimize-query as a secondary option, and the user should not have to cycle down to intended command that is exactly written already.

Error Messages/Logs

Steps to Reproduce

  1. Have a user-defined command at ~/.claude/commands/optimize.md
  2. Have a plugin that provides a command like /optimize-query (e.g., sql-query-optimizer plugin)
  3. Type /optimize in the prompt
  4. Observe that autocomplete suggests /optimize-query instead of /optimize

Expected behavior:

Exact matches should be prioritized over prefix matches. Typing /optimize should suggest the /optimize command first, with /optimize-query as a secondary option.

Actual behavior:

The prefix match /optimize-query appears in the popup and gets selected, even though an exact match /optimize exists. User must cycle down to use the intended command.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.64 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗