What this thread does
Do first: Create .opencode/commands/review.md, write the prompt in its body, then invoke /review with the desired arguments.
Short answer
As of November 2026, custom commands submit expanded user prompts. Markdown is enough for the basic case; JSON definitions require a template.
What to do
Example file body:
Review $ARGUMENTS for bugs and missing tests.
The page invokes it as /review src/auth.ts.
| Item | Value / behavior |
|---|---|
| Project directory | .opencode/commands/; only .md files are discovered |
| Legacy directory | Singular command/ is still read; use commands/ for new files |
| Nested name | .opencode/commands/team/review.md becomes /team/review |
| JSON / JSONC | commands object in opencode.jsonc; each entry requires template |
| Markdown prompt | Trimmed body supplies the template; do not add template to frontmatter |
| Optional metadata | description for discovery; agent selects a profile; model accepts provider/model or provider/model#variant |
$ARGUMENTS | Complete argument string exactly as entered |
$1, $2, higher positions | Parsed arguments; quotes group words and are removed; highest position consumes the remainder; missing positions become empty |
| No placeholder | Non-empty arguments append after a blank line |
subagent: true | Always use a background child, even for a primary-mode agent |
subagent: false | Always use the current session, even for a subagent-mode agent |
Omitted subagent | Child only if selected agent has mode: subagent; otherwise current session |
| Deprecated field | subtask aliases subagent; subagent wins if both occur |
A command’s model overrides the selected agent’s configured model, which overrides the current/parent model. Child execution keeps the parent available and sends back the result or failure.
To insert shell output, use ! followed by a backtick-enclosed command. The page’s example is git diff --stat && git diff. It runs in the active project with the configured shell, after argument expansion and before prompt submission. Shell blocks run outside the agent tool permission flow, so do not interpolate untrusted arguments.
Project sources override global ones; nearer project sources override ancestors. Later same-name definitions replace earlier ones, including earlier built-ins. Saves reload without restarting.
Limits and open questions
Stored templates do not expand @path; use a composer attachment when invoking the command. No version number or release date is provided for the current command behavior.
Not for: Claude Code slash command files.
Sources
- OpenCode commands documentation, Anomaly.
Checked
2026-11-16; read OpenCode commands documentation; no command was run.
Started from a post by @Anomaly, packaged by the editor. Original post