USER_COMMANDS.md
User defined commands
Overview
Agent Smith supports custom markdown prompt commands loaded from:
global commands dir:
~/.config/llm/<name>.mdproject commands dir:
<repo_root>/.llm/<name>.mdor<cwd>/.llm/<name>.md
Project commands override global ones on name collision.
They are used via /cmd <command_name> slash command.
File Format
Command files are regular markdown (.md) with optional placeholders:
Expanded prompt text goes here. Use placeholders to inject arguments
and dynamic context:
- `{{ARG1}}`, `{{ARG2}}`, ... — positional arguments
- `{{ARGS}}` — all arguments joined with spaces
- `{{CONTEXT}}` — output from the optional script block
```lsh
# Shell commands executed in a forked child process.
# Only the last command's stdout becomes the {{CONTEXT}} value.
git diff --stat
```
Placeholders:
| Placeholder | Source |
|---|---|
{{ARG1}}, {{ARG2}}, ... | Positional arguments passed after the command name |
{{ARGS}} | All arguments joined with spaces |
{{CONTEXT}} | Stdout from the last command in the fenced lsh code block |
Script execution:
The fenced lsh code block (optional) is executed in a forked child
process using the Lilush shell pipeline. Only the last command's stdout
is captured and becomes available as the {{CONTEXT}} placeholder value.
Earlier commands run normally with their output going to /dev/null.
Execution flow:
Command file is located and read
Argument placeholders (
{{ARG<N>}},{{ARGS}}) are expanded in both body and scriptIf an
lshblock is present, it executes in a forked childThe script's stdout replaces
{{CONTEXT}}in the bodyThe fully expanded body text is injected as the user message