Skip to content

[Feature]: Improve router skill retrieval with metadata-aware and multilingual ranking #428

Description

@GTC2333

Problem or motivation

After YAML parsing is corrected, router discovery will still rely on case-insensitive substring counts over the frontmatter description alone.

This creates several quality problems:

  • The skill name, category, domain, aliases, and body are not searchable.
  • Repeated terms in a long description receive a higher score than a concise but more relevant skill.
  • Phrases and morphological variants are brittle.
  • Chinese or other non-English task wording will not match English-only descriptions.
  • The result does not explain why a skill matched.
  • Duplicate skill names are collapsed and direct lookup returns the first category match, which is ambiguous if duplicates diverge in the future.

Expert personas treat router search as the mandatory preflight for methodology-heavy work, so retrieval quality directly limits downstream agent performance.

Proposed solution

Introduce a small explicit router index with fields such as:

  • stable skill ID or category-qualified name
  • name
  • description
  • domain and category
  • aliases, including common abbreviations and multilingual terms
  • when-to-use and when-not-to-use cues
  • version and source path

Use token-aware lexical ranking such as BM25 as the baseline. A later semantic reranker can be added behind the same interface if evaluation shows a benefit.

Return only matched candidates and include a compact match explanation, for example:

{
  "skill_id": "17_Literature_Databases/pubmed-database",
  "score": 8.4,
  "matched_fields": ["name", "aliases", "description"],
  "matched_terms": ["pubmed", "literature search"]
}

For multilingual input, either index curated aliases or normalize the query into English domain keywords before retrieval. Curated aliases are preferable for critical scientific terms because they are deterministic.

Acceptance criteria

  • Ranking searches name, description, category/domain, and aliases.
  • Description length and repeated words do not dominate relevance.
  • No-match behavior is explicit and contains no unrelated fallback candidates.
  • Category-qualified lookup is supported.
  • A small golden query set covers English and Chinese neuroscience requests.
  • Tests report Recall@K and MRR for expected skills.
  • Existing skill_search callers remain compatible or receive a documented migration path.

Area

Skills library / Agents and orchestration

Alternatives considered

Embedding-only search was considered, but lexical retrieval with curated aliases is easier to debug, cheaper, and likely sufficient for the current catalog size. A hybrid reranker can be added after a measurable baseline exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions