.mux/commands/ to define custom slash commands that run in your workspace context. The command’s stdout becomes your message to the model.
Quick Start
Create an executable script in your workspace:/dry in chat - the output becomes your message.
File Convention
- Location:
<workspacePath>/.mux/commands/<name> - Name format: lowercase letters, numbers, and hyphens (e.g.,
my-command) - Interpreter: via shebang (
#!/bin/bash,#!/usr/bin/env node, etc.)
Progressive Examples
Level 1: Static Message
The simplest command outputs a fixed prompt:/dry
Level 2: Using Arguments
Commands receive arguments from the same line:/pr-review 123
→ argv: ["123"]
Level 3: Using stdin
Content after the first newline becomes stdin:["--audience", "developers"], stdin: the text after the blank line
Result Protocol
| Exit Code | Behavior |
|---|---|
| 0 | Success - stdout sent as your message to the model |
| 2 | User abort - output shown but NOT sent (edit and retry) |
| Other | Error - shows error message, returns to editing |
- stdout: becomes the message text sent to the model
- stderr: shown in the progress UI (for debugging), not sent to model
Real-time Output
While your command runs, output streams in real-time below the chat input. You can:- Watch progress as lines arrive
- Cancel mid-execution (Escape key or cancel button)
- On cancel: returns to editing with original message preserved
Environment Variables
Custom commands receive the same environment variables as init hooks:MUX_PROJECT_PATH- absolute path to your projectMUX_RUNTIME- runtime type (local, ssh, docker)MUX_WORKSPACE_NAME- name of the current workspaceMUX_WORKSPACE_PATH- absolute path to the workspace
More Examples
Context-aware review
Node.js command
Autocomplete
Custom commands appear in slash command suggestions after built-in commands. Type/ to see available commands.
Comparison with Built-in Commands
| Feature | Built-in (/compact, /model) | Custom (.mux/commands/*) |
|---|---|---|
| Execution | In-process | Subprocess |
| Output | Immediate action | Becomes user message |
| Customizable | No | Yes |
| Streaming | N/A | Real-time |