Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

fix(runner): a skill keeps its name, and the doc says where a skill's files live

richard-epsillaab9269864bb6
diff --git a/runner/server.py b/runner/server.py
index 563b4144..a0caf467 100644
--- a/runner/server.py
+++ b/runner/server.py
@@ -502,6 +502,19 @@ def _write_input_files(cwd: str, files: list[dict] | None) -> list[str]:
_MCP_NAME_RE = __import__("re").compile(r"[^a-zA-Z0-9_]+")
+_SKILL_NAME_RE = re.compile(r"[^A-Za-z0-9_-]+")
+
+
+def _skill_dir_name(s: str) -> str:
+ """A skill's directory name: what the author called it, minus anything that could leave the
+ directory. Hyphens are KEPT — kebab-case is the skill format's own convention, every SKILL.md
+ frontmatter uses it, and the CLIs match a skill by that name. Renaming `test-skill` to
+ `test_skill` (the MCP sanitizer, built for a different job) made the directory disagree with
+ the frontmatter inside it and with what the user asked for by name."""
+ n = _SKILL_NAME_RE.sub("-", (s or "").strip()).strip("-_")
+ return n or "skill"
+
+
def _mcp_name(s: str) -> str:
"""Sanitize an MCP server name into a CLI-safe identifier (alnum + underscore)."""
n = _MCP_NAME_RE.sub("_", (s or "").strip()).strip("_")
@@ -619,7 +632,7 @@ def _write_skills(cwd: str, skills: list[dict], backend: str = "claude") -> list
entryroot = ".harness/skills"
installed: list[dict] = []
for sk in skills or []:
- name = _mcp_name((sk or {}).get("name") or (sk or {}).get("id") or "")
+ name = _skill_dir_name((sk or {}).get("name") or (sk or {}).get("id") or "")
if not name:
continue
files = (sk or {}).get("files")
@@ -753,7 +766,10 @@ def _write_agent_doc(cwd: str, backend: str, agent_doc: str | None, skills_meta:
if skills_meta:
lines += ["## Available skills", "",
"These skills are installed in this workspace. When a task matches one, read its "
- "SKILL.md first and follow its instructions and bundled scripts.", ""]
+ "SKILL.md first and follow its instructions and bundled scripts. A skill's own "
+ "files sit BESIDE its SKILL.md, so a bare filename in a skill (`test.py`, "
+ "`scripts/run.sh`) means that skill's directory, not this workspace's root: run "
+ "it by its full path, or change into that directory first.", ""]
for s in skills_meta:
d = f" — {s['desc']}" if s.get("desc") else ""
lines.append(f"- **{s['name']}**{d} (`{s['entry']}`)")
diff --git a/runner/tests/test_session_uids.py b/runner/tests/test_session_uids.py
index 8ec8fbda..07515afa 100644
--- a/runner/tests/test_session_uids.py
+++ b/runner/tests/test_session_uids.py
@@ -70,7 +70,8 @@ def test_own_tree_only_reowns_the_listed_owners_and_never_hard_links(tmp_path, m
assert "planted" not in names and "link2" not in names
assert all(u == 31337 and g == 31337 for _, u, g in calls)
calls.clear()
- server._own_tree(str(root), 31337, {0}) # nothing here is root's: nothing moves
+ # a uid nothing here belongs to: nothing moves. (Not root — the suite may itself run as root.)
+ server._own_tree(str(root), 31337, {424242})
assert calls == []
@@ -128,3 +129,30 @@ def test_hermes_without_vision_auth_keeps_its_default(tmp_path):
model="claude-sonnet-5", vision_auth=None)
cfg = yaml.safe_load((tmp_path / ".hermes" / "config.yaml").read_text())
assert "auxiliary" not in cfg
+
+
+def test_a_skill_keeps_the_name_its_author_gave_it(tmp_path):
+ """Kebab-case is the skill format's convention and the frontmatter's own name. The directory
+ must agree with it; only path separators and traversal are removed."""
+ assert server._skill_dir_name("test-skill") == "test-skill"
+ assert server._skill_dir_name("Deck Style") == "Deck-Style"
+ assert server._skill_dir_name("../escape") == "escape"
+ assert server._skill_dir_name("a/b") == "a-b"
+ assert server._skill_dir_name("") == "skill"
+ server._write_skills(str(tmp_path), [{"name": "test-skill",
+ "files": [{"path": "SKILL.md", "content": "---\nname: test-skill\n---\nRun test.py"},
+ {"path": "test.py", "content": "print('hi')"}]}], "codex")
+ d = tmp_path / ".harness" / "skills" / "test-skill"
+ assert (d / "SKILL.md").exists() and (d / "test.py").read_text() == "print('hi')"
+
+
+def test_the_agent_doc_says_a_skill_s_files_sit_beside_its_skill_md(tmp_path):
+ """The failure this prevents: 'Run test.py' in a SKILL.md, and the agent runs it in the
+ workspace root, where nothing is."""
+ installed = server._write_skills(str(tmp_path), [{"name": "test-skill", "files": [
+ {"path": "SKILL.md", "content": "---\nname: test-skill\ndescription: d\n---\nRun test.py"},
+ {"path": "test.py", "content": "print('hi')"}]}], "codex")
+ server._write_agent_doc(str(tmp_path), "codex", "", installed)
+ doc = (tmp_path / "AGENTS.md").read_text()
+ assert "BESIDE its SKILL.md" in doc
+ assert "`.harness/skills/test-skill/SKILL.md`" in doc