feat: implement Agent Skills specification support

Implements the Agent Skills specification (https://agentskills.io) for
portable skill packages that give the agent new capabilities.

Changes:
- Add skills module with SKILL.md parser (YAML frontmatter + markdown body)
- Implement skill discovery from ~/.g3/skills/, config extra_paths, and .g3/skills/
- Generate <available_skills> XML for system prompt injection
- Add SkillsConfig to g3-config with enabled flag and extra_paths
- Wire skills discovery into CLI startup
- Add 29 unit tests for parser, discovery, and prompt generation
- Update README with Agent Skills documentation

Skill locations (priority order):
1. ~/.g3/skills/ (global)
2. Config extra_paths
3. .g3/skills/ (workspace, highest priority)

At startup, g3 scans skill directories and injects a summary into the
system prompt. When the agent needs a skill, it reads the full SKILL.md
using the read_file tool.
This commit is contained in:
Dhanji R. Prasanna
2026-02-04 12:58:57 +11:00
parent 95d9847354
commit a5f6475603
12 changed files with 1072 additions and 15 deletions

View File

@@ -13,6 +13,8 @@ pub struct Config {
pub computer_control: ComputerControlConfig,
#[serde(default)]
pub webdriver: WebDriverConfig,
#[serde(default)]
pub skills: SkillsConfig,
}
/// Provider configuration with named configs per provider type
@@ -193,6 +195,26 @@ pub struct WebDriverConfig {
pub browser: WebDriverBrowser,
}
/// Skills configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SkillsConfig {
/// Whether skills are enabled (default: true)
#[serde(default = "default_true")]
pub enabled: bool,
/// Additional paths to search for skills (beyond ~/.g3/skills and .g3/skills)
#[serde(default)]
pub extra_paths: Vec<String>,
}
impl Default for SkillsConfig {
fn default() -> Self {
Self {
enabled: true,
extra_paths: Vec::new(),
}
}
}
impl Default for AgentConfig {
fn default() -> Self {
Self {
@@ -257,6 +279,7 @@ impl Default for Config {
},
computer_control: ComputerControlConfig::default(),
webdriver: WebDriverConfig::default(),
skills: SkillsConfig::default(),
}
}
}