-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(skill): add per-agent filtering to skill tool description #6000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thdxr
merged 2 commits into
anomalyco:dev
from
malhashemi:feat/skill-per-agent-filtering
Dec 23, 2025
Merged
feat(skill): add per-agent filtering to skill tool description #6000
thdxr
merged 2 commits into
anomalyco:dev
from
malhashemi:feat/skill-per-agent-filtering
Dec 23, 2025
+212
−80
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 anomalyco#5930 per maintainer feedback.
- Update intro to mention on-demand loading via skill tool - Add 'Configure permissions' section with pattern examples - Add 'Override per agent' section for agent-specific permissions - Add 'Disable the skill tool' section - Update troubleshooting to include permission checks
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: - anomalyco/opencode#5930 (v1.0.190) - anomalyco/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: - anomalyco/opencode#5930 (v1.0.190) - anomalyco/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: - anomalyco/opencode#5930 (v1.0.190) - anomalyco/opencode#6000 (v1.0.191)
Closed
iljod
pushed a commit
to iljod/opencode
that referenced
this pull request
Dec 23, 2025
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements per-agent skill filtering in the
<available_skills>tool description, completing the feature originally proposed in #5930.After #5930 was merged, the maintainer simplified it by removing per-agent filtering from the tool description (permissions were only checked at execution time). This PR adds the infrastructure to pass agent context to tool initialization, enabling the skill tool to filter its description based on agent permissions.
Problem
Without this change, agents see ALL skills in
<available_skills>, including ones they can't use (permission =deny). This leads to:Solution
Pass agent context through the tool initialization chain so the skill tool can filter
<available_skills>by permissions.Changes
Infrastructure (
tool.ts,registry.ts,prompt.ts)InitContextinterface with optionalagentfield toToolnamespaceTool.Info.initsignature to accept(ctx?: InitContext)ToolRegistry.tools()to accept optional agent and pass it to each tool'sinit()SessionPrompt.resolveTools()toToolRegistry.tools()Skill Tool (
tool/skill.ts)Tool.Info<typeof parameters>typingaccessibleSkillsby agent permissions ininit(ctx)Wildcard.all(skill.name, permissions) !== "deny"appear in<available_skills>Skill Registry (
skill/skill.ts)Behavior
With config:
{ "permission": { "skill": { "documents-*": "deny", "experimental-*": "ask", "*": "allow" } } }<available_skills>?documents-*experimental-*Agent-specific overrides work as expected:
Testing
bun run typecheckpassesbun testpasses (320 pass, 1 skip)init(ctx)usage are unaffected