Skip to content

The agent that grows with you

fix(skills): allow non-ASCII characters in skill command names (#12351)

enigma036b3ff5ba6c
diff --git a/agent/skill_commands.py b/agent/skill_commands.py
index 6a09f774c00..253b47e5dee 100644
--- a/agent/skill_commands.py
+++ b/agent/skill_commands.py
@@ -20,7 +20,10 @@ _skill_commands_home: Optional[str] = None
# Guards the (map, platform-tag, home-tag) triple so publication and the
# freshness lookup always see a consistent snapshot. Scanning stays outside.
_publish_lock = threading.Lock()
-_SKILL_INVALID_CHARS = re.compile(r"[^a-z0-9-]")
+# ``\w`` keeps Unicode letters (CJK, Cyrillic) so a ``name: 小说拆条`` skill registers ``/小说拆条``
+# instead of slugging to "" and being dropped (#12351); Telegram's ``[a-z0-9_]`` menu limit is
+# applied by hermes_cli/commands_platforms.py, not here.
+_SKILL_INVALID_CHARS = re.compile(r"[^\w-]")
_SKILL_MULTI_HYPHEN = re.compile(r"-{2,}")
# Skill-scaffolding markers. A /skill (or /bundle) turn is expanded into a
diff --git a/tests/agent/test_skill_commands.py b/tests/agent/test_skill_commands.py
index 02e7bfd149e..e61012d1248 100644
--- a/tests/agent/test_skill_commands.py
+++ b/tests/agent/test_skill_commands.py
@@ -517,6 +517,20 @@ class TestScanSkillCommands:
# partial one growing from 0.
assert observed_sizes == [skill_count] * skill_count
+ def test_non_ascii_name_registers_command(self, tmp_path):
+ """A CJK skill name slugs to itself (punctuation still stripped) instead of "" and being
+ silently dropped (#12351); ``resolve_skill_command_key`` round-trips it."""
+ with patch("tools.skills_tool.SKILLS_DIR", tmp_path):
+ skill_dir = tmp_path / "novel-clipper"
+ skill_dir.mkdir()
+ (skill_dir / "SKILL.md").write_text(
+ "---\nname: 小说+拆条\ndescription: Split novels into clips.\n---\n\nBody.\n", encoding="utf-8"
+ )
+ result = scan_skill_commands()
+ assert "/小说拆条" in result
+ assert result["/小说拆条"]["name"] == "小说+拆条"
+ assert resolve_skill_command_key("小说拆条") == "/小说拆条"
+
class TestResolveSkillCommandKey:
"""Telegram bot-command names disallow hyphens, so the menu registers