How I built slash commands for my desktop AI companion: 15 actions, 4 guided stages, and a draft that survives the menu
Ankita AI is the desktop AI assistant I build, by Krish Verma — a little companion that lives on your desktop and gets things done while you are away. For months its desktop app had a command palette and a chat box that did not know about each other. The palette could do everything; the composer could only type. So every action meant leaving the conversation, finding the right menu, and coming back. I built slash commands to close that gap: type / at the start of a message and the app's real actions show up above the composer, searchable, keyboard-driven, and — the part that took the most care — without ever eating the text you had already typed.
The menu is deliberately small. Fifteen commands, in five groups: Quick actions, Conversation, Workspace, Apps & settings, Skills. /model switches the model, /project picks a workspace, /skill prepares a request with an installed skill, plus /schedule, /review, /projects, /new, /export, /clear, /plugins, /browser, /skills, /settings, /updates, /commands. The number is a design decision: the menu only offers actions the desktop app already has a handler for.
Four stages, not one list
Typing / opens the command list, but three commands open a guided picker instead of running immediately. The stages are commands, model, project, and skill, and the parser is strict about getting there. slashQuery() accepts one line only: a second / anywhere, or a newline, means it is not a command at all. A stage opens only when the first word is a stage name followed by a space — /model alone shows the command; /model g opens the model picker filtered to g.
Each picker is honest about what it can actually do. /model lists discovered provider models with vendor and id, and marks text-only models where the provider reports no tools. On the ChatGPT browser route, it does not offer fake local switching: it explains that model choice belongs to the selected ChatGPT chat. /project lists active projects and always offers an explicit "No project" choice, because working without a project is a real state, not an error. /skill loads enabled installed skills through the existing palette index and prepares an editable request — the draft literally reads "Use the <skill> skill. …" — and nothing sends until you are ready. Search covers names, aliases, and descriptions, so /settings also answers to config and /commands answers to help.
The draft is the hard part
The menu is easy. The draft is where the bugs live. The moment you open the menu, the composer holds text you may have spent a minute writing, and every path through the menu has to decide what happens to it. The rule I landed on: the toolbar saves your ordinary draft while you browse commands, and dismissal, a model or project selection, or a navigation action restores it. A skill instruction is added before the saved text, so your words stay yours and the skill's framing stays first. Attachments stay with their original teammate throughout.
There is one exception, and it is the decision I am least sure about: if you replace the command with ordinary text, the suspended old text is discarded. The menu treats typing over the command as changing your mind. That is the only path where text is silently lost, and it is the only path I could not make safe without a second confirmation dialog — which would have made the menu feel like a form. Arrow keys navigate and wrap around the list, Enter or Tab chooses, Escape dismisses, Backspace from an empty guided picker returns to all commands, and IME composition never submits a command mid-character. /clear still asks for confirmation and /export still goes through the protected transcript save dialog; the menu never shortcuts a guard the action already had.
Bounded by design
The menu is capped at 320 CSS pixels, its scrollbar is hidden while scrolling still works, and small windows drop the selected-action preview rather than overflowing the pane. A command menu that covers the conversation it is supposed to serve has failed at its one job.
Verification: 7/7 catalog, parser, search, runtime, choice, draft, and selection unit tests; 31/31 checks in a real app in Chromium with zero renderer errors; 5/5 in a built renderer under native Electron; 62/62 across the focused CLI suites. The full serial suite ran 1,366 tests with 1,362 passing — the 3 failures are pre-existing browser-workflow failures reproduced on a clean baseline, unrelated to the slash UI.
The honest limits: no installer or packaged ASAR check was run, physical screen-reader behaviour was not exercised, and macOS, Linux, and mixed-DPI monitors were not tested.
The code is in Ankita on GitHub, and the desktop app itself is at ankita-sable.vercel.app.
Tell me I'm wrong: when you type ordinary text over a suspended draft, my menu discards it silently instead of asking. Is that the right call for a menu that is supposed to stay out of the way — or should a command menu never be allowed to throw away words you already typed, whatever the cost in clicks?
— Krish Verma, creator of Ankita AI
