Skills: skill tool, YAML frontmatter, disable-model-invocation, argument-hint #143

Merged
hermes merged 1 commits from feat/skill-tool into main 2026-10-09 14:50:45 +00:00
Collaborator

Skills now work like Claude Code skills.

  • New skill tool (hx-tools/src/skill.rs, takes {name}): returns Base directory for this skill: <dir> plus the body without frontmatter. Lookup is by name, so no path traversal. Read-only, no permit prompt. Registered in hx_tools::registry(), so subagents (added to EXPLORE_TOOLS for explore) and codemode get it.
  • System prompt index says "Call the skill tool with the name when the task matches"; the per-root Skill file: headers and per-skill paths are gone.
  • Frontmatter parsed with serde_norway (serde_yaml is deprecated). description: > / | become one line. Unknown keys (license, output) ignored. Invalid YAML: skill skipped, warning shown in /skills.
  • disable-model-invocation: true (load: manual kept as alias): left out of the prompt index, skill tool answers "skill X is user-invoked only", /name still works.
  • /name [args] sends base dir line + body without frontmatter, then args (was: raw file incl. frontmatter).
  • argument-hint shown in / completion and /help as /name <hint>.
  • INDEX_DESC_CHARS removed (full descriptions). New roots ~/.claude/skills (lowest) and <cwd>/.claude/skills (between .agents and .hx).

Token cost (hx prefix, 2 test skills, one with a 150-char description):

  • main: 1310 tok total, skill a = 27 tok
  • this PR: 1359 tok total (+49): tool: skill = +53 tok, skill a = 36 tok (full description instead of 100-char cut), index header/paths slightly smaller.
    So the tool schema is the fixed cost; descriptions grow with real length. If long descriptions hurt, re-add a cap.

Tests: unit tests for folded/literal YAML, unknown keys, broken YAML skipped, flagged skill absent from the prompt, tool refuses it and returns base dir without frontmatter, /name prompt, subagent registry (m8 e2e now expects skill) and codemode signature. tests/all.sh green (fmt, clippy -D warnings, unit, e2e). Not tried: real model calling the tool.

Skills now work like Claude Code skills. - New `skill` tool (`hx-tools/src/skill.rs`, takes `{name}`): returns `Base directory for this skill: <dir>` plus the body without frontmatter. Lookup is by name, so no path traversal. Read-only, no permit prompt. Registered in `hx_tools::registry()`, so subagents (added to `EXPLORE_TOOLS` for explore) and codemode get it. - System prompt index says "Call the `skill` tool with the name when the task matches"; the per-root `Skill file:` headers and per-skill paths are gone. - Frontmatter parsed with `serde_norway` (serde_yaml is deprecated). `description: >` / `|` become one line. Unknown keys (`license`, `output`) ignored. Invalid YAML: skill skipped, warning shown in `/skills`. - `disable-model-invocation: true` (`load: manual` kept as alias): left out of the prompt index, `skill` tool answers "skill X is user-invoked only", `/name` still works. - `/name [args]` sends base dir line + body without frontmatter, then args (was: raw file incl. frontmatter). - `argument-hint` shown in `/` completion and `/help` as `/name <hint>`. - `INDEX_DESC_CHARS` removed (full descriptions). New roots `~/.claude/skills` (lowest) and `<cwd>/.claude/skills` (between `.agents` and `.hx`). Token cost (`hx prefix`, 2 test skills, one with a 150-char description): - main: 1310 tok total, skill a = 27 tok - this PR: 1359 tok total (+49): `tool: skill` = +53 tok, skill a = 36 tok (full description instead of 100-char cut), index header/paths slightly smaller. So the tool schema is the fixed cost; descriptions grow with real length. If long descriptions hurt, re-add a cap. Tests: unit tests for folded/literal YAML, unknown keys, broken YAML skipped, flagged skill absent from the prompt, tool refuses it and returns base dir without frontmatter, `/name` prompt, subagent registry (m8 e2e now expects `skill`) and codemode signature. `tests/all.sh` green (fmt, clippy -D warnings, unit, e2e). Not tried: real model calling the tool.
hermes added 1 commit 2026-10-09 14:50:12 +00:00
hermes merged commit 69d5ae4581 into main 2026-10-09 14:50:45 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/hx#143