# OpenCode: create and invoke specialized subagents

> News on WhatWorks · published 2026-11-16 · fresh until 2026-12-16 · https://whatworks.dev/t/opencode-create-invoke-specialized-subagents
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, OpenCode creates project agents in `.opencode/agents/<name>.md`. Set `description` and `mode: subagent`, then ask the primary agent to use that profile. Omitted mode defaults to `primary`; child models inherit unless configured. Use `mode: subagent`.

**Not for:** OpenCode V1 agent configuration.

Subjects: agent-workflows, opencode, prompting

Do first: Create `.opencode/agents/explainer.md` with a purpose description and `mode: subagent`, then ask the primary agent to use the explainer subagent.

## Short answer

As of November 2026, OpenCode V2 gives subagents fresh child-session context and runs them in the background. The primary agent receives reports when the child goes idle and after later work.

## What to do

A minimal project profile (put task instructions after the closing delimiter):

```yaml
---
description: Explains code without changing it
mode: subagent
---
```

| Field / choice | Concrete behavior |
| --- | --- |
| Project file | `.opencode/agents/<name>.md`; nested `.opencode/agents/team/reviewer.md` has ID `team/reviewer` |
| Discovery | Project `.opencode` directories from current directory up to project root |
| `description` | Purpose supplied to the model selecting a specialist |
| `mode` | `primary` default for new custom agents; `subagent` child only; `all` either |
| Prompt | Markdown body; JSON uses `system`, replacing the provider base prompt while project instructions still apply |
| JSON alternative | `agents` entries in `opencode.jsonc` |
| `model` | `provider/model` or `provider/model#variant`; omitted child model inherits parent; expanded JSON accepts `providerID`, `model`, `variant` |
| `permissions` | Ordered `action`, `resource`, `effect` rules; effects `allow`, `ask`, `deny`; last matching rule wins |
| Read-only example | Deny `edit` and `shell` actions for resource `*`; these cover file changes and shell commands |
| Delegation | Parent `subagent` permissions determine which child IDs it can launch; child uses its own permissions |
| `steps` | Positive model-step maximum; `steps: 8` is the page’s example; final step removes tools for a text report; new input resets allowance |
| `hidden: true` | Removes listings, interactive discovery and subagent catalog; visibility control only |
| `disabled: true` | Removes an agent during configuration loading |

Ask the primary agent to use the profile by name, as the page does for its reviewer example. Definitions merge in load order: later scalar values replace, request maps merge, and permission rules append. Global permissions precede agent rules, so place broad rules before narrower exceptions.

## Limits and open questions

Omitting `mode` does not create a child-only specialist. Built-in `general` handles multi-step work but cannot launch more subagents; `explore` searches and reads without editing. V2 has no built-in `scout`.

V1 top-level `prompt`, `permission`, `maxSteps` and `disable` are legacy; use V2 `system`, `permissions`, `steps` and `disabled`. Legacy `temperature`, `top_p` and `tools` also do not belong in new V2 definitions. `request` overlays are stored but currently not sent by the V2 session runner; configure active request options on a provider, model or variant instead. The page gives no release date.

Supported V1 files still load, but convert each profile’s frontmatter together: mixing V1 fields into a V2 file can ignore them with a warning. The legacy `agent/`, `mode/` and `modes/` directories remain discoverable alongside `agents/`; new profiles should use `agents/`.

Not for: OpenCode V1 agent configuration.

## Sources

- [OpenCode agents documentation](https://opencode.ai/docs/agents/), Anomaly.
- [V1 migration: agent fields and files](https://opencode.ai/docs/migrate-v1/), Anomaly.

## Checked

2026-11-16; read OpenCode agents documentation; V1 migration: agent fields and files; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.