feat: add native skill tool with permission system
Summary
- Add native
skilltool for on-demand skill loading with pattern-based access control - Support agent-specific permission overrides for fine-grained skill access
Features
Skill Tool
Skills are now loaded on-demand via the native skill tool. The agent sees available skills listed in <available_skills> and can load the full content when needed:
skill({ id: "pr-review" })
skill({ id: "prompter/skill-creator" }) // nested skills use path-based IDs
Skill Permissions
Control which skills agents can access using pattern-based permissions in opencode.json:
{
"permission": {
"skill": {
"pr-review": "allow",
"internal/*": "deny",
"experimental/*": "ask",
"*": "allow"
}
}
}
| Permission | Behavior |
|---|---|
allow |
Skill loads immediately |
deny |
Skill hidden from agent, access rejected |
ask |
User prompted for approval before loading |
Patterns support wildcards: category/* matches all skills in that category.
Agent-Specific Overrides
Override global permissions for specific agents. Useful for giving specialized agents access to restricted skills.
For custom agents (in agent frontmatter):
---
permission:
skill:
"document-skills/*": "allow" # override global deny
---
For built-in agents (in opencode.json):
{
"agent": {
"plan": {
"permission": {
"skill": {
"internal/*": "allow"
}
}
}
}
}
Disabling the Skill Tool
Completely disable the skill tool for agents that shouldn't use skills:
For custom agents:
---
tools:
skill: false
---
For built-in agents:
{
"agent": {
"plan": {
"tools": {
"skill": false
}
}
}
}
When disabled, the <available_skills> section is omitted from the system prompt entirely.
Nested Skills
Skills can be organized in subdirectories. The skill ID is derived from the path:
.opencode/skill/
├── pr-review/SKILL.md → id: "pr-review"
├── prompter/
│ ├── agent-creator/SKILL.md → id: "prompter/agent-creator"
│ └── skill-creator/SKILL.md → id: "prompter/skill-creator"
└── docs/
└── api-guide/SKILL.md → id: "docs/api-guide"
Note: Skill tool responses are whitelisted from session compaction pruning to ensure loaded skill content remains available throughout the conversation.