talos_skill/types.rs
1use serde::Deserialize;
2use std::path::PathBuf;
3
4/// YAML frontmatter extracted from a SKILL.md file.
5///
6/// All fields are required. The frontmatter must appear between `---` delimiters
7/// at the start of the file.
8#[derive(Debug, Clone, Deserialize)]
9pub struct SkillFrontmatter {
10 /// Unique name identifier for the skill.
11 pub name: String,
12 /// Human-readable description of what the skill does.
13 pub description: String,
14 /// Keywords or patterns that activate this skill.
15 pub triggers: Vec<String>,
16}
17
18/// A fully parsed skill with frontmatter metadata and Markdown body.
19#[derive(Debug, Clone)]
20pub struct Skill {
21 /// Unique name identifier for the skill.
22 pub name: String,
23 /// Human-readable description of what the skill does.
24 pub description: String,
25 /// Keywords or patterns that activate this skill.
26 pub triggers: Vec<String>,
27 /// Markdown instructions (body content after frontmatter).
28 pub body: String,
29 /// Absolute path to the source SKILL.md file.
30 pub source_path: PathBuf,
31}
32
33/// Lightweight skill index entry for Level 0 progressive disclosure.
34///
35/// Contains only the metadata needed to inject into a system prompt,
36/// without loading the full Markdown body.
37#[derive(Debug, Clone)]
38pub struct SkillIndex {
39 /// Unique name identifier for the skill.
40 pub name: String,
41 /// Human-readable description of what the skill does.
42 pub description: String,
43 /// Keywords or patterns that activate this skill.
44 pub triggers: Vec<String>,
45 /// Estimated token count for this skill's Level 0 entry (name + description).
46 pub estimated_tokens: usize,
47}
48
49/// Disclosure level for progressive skill loading.
50///
51/// Skills are loaded in three levels to minimize system prompt size:
52/// - **Level 0**: Name + description only — always present in the system prompt
53/// so the agent knows which skills are available (~50 tokens each).
54/// - **Level 1**: Full SKILL.md body — loaded on demand when the agent's task
55/// matches a skill's triggers.
56/// - **Level 2**: Specific reference files — loaded when the skill body
57/// references external files (e.g., templates, schemas, scripts).
58#[derive(Debug, Clone, Copy, PartialEq, Eq)]
59pub enum SkillDisclosure {
60 /// Name + description only (always loaded).
61 Level0,
62 /// Full SKILL.md body (loaded on demand when task matches triggers).
63 Level1,
64 /// Specific reference files (loaded when skill body references them).
65 Level2,
66}