Proposal: sort TUI slash commands alphabetically

Resolved 💬 1 comment Opened May 30, 2026 by nithin-raj-9100 Closed Jun 1, 2026

Proposal

Sort TUI slash command suggestions alphabetically after existing visibility filters are applied.

Screenshot

<img width="1512" height="642" alt="Image" src="https://github.com/user-attachments/assets/9e278ca5-968d-4122-b759-9529fc91d083" />

Maintainer request

I have implemented this locally and pushed the branch to my fork:

  • Branch: nithin-raj-9100/codex:alphabetize-slash-commands
  • Commit: cf1c821cb3 (Sort TUI slash commands alphabetically)

Motivation

Alphabetical command lists are a familiar command-palette convention across developer tools and AI coding CLIs. For users coming from slash-command driven agents such as Claude Code and OpenCode, a predictable scan order is often more convenient than a hidden priority order.

The current implementation intentionally uses enum order as presentation order, with frequently used commands placed near the top. That is reasonable for a small, stable command set, but the list has grown enough that this creates a few pain points:

  • Users who type / to discover commands need to learn an undocumented priority order.
  • Commands such as /approve can appear far below commands such as /model, even though alphabetical scanning would make them easier to find.
  • Adding new slash commands requires choosing a subjective presentation position instead of following one simple rule.
  • Dynamic commands, such as service-tier commands, are easier to reason about when they are sorted with the rest of the visible commands.

Proposed behavior

  • Keep all current command filtering and gating behavior unchanged.
  • Apply feature, platform, and side-conversation filters first.
  • Sort the final visible slash command suggestions alphabetically by command name.
  • Include dynamic service-tier commands in the same alphabetical ordering.

Expected benefit

This makes the slash command popup more predictable, easier to scan, and easier to maintain as the command list grows, while preserving existing command behavior and availability rules.

Suggested implementation

The implementation can stay small:

  • Sort builtins_for_input results by command name after filters.
  • Sort commands_for_input results by the display command string after service-tier commands are added.
  • Update the TUI slash popup/completion tests to document the new order.
  • Remove stale service-tier insertion logic that implies service tiers should stay adjacent to /model.

Verification from local branch

  • just fmt
  • Focused slash-command tests: 33 passed
  • Earlier full TUI run before the final cleanup: just test -p codex-tui passed 2754 tests, cargo insta pending-snapshots --manifest-path tui/Cargo.toml reported no pending snapshots, and just fix -p codex-tui completed successfully.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗