Skip to content

Conversation

@malhashemi
Copy link
Contributor

@malhashemi malhashemi commented Dec 22, 2025

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.

- Add skill tool for loading skill content on-demand
- Support pattern-based skill permissions (allow/deny/ask)
- Enable agent-specific permission overrides
- Support nested skills with path-based IDs (e.g., prompter/skill-creator)
- Filter available_skills in system prompt by agent permissions
- Preserve skill tool responses during compaction pruning
@malhashemi
Copy link
Contributor Author

@thdxr done boss

@rekram1-node rekram1-node requested a review from thdxr December 22, 2025 06:06
@thdxr thdxr force-pushed the feature/skill-tool branch from 67ca7cf to b5a710c Compare December 22, 2025 23:22
@thdxr thdxr merged commit 046e351 into anomalyco:dev Dec 22, 2025
5 checks passed
malhashemi added a commit to malhashemi/opencode that referenced this pull request Dec 23, 2025
Pass agent context through tool initialization chain so the skill tool
can filter available_skills by agent permissions. Skills with 'deny'
permission are hidden from the tool description, preventing agents from
seeing skills they cannot access.

Changes:
- Add InitContext interface with optional agent to Tool namespace
- Update ToolRegistry.tools() to accept and pass agent to init()
- Filter skills in SkillTool.init() based on agent permissions
- Add duplicate skill name warning in Skill.all()

Follow-up to sst#5930 per maintainer feedback.
@jiyeol-lee
Copy link

omg, i've been waiting for this feature so long and @malhashemi you implemented exactly how i wished. thank you so much!!!

malhashemi added a commit to malhashemi/opencode-skills that referenced this pull request Dec 23, 2025
BREAKING CHANGE: This plugin is deprecated. Skills functionality is now built into OpenCode natively.

- Add graduation banner and migration guide
- Document directory change (.opencode/skills/ → skill/)
- Document config migration (tools → permission.skill)
- Add Thank You section acknowledging community support
- Promote opencode-sessions as the next plugin to try
- Move original README to collapsed Historical Documentation section

Native implementation PRs:
- sst/opencode#5930 (v1.0.190)
- sst/opencode#6000 (v1.0.191)
malhashemi added a commit to malhashemi/opencode-skills that referenced this pull request Dec 23, 2025
BREAKING CHANGE: This plugin is deprecated. Skills functionality is now built into OpenCode natively.

- Add graduation banner and migration guide
- Document directory change (.opencode/skills/ → skill/)
- Document config migration (tools → permission.skill)
- Add Thank You section acknowledging community support
- Promote opencode-sessions as the next plugin to try
- Move original README to collapsed Historical Documentation section

Native implementation PRs:
- sst/opencode#5930 (v1.0.190)
- sst/opencode#6000 (v1.0.191)
malhashemi added a commit to malhashemi/opencode-skills that referenced this pull request Dec 23, 2025
BREAKING CHANGE: This plugin is deprecated. Skills functionality is now built into OpenCode natively.

- Add graduation banner and migration guide
- Document directory change (.opencode/skills/ → skill/)
- Document config migration (tools → permission.skill)
- Add Thank You section acknowledging community support
- Promote opencode-sessions as the next plugin to try
- Move original README to collapsed Historical Documentation section

Native implementation PRs:
- sst/opencode#5930 (v1.0.190)
- sst/opencode#6000 (v1.0.191)
iljod pushed a commit to iljod/opencode that referenced this pull request Dec 23, 2025
@malhashemi malhashemi deleted the feature/skill-tool branch December 23, 2025 22:42
rekram1-node pushed a commit that referenced this pull request Dec 27, 2025
anntnzrb pushed a commit to anntnzrb/opencode-1 that referenced this pull request Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants