Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AMAP ML SkillClaw Skill Retrieval

From Leeroopedia
Knowledge Sources
Domains Information_Retrieval, Skill_Management
Last Updated 2026-10-22 00:00 GMT

Overview

A skill retrieval mechanism that selects relevant skills from a skill library using either effectiveness-ranked template matching or semantic embedding-based cosine similarity.

Description

Skill retrieval addresses the problem of finding the most relevant skills from a potentially large library to inject into an LLM's context. The template mode ranks skills purely by their historical effectiveness score (injection and PRM-derived metrics), offering zero-latency retrieval. The embedding mode uses SentenceTransformer to encode both skills and the task description, ranking by cosine similarity weighted by effectiveness, with deduplication to avoid similar skills. The result is a compact catalog of skills injected as an XML block into the system message.

Usage

Use this principle when designing systems that need:

  • Relevant skill/tool selection from a large library
  • Trade-off between latency (template) and semantic accuracy (embedding)
  • Effectiveness-based ranking that improves over time
  • Lazy-loading skill catalogs (list names, let the model read full content on demand)

Theoretical Basis

Template Mode: Pure effectiveness ranking, O(1) per skill:

score(skill)=effectiveness(skill)

Embedding Mode: Cosine similarity weighted by effectiveness:

score(skill)=α⋅cos(e→task,e→skill)+(1−α)⋅effectiveness(skill)

Where e→ is the embedding vector and effectiveness is a [0, 1] score derived from injection statistics and PRM scores.

# Abstract algorithm (NOT real implementation)
def retrieve_skills(task_description, skills, mode, top_k):
    if mode == "template":
        ranked = sorted(skills, key=lambda s: s.effectiveness, reverse=True)
    elif mode == "embedding":
        task_vec = embed(task_description)
        for skill in skills:
            skill_vec = embed(skill.description)
            skill.sim = cosine_similarity(task_vec, skill_vec)
        ranked = sorted(skills, key=lambda s: weighted_score(s.sim, s.effectiveness), reverse=True)
    return ranked[:top_k]

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment