Skip to content

Subagents

Subagents are specialized AI agents that can be invoked for focused tasks. Define them in subagents/<name>/SUBAGENT.md.

my-capability/
├── capability.toml
└── subagents/
└── code-reviewer/
└── SUBAGENT.md
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep, Bash
model: inherit
permissionMode: default
---
You are a senior code reviewer ensuring high standards.
FieldRequiredDescription
nameYesUnique identifier (lowercase, hyphenated)
descriptionYesWhen to invoke this subagent
toolsNoAllowlist of tools
disallowedToolsNoTools to remove from allowlist
modelNosonnet, opus, haiku, or inherit
permissionModeNodefault, acceptEdits, dontAsk, bypassPermissions, plan
skillsNoSkills to preload for this agent
hooksNoLifecycle hooks scoped to this subagent

These fields are only used when syncing to OpenCode:

FieldDescription
modeprimary (runs in main context) or subagent (spawned)
temperatureModel sampling temperature
maxStepsMaximum turns before stopping
hiddenHide this agent from listings
toolPermissionsObject with tool names as keys and boolean values
permissionsGranular permissions: edit, bash, webfetch
modelIdFull model ID (e.g., anthropic/claude-sonnet-4)

Subagents are written to .claude/agents/<name>.md:

---
name: code-reviewer
description: "Reviews code for quality and best practices"
tools: Read, Glob, Grep
model: sonnet
---
You are a senior code reviewer ensuring high standards.

Subagents are written to .opencode/agents/<name>.md with OpenCode-specific formatting:

---
description: "Reviews code for quality and best practices"
model: anthropic/claude-sonnet-4
tools:
read: true
glob: true
grep: true
---
You are a senior code reviewer ensuring high standards.

Model names are automatically mapped:

  • sonnetanthropic/claude-sonnet-4
  • opusanthropic/claude-opus-4
  • haikuanthropic/claude-haiku-3-5

Permission modes are also mapped:

  • acceptEdits{ edit: 'allow', bash: { '*': 'ask' } }
  • dontAsk{ edit: 'allow', bash: { '*': 'allow' } }
  • plan{ edit: 'deny', bash: { '*': 'deny' } }
import type { CapabilityExport, SubagentExport } from "@omnidev-ai/core";
const reviewer: SubagentExport = {
subagentMd: `---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---
You are a specialized reviewer...`
};
export default {
subagents: [reviewer]
} satisfies CapabilityExport;