feat(frontend): display Agent Skills and Commands in slash menu#12982
feat(frontend): display Agent Skills and Commands in slash menu#12982hieptl merged 14 commits intoOpenHands:mainfrom
Conversation
edb8d38 to
5d4a07a
Compare
|
I think we need to pass description for I can put the following PR Looking forward to your review, @jpelletier1 |
|
Hello @eureka928, Thank you very much for creating this pull request. I truly appreciate your effort and contributions. While running the code locally, I noticed a couple of issues that I would like to share: Issue 1: The descriptions for each skill do not display as expected, and some of them appear to be truncated. I understand that you have already added a comment and tagged @jpelletier1 regarding this, and we can refer to the image below for additional context.
Issue 2: After selecting a skill, I am unable to trigger a slash command again. Please refer to the video below for more details. issue2.movThank you very much! 🙏 |
hieptl
left a comment
There was a problem hiding this comment.
Hello @eureka928, could you please add tests to cover your changes? Thank you very much! 🙏
| }} | ||
| > | ||
| <div className="flex items-center gap-2"> | ||
| <span className="text-sm font-semibold text-white"> |
There was a problem hiding this comment.
suggestion: We should consider using Typography.Text from the /frontend/src/ui folder instead of the span tag. Thank you! 🙏
This is an interesting question. Should we insert two slash commands on the same line? It’s a command, it tells the agent to do a thing. I think maybe it makes sense to have only one, and only at the start of the user message, otherwise the agent might get confused, the handling of potential arguments would get complex, and the user wouldn’t be able to use / inside the message 🤔 WDYT? |
Hello @enyst, I’m currently running the latest code from the main branch and tested triggering two skills within a single prompt. Below is the prompt I used:
Based on the prompt and the attached video:
slash.movPlease let me know if you need any additional details. Thank you! 🙏 |
|
I see, OK, thank you. I think maybe it's a bit confusing, and we probably over-trigger right now:
The point is that I see a case for the expected UX here to be: a slash command is a command, it feels like a command, it probably starts the message, it can have inputs (which used to open a window or the agent asks for them, that wouldn't work so well with two commands, it seems to me). But I could be wrong. Thank you for fixing it, @eureka928 ! We'll see how it feels like, in real use? |
Vercel doesn't work? cc: @hieptl I think you tested that? |
|
I withdraw my concern @eureka928 , I’ll be happy to try it as it is now, if Hiep Le is OK with it! |
Hi @hieptl would you give me your opinion? cc: @jpelletier1 |
|
I am not sure we need human-readable skill names. As a first pass, it might be better for Skills in the menu to be listed like this: Example: |
|
@jpelletier1 I updated the PR, would you review? |
|
Hello @eureka928, While testing the pull request locally, I noticed a few points that I would like to share. Issue 1: issue1.movIssue 2: Issue 3: issue3.movIssue 4: issue4.movThank you very much for your time and effort. 🙏 ⸻ Hello @enyst and @jpelletier1, While testing these changes, I made the following assumptions, and I would appreciate your confirmation: Assumption 1: Assumption 2: Please feel free to let me know if these assumptions are accurate. Thank you very much! 🙏 |
90ad8d8 to
c6c6950
Compare
|
Hi @hieptl, thank you for the thorough testing and detailed feedback! 🙏 Regarding Issues #2 and #3 (slash trigger behavior): These are working as intended. The slash command menu is designed to only trigger when This is a deliberate design choice to:
So your assumptions are correct:
Issue #3 (cursor-to-start) follows from the same constraint — once there's other text in the input, the full I'll look into fixing Issue #1 (Markdown in descriptions) and Issue #4 (menu misalignment on resize) separately. |
|
Hello @eureka928, Could you please also take a look at issue 3? Based on the requirements, it is still considered valid. While typing / at the very beginning works as expected, the slash command does not trigger if a user enters text first and then moves the cursor back to the starting position.
This appears to be related to the current technical approach and would need to be addressed as part of the fix. For example, if a user types a longer message and then moves back to the beginning to insert a command, they currently have to delete all existing text before the slash command will work again, which is not an ideal experience. Thank you very much! 🙏 |
5f7b92c to
1b979e1
Compare
Screencast.from.2026-02-26.22-30-18.webm |
|
Video looks good to me. I haven't been able to test this branch, but video seems to implement the feature correectly. |
enyst
left a comment
There was a problem hiding this comment.
Awesome, thank you!
I think maybe we could take this PR in, and play with the behavior to see if/what more we may need.
Would you approve on this so that @hieptl can test with branch and merge when he is available? |
Add a hook that detects "/" at the start of chat input, builds a filtered list of skill commands, and handles keyboard navigation (Arrow Up/Down, Enter/Tab to select, Escape to close).
Add an accessible popup menu that renders above the chat input, showing filtered slash commands with role="listbox"/role="option" and keyboard-driven selection highlighting.
Wire the useSlashCommand hook and SlashCommandMenu component into CustomChatInput and ChatInputContainer so typing "/" shows the autocomplete menu with available agent skills and commands. Closes OpenHands#12623
Add mock microagents endpoint to conversation handlers so the slash command menu is testable in dev:mock mode without a backend.
Update menu to match reference design with Commands header, bold skill names, slash command labels, and first-sentence descriptions. Filter skills to only show explicit slash triggers and agentskills type. Update mock data with realistic skill types for testing.
Trim contentEditable innerText to handle trailing newlines that break the slash detection regex. Reset selectedIndex on item selection to prevent stale index on menu reopen.
- Fix description truncation by extracting from YAML frontmatter description field, falling back to first meaningful body line - Add i18n for aria-label using existing CHAT_INTERFACE$COMMANDS key - Replace raw span tags with Typography.Text component - Extract SlashCommandMenuItem into its own component - Add 15 unit tests covering menu rendering, selection, descriptions, accessibility, and getSkillDescription edge cases
- Add bounds check for selectedIndex before calling selectItem - Restore focus after command selection for Enter-to-submit - Memoize getSkillDescription in SlashCommandMenuItem - Fix test import ordering
The isMobileDevice() check used touch support alone, which caused
touchscreen laptops to be treated as mobile devices. This disabled
Enter-to-submit in the chat input. Now checks the primary pointer
type via matchMedia("(pointer: fine)") to distinguish laptops from
real mobile devices.
…bile detection, and simplify menu display
…nu positioning Strip inline markdown syntax (bold, italic, code, links, images) from skill descriptions so they render as plain text in the slash command menu. Anchor the slash command menu to the input row instead of the full container so grip-resizing no longer misaligns the menu.
…rt of input Refactor slash command detection to be cursor-aware so the menu triggers when "/" is typed anywhere (after a space or at position 0), not only when the entire input matches /^\/<word>$/. Selection now replaces only the slash word instead of wiping the full input. Cursor-movement keys dismiss the menu to prevent stale range issues.
1b979e1 to
bb32845
Compare
|
Oh, no worries, eureka! For visibility for everyone: I mentioned in DM, personally I prefer to leave it to our Frontend wizards - Hiep Le, Stephan -, to approve/merge (it's a FE PR), but that's just a detail and I'm sure they'll take a look soon. Whether or not they may want to test it manually again in this case, I don't know; that, too, is up to them. In my reading, Joe doesn't have concerns either. We have 201 PRs in this repo (!), though, that's a very high maintainer load. I just think we could give some space to our FE do their magic, they know better how FE is like. Hitting some 'approved' button or not doesn't matter compared to that. 😅 |
|
Thanks @enyst :) @eureka928 - overall the video looks like it implements the requirements, so thanks! I am not part of the OpenHands engineering team, so I don't have the authority to review the code ;-) So agree we'll leave it to FE code owners to review next! |

Summary of PR
Adds a slash command autocomplete menu to the chat input. When the user types
/, a dropdown appears showing available agent skills as slash commands with a "Commands" header, bold skill names, command labels, and first-sentence descriptions.Filtering logic:
/triggers (TaskTrigger) use those triggers directly/triggers get a derived/<skill-name>commanddocker,container) and repo-type skills are excluded from the menuFeatures:
/infilters to/init)code-search→ "Code search")role="listbox",role="option",aria-selected)Demo Screenshots/Videos
N/A.
Change Type
Checklist
Fixes
Resolves #12623
Release Notes
Adds a slash command menu to the chat input that displays available agent skills and commands when typing
/, with real-time filtering, keyboard navigation, and first-sentence descriptions.