Skip to content

Custom Commands

Phi Trần tuấn edited this page Jun 30, 2026 · 1 revision

Custom Commands — Title: Custom Commands

# Custom Commands

You can define your own slash commands without touching the source code.

## Location

.fw_data/commands/.md


Every `.md` file in this folder becomes a `/<name>` command in the REPL. Use `/commands` to list all custom commands currently available; `/help` also recaps this syntax at the bottom of the screen.

## Frontmatter

```markdown
---
description: Short description shown when the command runs
agent: build        # optional — override agent mode (build/plan) for this command only
model: <model_id>   # optional — override the model for this command only
subtask: true        # optional — run as an independent subagent (via the `task` tool) instead of appending to the main conversation
---

Template content goes here...

If agent/model aren't declared, the command uses the session's current agent/model.

Template variables

Syntax Meaning
$ARGUMENTS everything after the command name, e.g. /mylint src/$ARGUMENTS = src/
$1 $2 ... positional arguments, split by whitespace
!`shell command` disabled by default for safety — see note below
@file embeds a file's content into the template (same as @file in normal input)

About !`shell`

The !`...` syntax is preserved in custom commands but is not executed automatically. When encountered, the system returns a warning like:

[shell disabled] '!`...`' is disabled by default for safety. Run this manually if you trust it. cmd=<command, truncated at 200 chars>

This is a deliberate safety default — if you trust the command, run it manually instead of letting a custom command silently inject shell output into the prompt.

subtask mode

When subtask: true, the command runs as an independent subagent (via the internal task tool) instead of being appended directly to the session's main conversation history — useful for sub-tasks where you don't need to keep all the intermediate context in the main thread.

Example

.fw_data/commands/lint.md:

---
description: Run lint and summarize errors for a given directory
agent: build
subtask: true
---
Analyze lint errors in the $1 directory. List the most severe issues first,
with brief fix suggestions. Don't auto-fix files unless explicitly asked.

Call it with: /lint src/

➡️ See how /init auto-generates AGENTS.md (not a custom command, but the same "project-level rules" spirit) at Configuration.

Clone this wiki locally