Start typing to search the documentation.

Docs navigation

Agents

Create a Markdown file to add a reusable agent. This example adds a checker that the project lead can ask to review a discipline package:

.opencode/agents/checker.md
---
description: Checks a building discipline package against its brief and recorded design basis
mode: subagent
model: anthropic/claude-sonnet-5-5#high
permissions:
  - action: edit
    resource: "*"
    effect: deny
  - action: shell
    resource: "*"
    effect: deny
---

Review the current discipline package against the project brief, relevant design-basis entries, and its stated checks. Report evidence, unresolved inputs, coordination risks, and findings by severity.

Ask your primary agent to use it:

Use the checker subagent to review the HVAC package for this building and report coordination risks with architecture and structure.

An agent combines a system prompt, model preference, permissions, and display details into a named assistant profile. A discipline agent can own its work across an entire building; its role describes responsibility, not a boundary on which levels or discipline records it may inspect. Cross-discipline context helps resolve interfaces and coordination issues.

Locations

Save Markdown agents globally for all projects or inside a project:

~/.config/opencode/agents/<name>.md
.opencode/agents/<name>.md

Nova Flex discovers project .opencode directories from the current directory up to the project root. A nested path becomes part of the agent ID:

.opencode/agents/team/reviewer.md  →  team/reviewer

Formats

Markdown

Frontmatter accepts the same fields as an agents configuration entry. The Markdown body becomes the agent’s system prompt:

.opencode/agents/explainer.md
---
description: Explains an engineering model or project record without changing it
mode: subagent
---

Explain the relevant model and project records in plain language. Do not change files.

V1 frontmatter fields are deprecated.

JSONC

Define agents under agents in any Nova Flex configuration file:

opencode.jsonc
{
  "$schema": "https://novaflex.tech/config.json",
  "agents": {
    "reviewer": {
      "description": "Checks a building discipline package against its brief",
      "mode": "subagent",
      "system": "Report findings in severity order.",
      "permissions": [
        { "action": "edit", "resource": "*", "effect": "deny" },
      ],
    },
  },
}

Selection

Set the primary agent used when a session has not selected one:

opencode.jsonc
{
  "$schema": "https://novaflex.tech/config.json",
  "default_agent": "writer",
  "agents": {
    "writer": { "mode": "primary" },
  },
}

The selected default must exist, be visible, and support primary use. Otherwise Nova Flex uses build, then the first visible primary-capable agent. Changing this setting does not replace the agent stored on an existing session.

Modes

Set mode according to where the agent should run:

{
  "agents": {
    "reviewer": { "mode": "subagent" },
  },
}
ModeBehavior
primaryRuns as the main agent for a session. This is the default for a new custom agent.
subagentRuns only in a child session through the subagent tool.
allRuns either as a primary agent or a subagent.

Subagents run with fresh context in foreground or background child sessions. The parent agent’s subagent permissions control which agents it may launch; the child uses its own configured permissions.

{
  "agents": {
    "orchestrator": {
      "permissions": [
        { "action": "subagent", "resource": "*", "effect": "deny" },
        { "action": "subagent", "resource": "reviewer", "effect": "allow" },
      ],
    },
  },
}

Built-ins

Nova Flex includes these visible agents:

AgentModePurpose
Build (build)primaryDefault primary agent for project work. Tools and access outside the workspace are allowed by default; sensitive environment-file reads ask for approval.
Plan (plan)primaryExplores and plans without editing normal project files. It may write Nova Flex plan files when asked, and shell commands remain permission-controlled.
General (general)subagentHandles research and multi-step work with broad tool access, but cannot launch more subagents.
Explore (explore)subagentSearches and reads project files or web sources without editing files.

Override a built-in by using the same ID:

{
  "agents": {
    "build": {
      "permissions": [
        { "action": "shell", "resource": "git push *", "effect": "ask" },
      ],
    },
  },
}

Hidden compaction, title, and summary agents perform maintenance and cannot be selected directly. V2 has no built-in scout agent.

Merging

Agent definitions merge in configuration order. Later scalar values replace earlier values, request maps merge by key, and permission rules append:

{
  "permissions": [
    { "action": "shell", "resource": "*", "effect": "ask" },
  ],
  "agents": {
    "build": {
      "permissions": [
        { "action": "shell", "resource": "git status", "effect": "allow" },
      ],
    },
  },
}

Global permissions apply before agent-specific rules, so later agent rules can refine them.

Options

Description

description explains the agent’s purpose. Add it to subagents because Nova Flex shows it to the model choosing which agent to launch:

description: Checks a building discipline package against its brief and design basis

Mode

mode accepts primary, subagent, or all. When omitted on a new custom agent, it defaults to primary:

mode: all

Model

model uses provider/model with an optional #variant:

model: anthropic/claude-sonnet-5-5#high

JSON configuration also accepts the expanded form:

{
  "agents": {
    "reviewer": {
      "model": {
        "providerID": "anthropic",
        "model": "claude-sonnet-5-5",
        "variant": "high",
      },
    },
  },
}
  • A subagent uses its configured model, or inherits the parent session’s model when none is configured.
  • A session stores its selected model separately. Selecting a primary agent by ID does not change that model.

System

system sets the agent’s system prompt. A non-empty value replaces the provider’s base prompt for that agent:

{
  "agents": {
    "reviewer": { "system": "Review only. Do not modify files." },
  },
}

Project instructions, skills, references, and other instruction sources are still added. In a Markdown agent, put this text in the document body instead of a system frontmatter field.

Permissions

permissions is an ordered list of matching rules:

{
  "agents": {
    "reviewer": {
      "permissions": [
        { "action": "*", "resource": "*", "effect": "deny" },
        { "action": "read", "resource": "src/**", "effect": "allow" },
      ],
    },
  },
}
FieldMeaning
actionTool or permission action. Wildcards are supported.
resourcePath, command, agent ID, or other value matched by the action. Wildcards are supported.
effectallow, ask, or deny.

The last matching rule wins, so put broad rules before exceptions. Common actions include:

ActionCovers
shellShell commands
editEdit, write, and patch tools
subagentChild agents
read, glob, grepLocal discovery tools
webfetch, websearchWeb tools
skillSkill loading

For read, edit, and external_directory resources, Nova Flex expands ~ and $HOME:

{ "action": "read", "resource": "~/notes/**", "effect": "allow" }

Shell resources remain raw command text and do not expand those values.

Steps

steps sets a positive maximum number of model steps:

steps: 8

On the final step, Nova Flex removes tools and asks the model to summarize in text. New user input resets the allowance.

Hidden

hidden removes an agent from normal listings, interactive discovery, and the subagent catalog:

hidden: true

This controls visibility, not security. Use permissions to restrict behavior.

Color

color sets the agent’s UI color using a six-digit hex value:

color: "#ff6b6b"

Disabled

disabled removes a built-in or custom agent at that point in configuration loading:

{
  "agents": {
    "plan": { "disabled": true },
  },
}

Request

request accepts per-agent header and JSON body overlays:

{
  "agents": {
    "reviewer": {
      "request": {
        "headers": { "x-agent": "reviewer" },
        "body": { "temperature": 0.1 },
      },
    },
  },
}

Do not use legacy top-level fields such as temperature, top_p, prompt, permission, tools, disable, or maxSteps in new V2 agent configuration.