[PR #5930] feat: add native skill tool with permission system #11651

Closed
opened 2026-02-16 18:16:33 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5930

State: closed
Merged: Yes


Summary

  • Add native skill tool 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({ name: "pr-review" })

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 Access rejected at execution time
ask User prompted for approval before loading

Patterns support wildcards: category-* matches all skills with that prefix.

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:
    "documents-*": "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.


Note: Skill tool responses are whitelisted from session compaction pruning to ensure loaded skill content remains available throughout the conversation.


Edited: Post-Merge Changes by Maintainer

The maintainer simplified the original implementation before merging:

  1. Removed per-agent filtering from <available_skills>: The original PR filtered skills in the tool description based on agent permissions. This was removed—all skills now appear in <available_skills> regardless of permissions.

  2. Permission checks remain at execution time only: Skills with deny permission are rejected when the agent tries to load them, but they still appear in the skill list.

  3. Skill IDs changed to names: Skills are now identified by their name field from frontmatter, not path-based IDs. Skill names must be unique.

Follow-up PR #6000 implements the per-agent filtering in the tool description by passing agent context to tool initialization.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5930 **State:** closed **Merged:** Yes --- ## Summary - Add native `skill` tool 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({ name: "pr-review" }) ``` ### Skill Permissions Control which skills agents can access using pattern-based permissions in `opencode.json`: ```json { "permission": { "skill": { "pr-review": "allow", "internal-*": "deny", "experimental-*": "ask", "*": "allow" } } } ``` | Permission | Behavior | |------------|----------| | `allow` | Skill loads immediately | | `deny` | Access rejected at execution time | | `ask` | User prompted for approval before loading | Patterns support wildcards: `category-*` matches all skills with that prefix. ### Agent-Specific Overrides Override global permissions for specific agents. Useful for giving specialized agents access to restricted skills. **For custom agents** (in agent frontmatter): ```yaml --- permission: skill: "documents-*": "allow" # override global deny --- ``` **For built-in agents** (in `opencode.json`): ```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**: ```yaml --- tools: skill: false --- ``` **For built-in agents**: ```json { "agent": { "plan": { "tools": { "skill": false } } } } ``` When disabled, the `<available_skills>` section is omitted from the system prompt entirely. --- **Note:** Skill tool responses are whitelisted from session compaction pruning to ensure loaded skill content remains available throughout the conversation. --- ## Edited: Post-Merge Changes by Maintainer The maintainer simplified the original implementation before merging: 1. **Removed per-agent filtering from `<available_skills>`**: The original PR filtered skills in the tool description based on agent permissions. This was removed—all skills now appear in `<available_skills>` regardless of permissions. 2. **Permission checks remain at execution time only**: Skills with `deny` permission are rejected when the agent tries to load them, but they still appear in the skill list. 3. **Skill IDs changed to names**: Skills are now identified by their `name` field from frontmatter, not path-based IDs. Skill names must be unique. **Follow-up PR #6000** implements the per-agent filtering in the tool description by passing agent context to tool initialization.
yindo added the pull-request label 2026-02-16 18:16:33 -05:00
yindo closed this issue 2026-02-16 18:16:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11651