Subagents
Subagents are specialized AI agents that can be invoked for focused tasks. Define them in subagents/<name>/SUBAGENT.md.
Structure
Section titled “Structure”my-capability/├── capability.toml└── subagents/ └── code-reviewer/ └── SUBAGENT.mdSUBAGENT.md format
Section titled “SUBAGENT.md format”---name: code-reviewerdescription: Reviews code for quality and best practicestools: Read, Glob, Grep, Bashmodel: inheritpermissionMode: default---
You are a senior code reviewer ensuring high standards.Frontmatter fields
Section titled “Frontmatter fields”| Field | Required | Description |
|---|---|---|
name | Yes | Unique identifier (lowercase, hyphenated) |
description | Yes | When to invoke this subagent |
tools | No | Allowlist of tools |
disallowedTools | No | Tools to remove from allowlist |
model | No | sonnet, opus, haiku, or inherit |
permissionMode | No | default, acceptEdits, dontAsk, bypassPermissions, plan |
skills | No | Skills to preload for this agent |
hooks | No | Lifecycle hooks scoped to this subagent |
OpenCode-specific fields
Section titled “OpenCode-specific fields”These fields are only used when syncing to OpenCode:
| Field | Description |
|---|---|
mode | primary (runs in main context) or subagent (spawned) |
temperature | Model sampling temperature |
maxSteps | Maximum turns before stopping |
hidden | Hide this agent from listings |
toolPermissions | Object with tool names as keys and boolean values |
permissions | Granular permissions: edit, bash, webfetch |
modelId | Full model ID (e.g., anthropic/claude-sonnet-4) |
Provider Output
Section titled “Provider Output”Claude Code
Section titled “Claude Code”Subagents are written to .claude/agents/<name>.md:
---name: code-reviewerdescription: "Reviews code for quality and best practices"tools: Read, Glob, Grepmodel: sonnet---
You are a senior code reviewer ensuring high standards.OpenCode
Section titled “OpenCode”Subagents are written to .opencode/agents/<name>.md with OpenCode-specific formatting:
---description: "Reviews code for quality and best practices"model: anthropic/claude-sonnet-4tools: read: true glob: true grep: true---
You are a senior code reviewer ensuring high standards.Model names are automatically mapped:
sonnet→anthropic/claude-sonnet-4opus→anthropic/claude-opus-4haiku→anthropic/claude-haiku-3-5
Permission modes are also mapped:
acceptEdits→{ edit: 'allow', bash: { '*': 'ask' } }dontAsk→{ edit: 'allow', bash: { '*': 'allow' } }plan→{ edit: 'deny', bash: { '*': 'deny' } }
Programmatic subagents
Section titled “Programmatic subagents”import type { CapabilityExport, SubagentExport } from "@omnidev-ai/core";
const reviewer: SubagentExport = { subagentMd: `---name: code-reviewerdescription: Reviews code for quality and best practicestools: Read, Glob, Grepmodel: sonnet---
You are a specialized reviewer...`};
export default { subagents: [reviewer]} satisfies CapabilityExport;