Build Safe Hermes Quick Commands for Repeated Actions
Hermes quick commands map a named chat command to a shell command without invoking the language model. Unlike CLI-only exclamation shell mode, quick commands can be available on supported messaging platforms as well as the CLI.
Use them for narrow, repeatable operations whose command and output are already understood: checking service health, printing a reviewed report, or running a bounded status script.
Design a narrow command contract
A safe quick command should define:
- a clear name that does not resemble a built-in command;
- a fixed executable or reviewed script;
- tightly constrained arguments;
- a predictable timeout and output size;
- no secret values in command text or chat output;
- normal approval behavior for risky operations.
Prefer a small script with its own input validation over a long shell interpolation. Treat messaging input as untrusted and never splice raw text into a shell command.
Choose appropriate jobs
Good candidates:
/healthruns a read-only health probe;/build-statusprints the latest local build result;/disk-reportruns a bounded, sanitized report script.
Poor candidates:
- arbitrary shell execution;
- payment, fulfillment, deletion, or deployment shortcuts;
- commands that print environment variables;
- scripts whose safe behavior depends on the current directory being guessed.
Rollout checklist
- The command name and help text are unambiguous.
- The underlying script is versioned and reviewed.
- Inputs are allowlisted or avoided.
- Working directory and timeout are explicit.
- Output is short and safe for every enabled platform.
- Authorization and approval policies still apply.
- Failure exits are visible to the operator.
Common pitfalls
- Treating no-model execution as low risk. Deterministic commands can still mutate real systems.
- Passing raw chat arguments to a shell. This creates an injection boundary.
- Returning private host detail in a shared channel. Sanitize output for the broadest allowed audience.
- Using a quick command where reasoning is required. If the action depends on context or judgment, use an agent workflow with explicit checks.
Verification
Test the command in a non-production profile from both CLI and one intended messaging surface. Confirm the model is not invoked, authorization is enforced, the working directory is correct, output is bounded, and nonzero exits are reported. Try invalid input and verify it fails closed without reaching the shell.
Official reference: Hermes CLI quick commands.
