Start typing to search the documentation.

Docs navigation

Commands

Create a reusable discipline review command in .opencode/commands/review.md:

.opencode/commands/review.md
Review $ARGUMENTS for design completeness, coordination risks, and unresolved assumptions. Use the available project information and relevant specialist guidance; report evidence and open questions.

Run it from the TUI with a target:

/review the Level 02 HVAC model against the architectural layout

Nova Flex submits the command template with your supplied subject as a user prompt. A command provides reusable direction; it does not force a fixed engineering sequence.

Markdown

Put global commands in ~/.config/opencode/commands/ and project commands in .opencode/commands/.

~/.config/opencode/commands/review.md
.opencode/commands/review.md

Only .md files are discovered. Nested paths become command names with / separators:

.opencode/commands/team/review.md
Review $ARGUMENTS using the team's checklist.

Run the nested command as /team/review Level 02 HVAC model. The legacy singular directory command/ is also discovered, but use commands/ for new files.

Add YAML frontmatter when the command needs metadata. The trimmed Markdown body is always the prompt template.

.opencode/commands/review.md
---
description: Review an engineering model for completeness and coordination
agent: plan
model: anthropic/claude-sonnet-5-5#high
---

Review $ARGUMENTS. Summarize the relevant evidence, identify conflicts or missing inputs, and state any assumptions that need confirmation.

JSON

Define commands under commands in any Nova Flex JSON or JSONC configuration file. Each command requires a template.

opencode.jsonc
{
  "$schema": "https://novaflex.tech/config.json",
  "commands": {
    "review": {
      "description": "Review an engineering model for completeness and coordination",
      "template": "Review $ARGUMENTS. Summarize relevant evidence, identify conflicts or missing inputs, and state assumptions that need confirmation.",
    },
  },
}

Fields

Markdown frontmatter and JSON entries accept the same fields, except that Markdown gets template from the file body.

FieldRequiredBehavior
templateJSON onlyPrompt template.
descriptionNoText shown in command lists and discovery.
agentNoAgent selected when the command runs.
modelNoModel override in provider/model or provider/model#variant format.
subagentNotrue runs in a background child session; false forces the current session.
subtaskNoDeprecated alias for subagent.

For example, this JSON command sets every current optional field:

opencode.jsonc
{
  "commands": {
    "audit": {
      "template": "Audit $ARGUMENTS.",
      "description": "Audit a package",
      "agent": "general",
      "model": "anthropic/claude-sonnet-5-5#high",
      "subagent": true,
    },
  },
}

Do not put template in Markdown frontmatter; the body supplies it.

Arguments

Use $ARGUMENTS for the complete argument string exactly as entered.

.opencode/commands/component.md
Review the $ARGUMENTS model package for completeness and discipline coordination.

For /component Account Settings, the placeholder becomes Account Settings.

Positions

Use $1, $2, and higher numbers for parsed positional arguments. Single or double quotes group words and are removed.

.opencode/commands/check.md
Check $1. Focus on $2.

For /check Building 01 "plant-room clearances", $1 becomes Building and $2 becomes 01 plant-room clearances.

The highest-numbered placeholder consumes its argument and everything after it. Missing positions become empty strings.

.opencode/commands/compare.md
Compare $1 with $2.

For /compare api stable branch, Nova Flex submits Compare api with stable branch.

Fallback

When a template has no $ARGUMENTS or positional placeholder, Nova Flex appends non-empty arguments after a blank line.

.opencode/commands/explain.md
Explain the design assumptions clearly.

For /explain the site utility plan, the prompt becomes:

Explain the design assumptions clearly.

the site utility plan

Shell

Wrap a shell command in ! followed by backticks to insert its output before the prompt is submitted.

.opencode/commands/review-diff.md
Review the current model and documentation changes:

!`git diff --stat && git diff`

Nova Flex runs each block with the configured shell in the active project location and inserts its combined output. Argument placeholders are expanded first:

.opencode/commands/history.md
Summarize recent project changes:

!`git log --oneline -$1`

For /history 5, the shell receives git log --oneline -5. Do not place untrusted arguments inside shell blocks.

Attachments

Stored templates do not expand @path; it remains ordinary prompt text.

.opencode/commands/readme.md
Review @README.md.

To attach a file, add it through the composer when invoking the command. Nova Flex preserves those composer attachments when it submits the expanded prompt.

Execution

Commands expand arguments and shell blocks before submitting a durable user prompt. They run in the current session by default.

.opencode/commands/plan.md
---
agent: plan
---

Plan an appropriate approach for $ARGUMENTS. Adapt it to the available project information and current phase.

Running /plan migration switches the current session to plan before submitting the prompt.

Model selection follows these rules:

  1. A command model overrides every other model.
  2. Otherwise, the selected command agent’s configured model overrides the model active at invocation.
  3. Otherwise, the current session model remains active.

For example, this command selects both its agent and an explicit model:

.opencode/commands/design.md
---
agent: plan
model: openai/gpt-6.1-sol#high
---

Design $ARGUMENTS.

Background

Set subagent: true to run a command in a background child session.

.opencode/commands/audit.md
---
description: Review a discipline handover
agent: general
subagent: true
---

Review $ARGUMENTS for completeness, evidence, and coordination needs before handover.

The parent stays available and keeps its agent and model. Nova Flex sends the child’s result or failure back to the parent when the child finishes.

ValueBehavior
trueAlways use a child, even when the selected agent has mode: primary.
falseAlways use the current session, even when the selected agent has mode: subagent.
OmittedUse a child only when the selected agent has mode: subagent.

The child uses the command model, then the selected agent’s model, then the parent’s model. Legacy subtask remains accepted; if both fields are present, subagent wins.

subagent: false
subtask: true

This example runs in the current session because subagent takes precedence.

Loading

Markdown and JSON commands share one registry. Later sources replace earlier commands with the same name.

~/.config/opencode/commands/review.md   # Lower priority
.opencode/commands/review.md           # Replaces the global command

Project sources take precedence over global sources, and nearer project sources take precedence over ancestor sources. A custom definition can also replace an earlier built-in command. Nova Flex reloads command files and configuration changes automatically.

.opencode/commands/review.md
Review the staged project changes and summarize their effect on the building model: !`git diff --cached`

Saving this file updates /review without restarting Nova Flex.