master
raw

USER_COMMANDS.md

User defined commands

Overview

Agent Smith supports custom markdown prompt commands loaded from:

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:

PlaceholderSource
{{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:

  1. Command file is located and read

  2. Argument placeholders ({{ARG<N>}}, {{ARGS}}) are expanded in both body and script

  3. If an lsh block is present, it executes in a forked child

  4. The script's stdout replaces {{CONTEXT}} in the body

  5. The fully expanded body text is injected as the user message