OpenCode V2 publishes a schema for cli.json only. These schemas cover the frontmatter of agent, command, and skill markdown files.
| File | For | $schema in frontmatter |
|---|---|---|
opencode-command.schema.json |
commands/<name>.md |
safe, OpenCode ignores it |
agent-skill.schema.json |
skills/<id>/SKILL.md |
safe, OpenCode ignores it |
opencode-agent.schema.json |
agents/<id>.md |
do not add, see below |
---
$schema: https://gist.githubusercontent.com/remorses/9f3737a6f516c01f4bdb612045c64072/raw/opencode-command.schema.json
description: Commit in groups
subagent: false
---OpenCode 2.0.19 to 2.0.26 checks agent frontmatter keys against a fixed list (agentKeys in packages/core/src/config/plugin/agent.ts). Any other key, including $schema, makes the file decode as V1. The V1 decoder moves unknown keys into request.body, so V2 permissions are lost and model is dropped. Use the agent schema through editor settings only, until OpenCode accepts $schema.
The agent and command schemas list every key that the V2 decoder accepts. They reject unknown keys, because OpenCode silently ignores (commands) or misreads (agents) them. Examples: V1 variant on commands is dropped, V1 permission/disable/prompt on agents switch the file to V1 mode.
The skill schema is the union of the OpenCode V2 skill fields and the Agent Skills spec. It allows extra keys, because OpenCode ignores them and other tools use their own keys.
Code (the decoders are the source of truth; schemas match tag v2.0.26, identical to v2.0.19 except disable-model-invocation):
- Agent fields: https://github.com/anomalyco/opencode/blob/v2.0.26/packages/schema/src/config/agent.ts
- Agent markdown loader (
agentKeys, V1 fallback): https://github.com/anomalyco/opencode/blob/v2.0.26/packages/core/src/config/plugin/agent.ts - Command fields: https://github.com/anomalyco/opencode/blob/v2.0.26/packages/schema/src/config/command.ts
- Command markdown loader: https://github.com/anomalyco/opencode/blob/v2.0.26/packages/core/src/config/plugin/command.ts
- Model reference (
provider/model#variantand object form): https://github.com/anomalyco/opencode/blob/v2.0.26/packages/schema/src/config/model.ts - Permission rule: https://github.com/anomalyco/opencode/blob/v2.0.26/packages/schema/src/permission.ts
- Agent
requestoverlay: https://github.com/anomalyco/opencode/blob/v2.0.26/packages/schema/src/config/provider.ts - Skill frontmatter decoder: https://github.com/anomalyco/opencode/blob/v2.0.26/packages/core/src/config/plugin/skill-file.ts
Docs:
- Agents: https://opencode.ai/v2/docs/agents
- Commands: https://opencode.ai/v2/docs/commands
- Skills: https://opencode.ai/v2/docs/skills
- Permissions (actions, resources, matching): https://opencode.ai/v2/docs/permissions
- Tools (permission action per tool): https://opencode.ai/v2/docs/tools
- Models (references and variants): https://opencode.ai/v2/docs/models
- V1 to V2 migration: https://opencode.ai/v2/docs/migrate-v1
- Agent Skills specification: https://agentskills.io/specification