MoonshotAI / MoonshotAI/kimi-code
fix(skill): plugin bundle payload files are registered as standalone skills in v2 discovery
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What
FileSkillDiscovery registers every loose .md it finds at a top-level root besides SKILL.md. When the root dir IS a bundle (it has its own SKILL.md), the bundle's payload files get registered as standalone skills too — the same over-registration the legacy v1 scanner had (#2127, closed after the v1 package was removed in #3542).
Reproduction on current main
Root laid out like a mattpocock-style bundle:
teach/SKILL.md (name: teach)
teach/GLOSSARY-FORMAT.md (payload, not a skill)
new FileSkillDiscovery().discover([{ path: "…/teach", source: "extra", plugin: { id: "mattpocock-skills" } }]) returns:
discovered: [ 'GLOSSARY-FORMAT', 'teach' ]
Expected: [ 'teach' ] — payload files alongside a bundle's SKILL.md belong to the bundle, they are not standalone skills.
The relevant loop is in packages/agent-core-v2/src/features/skill/catalog/fileSkillDiscovery.ts at the isTopLevel branch: it registers the root SKILL.md and then still iterates the dir's remaining .md entries as flat skills. Loose top-level .md in a root WITHOUT a SKILL.md is an intentional shape (pinned by the existing "discovers a flat .md skill at the root top level" test), so the narrow fix is to skip that flat loop only when the root dir has its own SKILL.md.
I have the reproduction as a failing test and a patch ready; PR coming.
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
Read packages/agent-core-v2/src/features/skill/catalog/fileSkillDiscovery.ts, focusing on the isTopLevel branch and its flat-skill test. Run the failing reproduction, then verify that a bundle root returns only its SKILL.md while a root without SKILL.md still discovers loose .md skills. Note that a patch is already ready and a pull request is planned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100