插件技能重复注册:递归扫描安装目录导致多平台插件(如 gbrain)技能翻倍
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
环境
ZCode 桌面版(Windows 11),插件:gbrain(marketplace: github.com/garrytan/gbrain,版本 0.47.9.0)
问题
安装 gbrain 插件后,技能列表里每个 gbrain 技能都出现两次(约 60 个技能翻倍)。
根因(已在本机定位)
gbrain 这类多平台插件仓库里有两套技能树:
- 顶层
skills/—— 供插件清单openclaw.plugin.json引用(清单里 63 个条目全部指向skills/...,从未引用plugin/skills) plugin/—— 由scripts/generate-plugin-tree.ts生成的另一套技能树,README 注明是给 gbrain 的 Codex / Claude Code 插件用的
ZCode 的插件技能发现逻辑没有按清单声明的路径加载,而是对整个插件安装目录做递归 SKILL.md 扫描(排除项只有 node_modules/dist/build/out/target/vendor/coverage/.cache/.next/.turbo/.venv/pycache,深度上限 8 层),于是 plugin/skills/<name>/SKILL.md(深度 3)也被注册,同一技能出现两条。
建议
二选一即可修复:
- 插件技能发现优先遵循插件清单声明的技能路径,仅作兜底扫描;
- 或在递归扫描的排除目录里加上
plugin(以及类似的多平台产物目录)。
本地临时解法
删除缓存里的 plugin/skills 后重启即恢复正常(已验证),但插件升级后该目录会随新版本回来。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ZCode’s recursive SKILL.md discovery logic and compare it with the declared paths in openclaw.plugin.json; scripts/generate-plugin-tree.ts explains why gbrain contains a second tree. Verify the fix with the gbrain 0.47.9.0 installation on Windows 11, confirming each skill appears once without deleting plugin/skills.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100