audience: [contributor, agent] source_files:
- crates/chatty-gpui/src/chatty/views/chat_input/slash.rs
- crates/chatty-gpui/src/chatty/controllers/app_controller/slash_commands.rs
- crates/chatty-tui/src/engine/commands.rs related:
- ./dev/reference/slash-commands.md
- ./dev/start/first-change.md
Add a slash command
When to read this: Expose a new /command in the chat input. Desktop (GPUI) and
terminal (TUI) register commands in different files — there is no shared
command table.
Full lookup table: slash commands reference.
Two command shapes
| Shape | Example | GPUI wiring | TUI wiring |
|---|---|---|---|
| Immediate (no args) | /compact | Picker execute_immediately: true → ChatInputEvent::SlashCommandSelected → handle_slash_command | Command variant, no Option<String> |
| Arg-based | /agent <prompt> | Picker inserts /agent (does not execute) → user sends → try_handle_arg_slash_command | Command::Agent(Option<String>) |
Skills from the project and global skill directories (.agents/skills/,
.claude/skills/; see SkillService) appear in both pickers with a skill
badge, rescanned each time the picker opens. Do not
register a skill as a built-in command.
GPUI (desktop)
- Add a
SlashCommandtoSLASH_COMMANDSincrates/chatty-gpui/src/chatty/views/chat_input/slash.rs(command,description,insert_text,execute_immediately). - Immediate commands: add a match arm in
ChattyApp::handle_slash_command(crates/chatty-gpui/src/chatty/controllers/app_controller/slash_commands.rs). - Arg-based commands: handle the prefix in
ChattyApp::try_handle_arg_slash_commandin the same file. Returntrueso the message is not forwarded to the LLM. ChattyAppalready routesChatInputEvent::SlashCommandSelectedand interceptsSendfor arg-based commands — no extra subscribe.
TUI (terminal)
- Add a
Commandvariant and aparse_commandmatch arm incrates/chatty-tui/src/engine/commands.rs. - Handle the variant in the engine (same file /
ChatEngine). - The TUI slash menu builds from the same
Commandparse list plus skills (crates/chatty-tui/src/ui/input.rs). If the new command should appear in the/picker, add it there too. - Add a parse test in
crates/chatty-tui/src/engine/helpers.rs(parses_new_slash_commands).
TUI-only today: /model, /tools, /modules, /update, /quit, /exit.
GPUI has no /quit (window chrome handles that).
Parity checklist
- Same command string and argument syntax in both UIs, or document the
exception in slash-commands.md
(
scripts/gen-docs-reference.sh) - Immediate vs arg-based behavior matches
- Unknown
/foois ignored (TUI) or logged (GPUI) — never sent as a user message if you claimed it as a command -
make docs-genafter changing the reference table