pub struct SkillRegistry { /* private fields */ }Expand description
Skill registry for managing available skills
Provides skill registration, loading from directories, and lookup by name. Optionally validates skills before registration and filters disabled skills from the system prompt based on feedback scores.
Implementations§
Source§impl SkillRegistry
impl SkillRegistry
Sourcepub fn with_builtins() -> Self
pub fn with_builtins() -> Self
Create a registry with built-in skills
Sourcepub fn set_validator(&self, validator: Arc<dyn SkillValidator>)
pub fn set_validator(&self, validator: Arc<dyn SkillValidator>)
Set the skill validator (safety gate)
Sourcepub fn set_scorer(&self, scorer: Arc<dyn SkillScorer>)
pub fn set_scorer(&self, scorer: Arc<dyn SkillScorer>)
Set the skill scorer (feedback loop)
Sourcepub fn scorer(&self) -> Option<Arc<dyn SkillScorer>>
pub fn scorer(&self) -> Option<Arc<dyn SkillScorer>>
Get the scorer (for external use, e.g., ManageSkillTool)
Sourcepub fn register(&self, skill: Arc<Skill>) -> Result<(), SkillValidationError>
pub fn register(&self, skill: Arc<Skill>) -> Result<(), SkillValidationError>
Register a skill with validation
If a validator is set, the skill must pass validation before registration. Returns an error if validation fails.
Sourcepub fn register_unchecked(&self, skill: Arc<Skill>)
pub fn register_unchecked(&self, skill: Arc<Skill>)
Register a skill without validation (for built-in skills)
Sourcepub fn load_from_dir(&self, dir: impl AsRef<Path>) -> Result<usize>
pub fn load_from_dir(&self, dir: impl AsRef<Path>) -> Result<usize>
Load skills from a directory
Scans the directory for .md files and attempts to parse them as skills.
Silently skips files that fail to parse.
Sourcepub fn load_from_file(&self, path: impl AsRef<Path>) -> Result<Arc<Skill>>
pub fn load_from_file(&self, path: impl AsRef<Path>) -> Result<Arc<Skill>>
Load a single skill from a file
Sourcepub fn personas(&self) -> Vec<Arc<Skill>>
pub fn personas(&self) -> Vec<Arc<Skill>>
Get all persona-kind skills
Personas are session-level system prompts bound at session creation.
They are NOT injected into the global system prompt via to_system_prompt().
Sourcepub fn to_system_prompt(&self) -> String
pub fn to_system_prompt(&self) -> String
Generate system prompt content from all instruction skills
Concatenates the content of all instruction-type skills for injection into the system prompt. Skills disabled by the scorer are excluded. Persona-kind skills are excluded — they are bound per-session, not globally. Generate the system prompt fragment for this registry.
Only emits a skill directory (name + description) — NOT the full skill content.
Full content is injected on-demand via match_skills when a user request matches.
Sourcepub fn match_skills(&self, user_input: &str) -> String
pub fn match_skills(&self, user_input: &str) -> String
Return the full content of skills relevant to the given user input.
Matches by checking if any skill name or tag appears in the input (case-insensitive). Returns an empty string if no skills match — caller should not inject anything.