Repository navigation
Improve slash-menu skill matching: support substring/subsequence match, not only startsWith
#4490
Replies: 1 comment
|
Update: I packaged this as an installable plugin so it can be used today without waiting for a source change, while still hoping for the upstream fix described above. Installable plugin (GitHub Packages):
Source & usage: https://github.com/amazing-fish/dsh-plugins/tree/main/plugins/skill-fuzzy-match It is intentionally a monkey-patch over internal APIs ( |
Uh oh!
There was an error while loading. Please reload this page.
Problem
In the
/slash menu, the skill source matches candidate skills with strict prefix matching —skill.name.startsWith(query):So typing
/xxonly surfaces skills whose name starts withxx. Skills whose name merely containsxx(e.g.aa-xx-bb) are not surfaced. Two concrete downsides:coding-web-search,dataworks-sql-runner,openviking-memory,python-code-review-optimize). Users frequently remember only a middle token (web,sql,memory,review) and type/webexpecting to seecoding-web-search— but it won't appear because the name doesn't start withweb./command source (dsh-client-ui-commands) already uses an ordered-subsequence fuzzy matcher (fuzzyScore+boundaryBonus, with-/_boundary weighting and prefix-first ranking). So/xxcan fuzzy-match a commandaa-xx-bb, but cannot fuzzy-match a skillaa-xx-bb. Same menu, two different matching behaviors.There's also a minor附带 issue: the skill source's
startsWithis case-sensitive, so/Webwon't matchcoding-web-searcheither, while the command source is case-insensitive (toLowerCase()).Proposal
Bring the skill source's matching in line with the command source: use the same fuzzy subsequence matcher (
fuzzyScore/boundaryBonusfromdsh-client-ui-commands) for skills, so that:queryas an ordered subsequence, rank by score, with prefix matches first and-/_boundary matches boosted (exactly how commands already rank);toLowerCase()on both sides), fixing the/Webmiss too.Rough sketch:
fuzzyScore/boundaryBonuscurrently live insidedsh-client-ui-commandsand aren't exported. Landing this cleanly would either extract them into a shared client util, or duplicate the small (~30-line) implementation in the skill package.Alternatives considered
includesinstead of subsequence: simpler, but loses the boundary weighting that makessqlrankdataworks-sql-runnerabove a hypotheticalsequel-misc— the fuzzy matcher's-/_boundary bonus is what makes kebab-case skill names feel good./menu. Prefer unifying.Context
@deepseek-ai/dsh(current install). The matching code is inpackages/client/ui-skill(dsh-client-ui-skill), and the reusable fuzzy matcher is inpackages/client/ui-commands(dsh-client-ui-commands).candidateswith the fuzzy matcher — it works as expected (/sql,/memory,/webnow surface the middle-of-name skills). Happy to share that prototype if useful.Thanks!
All reactions