Skip to content

fix(skill): replace broken skill-tools filtering with glob prefix matching - #2166

Merged
MiMoHardFather merged 2 commits into
mainfrom
fix/skill-tools-filter-with-globs
Aug 19, 2026
Merged

fix(skill): replace broken skill-tools filtering with glob prefix matching#2166
MiMoHardFather merged 2 commits into
mainfrom
fix/skill-tools-filter-with-globs

Conversation

@MiMoHardFather

Copy link
Copy Markdown
Collaborator

Problem

Skill tools filtering was using naive substring matching (lower.includes(fragment)), causing broad matches:

  • feishu matched all 70+ feishu tools (doc, bitable, board, calendar, sheet, task, drive, wiki, media, comment)
  • fetch matched github_get_file_contents
  • browser matched browser_close, browser_console_messages, browser_hover, etc.

Solution

Replaced with glob prefix matching:

  • * wildcard matches any sequence
  • Prefix patterns (ending with _) match tool name prefixes
  • Exact names are matched exactly
  • Extracted logic to reusable tool-visibility.ts utility

Changes

  • packages/opencode/src/cli/cmd/tui/util/tool-visibility.ts - new utility with matchesToolVisibility() and isToolVisibleForSkills()
  • packages/opencode/src/cli/cmd/tui/routes/session/index.tsx - updated to use new utility
  • packages/opencode/src/skill/index.ts - updated Subagent() and Install() to use new filtering
  • packages/opencode/test/tool/skill-search.test.ts - updated tests to use realistic tool names
  • packages/opencode/test/tool/skill.test.ts - updated tests and fixed handler scope issues
  • packages/opencode/test/cli/tui/tool-visibility.test.ts - new comprehensive tests

Test Results

103 pass, 0 fail, 276 expect() calls
Run 8ms | Tests 9ms | Collect 154ms | Transform 445ms | Load 250ms

- Replace dual edit/sed patches with apply_patch only in tool-script GPT reference
- Add comprehensive PROMPT.md sections 6-10 for apply_patch workflow, git diffs,
  common failures, format examples, and structured verification flow
- Enforce GPT: test via bash; Claude/Exec: use verify skill
- Add test coverage for registry GPT script and structured verification prompt
- Update all test expectations for unified tool-script reference
- Clean up whitespace and tighten wording in bash tools and prompts
@MiMoHardFather
MiMoHardFather merged commit 6ee774b into main Aug 19, 2026
6 checks passed
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.

1 participant