opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Bring back frontmatter-based skill filtering

Open IgorWarzocha opened this issue 1 week ago • 4 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

We used to be able to filter skills in agents' frontmatters via yaml as per below. This was nice, it allowed creating customised agents. As far as I understand, this functionality is now gone.

Filtering from agents files is perfect, it allows for better maintainability. Editing a skill markdown every time an agent is created is... painful. Since skills are a standard that has no frontmatter permission fields, it would be weird to add anything custom to it.

mode: primary
permission:
  skill:
    '*': deny
    plugin-installer: allow
    opencode-config: allow
    command-creator: allow
    skill-creator: allow
    agent-architect: allow
    mcp-installer: allow
    model-researcher: allow
---

ps. pff wrong label, sorry

IgorWarzocha avatar Jan 04 '26 19:01 IgorWarzocha

Hi @IgorWarzocha ,

Can you confirm it is no longer working for you?

With the new permission system this should already be supported, if anything we are getting vastly superior control on all tools, from my understanding the task tool, edit tool, read, etc. all supports this level of control that skills already have. Otherwise, this should be flagged as a bug.

malhashemi avatar Jan 04 '26 22:01 malhashemi

Hi @malhashemi aka mr Skills himself :)

This is on an empty directory - same config, different versions. 1.1.1 just goes ahead to list the global config. 1.0.223 identifies the skills correctly. It's precisely the same with any other agents formatted this way.

(I've tried multiple things, none of them seem to work)

Image

While this is "just an AI" scan of commits, and I am 100% certain there are more cascading changes, this commit seems to have changed this specifically. Verified on two lengthy runs and I've checked out this specific commit as branch to... preserve functionality just in case I wanna fork it.

The upstream change you are looking for is in commit 351ddeed914d237138fc6f3f8b3d65d2e559357a (titled "Permission rework (#6319)"), specifically in packages/opencode/src/tool/skill.ts. Here is the precise pinpoint of the change:

// packages/opencode/src/tool/skill.ts
// ... (imports)
export const SkillTool = Tool.define("skill", async () => {
  const skills = await Skill.all()
  // Filter skills by agent permissions if agent provided
  /* 
    // THIS BLOCK WAS COMMENTED OUT IN THE COMMIT
    let accessibleSkills = skills
    if (ctx?.agent) {
      const permissions = ctx.agent.permission.skill
      accessibleSkills = skills.filter((skill) => {
        const action = Wildcard.all(skill.name, permissions)
        return action !== "deny"
      })
    }
  */
  // ... (rest of the file)

Before this commit: The code explicitly filtered accessibleSkills using Wildcard.all(skill.name, permissions). This function correctly handled specificity, allowing you to deny: * and then allow: specific-skill. After this commit: The filtering logic was commented out entirely. The tool now loads all skills into the description regardless of permissions, and relies on a runtime ctx.ask check which (in the new system) treats deny: * as a blanket ban without the same specificity overrides for the listing phase. You are currently on branch feature/classic-skills-restored which has the code state before this change (parent commit f77e1d973), so the skills should be working correctly for you here.

IgorWarzocha avatar Jan 04 '26 23:01 IgorWarzocha

@IgorWarzocha apologies for the delay, I had such a strong flu I can barely open one eye, I will submit a PR to rectify this, please note the permission system is working fine the only issue is that the skill tool description filtration is broken now. Appreciate if you can fix the title and description and mark it as a bug please

So your agent would see all the skills (wasting context and tokens for no reason) but the deny behavior is still working, I am working on a PR to bring back the filtration functionality respecting the new system. @rekram1-node counting on you for a quick review/merge 🙏

malhashemi avatar Jan 06 '26 04:01 malhashemi

Sounds good

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