This document explains the configuration files in the .opencode system.
The .opencode system uses several configuration files:
| File | Purpose |
|---|---|
config.json |
Selects default agent |
opencode.json |
OpenCode schema and settings |
agent-metadata.json |
Registry of agents, subagents, skills |
agent/*.md |
Agent definitions |
subagents/*.md |
Subagent definitions |
skills/*/SKILL.md |
Skill definitions |
Location: .opencode/config.json
Selects the default agent for this project.
{
"agent": "python-expert"
}| Field | Type | Description |
|---|---|---|
agent |
string | Name of the default agent |
When OpenCode starts in this project, it reads config.json to determine which agent to load. The agent name must match an agent defined in agent/*.md.
Edit config.json:
{
"agent": "different-agent"
}Location: .opencode/opencode.json
Provides schema reference and project-level OpenCode settings.
{
"$schema": "https://opencode.ai/config.json"
}{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-20250514",
"permission": {
"edit": "ask",
"bash": {
"*": "ask",
"git status": "allow"
},
"skill": {
"*": "allow",
"internal-*": "deny"
}
},
"tools": {
"write": true,
"edit": true,
"bash": true
},
"agent": {
"build": {
"model": "anthropic/claude-sonnet-4-20250514",
"temperature": 0.3
},
"plan": {
"permission": {
"edit": "deny",
"bash": "deny"
}
}
}
}{
"model": "anthropic/claude-sonnet-4-20250514"
}{
"permission": {
"edit": "ask",
"bash": "ask",
"webfetch": "deny"
}
}| Value | Behavior |
|---|---|
allow |
Always allowed without prompting |
ask |
Prompt user for approval |
deny |
Operation blocked |
{
"tools": {
"write": true,
"edit": true,
"bash": true,
"skill": true
}
}{
"agent": {
"plan": {
"permission": {
"edit": "deny"
},
"tools": {
"bash": false
}
}
}
}Location: .opencode/config/agent-metadata.json
Central registry for all agents, subagents, and skills.
{
"$schema": "https://opencode.ai/schemas/agent-metadata.json",
"schema_version": "1.0.0",
"description": "Centralized metadata for python-backend Python agents",
"agents": {
"python-expert": {
"id": "python-expert",
"name": "Python Expert",
"category": "core",
"type": "agent",
"version": "1.0.0",
"author": "opencode",
"tags": ["python", "pytest", "fastapi", "pyproject"],
"dependencies": [
"subagent:python-coder",
"subagent:python-reviewer",
"subagent:python-tester",
"subagent:python-scout",
"skill:python-fundamentals",
"skill:python-fastapi",
"skill:python-backend",
"skill:python-testing-general",
"skill:python-asyncio",
"skill:python-type-hints",
"context:python-standards",
"context:python-patterns",
"context:python-security"
]
}
},
"subagents": {
"python-coder": {
"id": "python-coder",
"name": "Python Coder",
"category": "development",
"type": "subagent",
"version": "1.0.0",
"author": "opencode",
"tags": ["coding", "implementation", "generation"],
"dependencies": [
"skill:python-fundamentals",
"context:python-standards"
]
}
},
"skills": {
"python-fundamentals": {
"id": "python-fundamentals",
"name": "Python Fundamentals",
"version": "1.0.0",
"triggers": ["*.py", "python", "dataclass", "async", "type hint"]
}
}
}Defines primary agents:
"agents": {
"<agent-id>": {
"id": "agent-id",
"name": "Display Name",
"category": "core",
"type": "agent",
"version": "1.0.0",
"author": "author-name",
"tags": ["tag1", "tag2"],
"dependencies": [
"subagent:subagent-name",
"skill:skill-name",
"context:context-name"
]
}
}Defines subagents:
"subagents": {
"<subagent-id>": {
"id": "subagent-id",
"name": "Display Name",
"category": "category",
"type": "subagent",
"version": "1.0.0",
"author": "author-name",
"tags": ["tag1", "tag2"],
"dependencies": [
"skill:skill-name",
"context:context-name"
]
}
}Defines skills:
"skills": {
"<skill-id>": {
"id": "skill-id",
"name": "Display Name",
"version": "1.0.0",
"triggers": ["trigger1", "trigger2"]
}
}| Prefix | Example | Description |
|---|---|---|
subagent: |
subagent:python-coder |
References a subagent |
skill: |
skill:python-fastapi |
References a skill |
context: |
context:python-standards |
References a context file |
Location: .opencode/agent/*.md
---
name: agent-name
description: "Agent description"
mode: primary
temperature: 0.1
model: "provider/model-id"
tools:
read: true
write: true
edit: true
bash: true
skill: true
permission:
edit: ask
bash:
"*": ask
"git status": allow
---
# Agent Name
Agent instructions and behavior...| Field | Description |
|---|---|
name |
Agent identifier |
description |
Brief description for UI |
mode |
primary or subagent |
| Field | Description | Default |
|---|---|---|
temperature |
Response randomness (0-1) | Model default |
model |
Override model | Global default |
tools |
Tool access control | All enabled |
permission |
Permission overrides | Global settings |
hidden |
Hide from @ autocomplete | false |
color |
UI color | Theme default |
top_p |
Response diversity | Model default |
Location: .opencode/subagents/*.md
---
name: subagent-name
description: "Subagent description"
mode: subagent
type: general
tools:
read: true
write: true
edit: true
bash: true
skill: true
glob: true
grep: true
---
# Subagent Name
Subagent instructions and behavior...| Type | Description | Tools |
|---|---|---|
general |
Full access | read, write, edit, bash, skill, glob, grep |
explore |
Read-only | read, glob, grep |
Location: .opencode/skills/<name>/SKILL.md
---
name: skill-name
description: "Skill description"
license: MIT
compatibility: opencode
metadata:
audience: developers
workflow: api
---
# Skill Name
Skill content with patterns, examples, best practices...| Field | Description | Constraints |
|---|---|---|
name |
Skill identifier | 1-64 chars, lowercase, hyphen-separated |
description |
Brief description | 1-1024 chars |
| Field | Description |
|---|---|
license |
License identifier |
compatibility |
Compatibility info |
metadata |
String-to-string map |
Valid skill names:
python-fundamentals✓python-fastapi✓Python_FastAPI✗ (must be lowercase)python--fastapi✗ (no consecutive hyphens)-python✗ (cannot start with hyphen)
Regex: ^[a-z0-9]+(-[a-z0-9]+)*$
-
Create directory:
mkdir -p .opencode/skills/my-skill
-
Create SKILL.md:
--- name: my-skill description: "My custom skill" --- # My Skill Content here...
-
Register in agent-metadata.json:
"skills": { "my-skill": { "id": "my-skill", "name": "My Skill", "version": "1.0.0", "triggers": ["keyword1", "keyword2"] } }
-
Create subagent file:
# .opencode/subagents/my-subagent.md -
Define subagent:
--- name: my-subagent description: "My custom subagent" mode: subagent type: general tools: read: true write: true --- # My Subagent Instructions here...
-
Register in agent-metadata.json:
"subagents": { "my-subagent": { "id": "my-subagent", "name": "My Subagent", "category": "custom", "type": "subagent", "version": "1.0.0", "dependencies": [] } }
Edit .opencode/agent/python-expert.md:
---
name: python-expert
description: "Modified description"
temperature: 0.2 # More deterministic
---In opencode.json:
{
"permission": {
"edit": "ask",
"bash": {
"*": "ask",
"git status": "allow",
"git diff": "allow"
}
}
}In agent frontmatter:
---
tools:
bash: false
---Configuration is applied in this order (later overrides earlier):
- OpenCode defaults
- Global
~/.config/opencode/opencode.json - Project
.opencode/opencode.json - Agent frontmatter
- Subagent frontmatter
- Overview - System introduction
- Architecture - Component relationships
- Agents - python-expert agent details
- Subagents - All subagent workflows
- Skills - Complete skill documentation
- Troubleshooting - Configuration issues