Conversation
…two-stage matching, confusability report (#2268) - Add `category` field to SKILL.md frontmatter spec with strict validation (1-32 chars, lowercase alnum+hyphens) - Categorize all 26 bundled skills across web/data/dev/system groups - Implement `CategoryMatcher` for two-stage matching: coarse category embedding first, then fine-grained within-category - Add `SkillMatcher::confusability_report()` — O(n²) pairwise cosine similarity with configurable threshold - Add `/skills confusability` slash command surfacing pairs above threshold - Group `/skills` output by category in BTreeMap alphabetical order - Wire `two_stage_matching` and `confusability_threshold` config fields in `SkillsConfig` - Fix three pre-existing clippy warnings in `bandit.rs` (binding shadowing, map_or, useless vec!) - Add 20 new tests: validate_category boundaries, CategoryMatcher behavior, ConfusabilityReport display, two-stage correctness
This was referenced Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
categoryfield to SKILL.md frontmatter (strict validation: 1-32 chars,[a-z0-9-], no leading/trailing/consecutive hyphens)web,data,dev,systemCategoryMatcherfor two-stage matching: Stage 1 selects top-2 categories by centroid similarity, Stage 2 does fine-grained matching within the candidate pool — mitigates phase-transition degradation as library growsSkillMatcher::confusability_report()— O(n²) pairwise cosine similarity offloaded to blocking thread, with configurable threshold/skills confusabilityslash command surfacing confusable pairs (disabled by default:confusability_threshold = 0.0)/skillsoutput by category in alphabetical order via BTreeMaptwo_stage_matchingandconfusability_thresholdconfig fields in[skills]TOML sectionbandit.rs(binding shadowing, map_or, useless vec!)validate_categoryvalidation boundaries,CategoryMatcherbuild/is_useful/candidate_positions,ConfusabilityReport::Displayexcluded skills branch, two-stage correctness and result count invariantMotivation
arXiv:2601.04748 shows skill selection accuracy degrades sharply past a critical library size due to semantic confusability — not library size alone. This PR adds the three mitigations described in issue #2268: category field (SHORT), two-stage matching (MEDIUM), and confusability monitoring (MONITORING).
Test plan
cargo nextest run --workspace --lib --bins— 6705/6705 passedcargo clippy --workspace --all-targets -- -D warnings— cleancargo +nightly fmt --check— clean/skillsshows grouped output with category headers/skills confusabilityworks whenconfusability_threshold > 0in config