2 Commits
Author SHA1 Message Date
hermes 33539f64ae Merge pull request 'skills: drop ~/.agent/skills, add project .agents/skills' (#75) from agents-skills into main
ci / check (push) Canceled after 0s
2026-10-01 06:37:09 +00:00
hermes 1a41e71adc skills: drop ~/.agent/skills; add project .agents/skills
ci / check (pull_request) Canceled after 0s
ci / check (push) Canceled after 0s
2026-10-01 06:37:07 +00:00
3 changed files with 17 additions and 9 deletions

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ tests = "turn_end" # affected tests: turn_end | agent_end | off
Skills are `<dir>/<name>/SKILL.md` files with `name:` / `description:` frontmatter. Only the name and
description go into the system prompt; the model reads the file when a task matches. Looked up in
`~/.agent/skills` and `~/.agents/skills` (shared with other agents), `~/.hx/skills`, then `.hx/skills` in
`~/.agents/skills` (shared with other agents), `~/.hx/skills`, then `.agents/skills` and `.hx/skills` in
the project; a later directory wins when names collide. `/skills` lists what loaded and the searched dirs.
Each skill is also a command: `/<name> [args]` sends the skill file plus `args` as the prompt. Builtin
+13 -8
View File
@@ -42,16 +42,18 @@ pub struct Skill {
pub path: PathBuf,
}
/// Skill dirs, lowest priority first: `~/.agent/skills` and `~/.agents/skills` (shared with other
/// agents), `<hx home>/skills`, `<project>/.hx/skills`.
/// Skill dirs, lowest priority first: `~/.agents/skills` (shared with other agents), `<hx home>/skills`,
/// `<project>/.agents/skills`, `<project>/.hx/skills`.
pub fn skill_dirs(home: &Path, cwd: &Path) -> Vec<PathBuf> {
let mut v: Vec<PathBuf> = std::env::var_os("HOME")
.map(PathBuf::from)
.map(|h| PathBuf::from(h).join(".agents/skills"))
.into_iter()
.flat_map(|h| [h.join(".agent/skills"), h.join(".agents/skills")])
.collect();
v.push(home.join("skills"));
v.push(cwd.join(".hx/skills"));
v.extend([
home.join("skills"),
cwd.join(".agents/skills"),
cwd.join(".hx/skills"),
]);
v
}
@@ -190,7 +192,10 @@ mod tests {
.collect();
assert_eq!(got, [("a", "shared"), ("g", "hx-g")]);
let d = skill_dirs(Path::new("/h"), Path::new("/p"));
assert!(d[0].ends_with(".agent/skills") && d[1].ends_with(".agents/skills"));
assert!(d[2] == Path::new("/h/skills") && d[3] == Path::new("/p/.hx/skills"));
assert!(d[0].ends_with(".agents/skills"));
assert_eq!(
d[1..],
["/h/skills", "/p/.agents/skills", "/p/.hx/skills"].map(PathBuf::from)
);
}
}
+3
View File
@@ -9,6 +9,8 @@ os.makedirs(f"{tmp}/home/.hx"); os.makedirs(f"{tmp}/repo")
open(f"{tmp}/home/.hx/auth.json", "w").write(json.dumps({"claude": {"access": "fake-token", "refresh": "r", "expires": 99999999999999}}))
open(f"{tmp}/repo/notes.md", "w").write("NOTES\n")
os.makedirs(f"{tmp}/home/.agents/skills/deploy")
os.makedirs(f"{tmp}/repo/.agents/skills/lint")
open(f"{tmp}/repo/.agents/skills/lint/SKILL.md", "w").write("---\nname: lint\ndescription: project lint\n---\nBODY\n")
open(f"{tmp}/home/.agents/skills/deploy/SKILL.md", "w").write("---\nname: deploy\ndescription: ship it\n---\nBODY\n")
time.sleep(0.5)
@@ -49,6 +51,7 @@ pump(1.5)
check("startup footer", "Claude")
send(b"/skills\r")
check("skills from ~/.agents", "/deploy — ship it")
check("project .agents skills", "/lint — project lint")
send(b"@not"); send(b"\t")
check("tab completion", "es.md")
send(b"\x15") # ctrl-u