opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: restore skill filtering by agent permissions

Open malhashemi opened this issue 2 weeks ago • 2 comments

Summary

Restores the ability to filter skills based on agent permission rules, which was broken after the permission system overhaul in PR #6319.

  • Pass agent to ToolRegistry.tools() when building the tool registry
  • Filter skills using PermissionNext.evaluate() before generating the skill tool description
  • Only show skills that are not explicitly denied by the agent's permission rules

Example Usage

Agents can now control which skills are visible via frontmatter:

permission:
  read: allow
  skill:
    "*": deny
    "code-review": allow
    "skill-creator": allow

This will only show code-review and skill-creator in that agent's available skills.

Changes

  • packages/opencode/src/session/prompt.ts: Pass agent to ToolRegistry.tools()
  • packages/opencode/src/tool/skill.ts: Filter skills using PermissionNext.evaluate()

Closes #6857

malhashemi avatar Jan 06 '26 05:01 malhashemi

The following comment was made by an LLM, it may be inaccurate:

Results

I found one potentially related PR:

Related PR:

  • PR #5987: feat(agent): add per-agent skills filtering
    • Relationship: This is a previous implementation of per-agent skills filtering functionality. PR #7042 appears to be restoring/fixing this feature after it was broken by the permission system overhaul in PR #6319. This is not a duplicate, but rather a fix to a related feature.

Conclusion:

No actual duplicates found. The current PR (#7042) is a fix for broken functionality rather than a duplicate effort. The only related PR is the earlier implementation (#5987) which this PR builds upon.

github-actions[bot] avatar Jan 06 '26 05:01 github-actions[bot]

@rekram1-node for your review 🙏

malhashemi avatar Jan 06 '26 05:01 malhashemi

/review

rekram1-node avatar Jan 06 '26 17:01 rekram1-node

lgtm

github-actions[bot] avatar Jan 06 '26 18:01 github-actions[bot]