The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): name portable plugin skills after the plugin, not a hashed namespace
Teknium7ae117eb4c69
diff --git a/hermes_cli/plugin_host.py b/hermes_cli/plugin_host.pyindex 3f4a6693bff..0c0123914b0 100644--- a/hermes_cli/plugin_host.py+++ b/hermes_cli/plugin_host.py@@ -216,7 +216,7 @@ class PluginHost:"profile_name": self._base_context.copy().run(lambda: ctx.profile_name),"manifest": {k: getattr(manifest, k, None) for k in ("name", "version", "description", "author", "source", "path", "key", "kind",- "skill_namespace")},+ "data_namespace")},"ctx_methods": sorted(n for n in dir(PluginContext) if not n.startswith("_")),}self._loading = plugin_keydiff --git a/hermes_cli/plugins.py b/hermes_cli/plugins.pyindex 464b1d9175c..8a6eae1c09d 100644--- a/hermes_cli/plugins.py+++ b/hermes_cli/plugins.py@@ -35,7 +35,7 @@ from hermes_cli.plugin_capabilities import plugin_capability_grantedfrom hermes_cli.relay_plugin_cutover import RELAY_PLUGINS_CONFIG_ENV, legacy_relay_plugin_keys# Sibling modules' names are re-exported here (origin) so plugins and tests keep one import path.from hermes_cli.plugins_manifest import (- _CONFIG_SCHEMA_TYPES, SUPPORTED_MANIFEST_VERSION, PluginManifest, _portable_skill_namespace,+ _CONFIG_SCHEMA_TYPES, SUPPORTED_MANIFEST_VERSION, PluginManifest, _portable_data_namespace,manifest_key, parse_manifest_file, resolve_module_origin, resolve_plugin_load_order,validate_config_schema,)@@ -281,7 +281,7 @@ class PluginContext:@cached_propertydef state(self) -> PluginState:"""This plugin's profile-scoped durable JSON state facade."""- return PluginState(self.plugin_id, self.manifest.skill_namespace)+ return PluginState(self.plugin_id, self.manifest.data_namespace)@cached_propertydef platform_actions(self):@@ -1463,7 +1463,7 @@ class PluginManager(PluginLoaderMixin, PluginDispatchMixin, PluginLedgerMixin):try: # lazy: this is a startup probe, keep agent_plugins unimported unless neededfrom hermes_cli.agent_plugins import _discover_mcpif _discover_mcp(Path(manifest.path), get_hermes_home() / "plugin-data"- / (manifest.skill_namespace or lookup_key), [], create_data=False):+ / (manifest.data_namespace or lookup_key), [], create_data=False):return Trueexcept (OSError, RuntimeError, ValueError):continue # fail closed on an unreadable package; full discovery reports itdiff --git a/hermes_cli/plugins_activation_live.py b/hermes_cli/plugins_activation_live.pyindex 1b854f65399..804dd217ac8 100644--- a/hermes_cli/plugins_activation_live.py+++ b/hermes_cli/plugins_activation_live.py@@ -86,10 +86,8 @@ def plugin_skills(plugin_key: str) -> list[dict[str, str]]:def catalog_plugin_skill(written: str) -> Optional[str]:"""The registered name of a plugin skill written ``<catalog-name>:<skill>`` (``blender:blender``), or- None when that catalog plugin is not installed in this profile or registered no such skill. A- portable plugin's skills register under a collision-resistant namespace- (``agent-plugin-<slug>-<sha8>:<skill>``, ``hermes_cli/plugins_manifest.py``), so the readable form- is never itself a name ``skill_view`` resolves."""+ None when that catalog plugin is not installed in this profile or registered no such skill. Skills+ register under the plugin's manifest name, which need not match its catalog entry name."""from hermes_cli.plugins import get_plugin_managerfrom hermes_cli.plugins_cmd import _catalog_installed_dircatalog_name, _, bare = written.partition(":")diff --git a/hermes_cli/plugins_content.py b/hermes_cli/plugins_content.pyindex 92b8d79f544..aa01b2b0348 100644--- a/hermes_cli/plugins_content.py+++ b/hermes_cli/plugins_content.py@@ -29,6 +29,7 @@ def register_skill(is enabled. Not copied into ``~/.hermes/skills/``. Raises ``ValueError`` (``':'``/invalidchars) or ``FileNotFoundError``."""from agent.skill_utils import _NAMESPACE_RE+ from hermes_cli.plugins_manifest import _portable_slugif ":" in name:raise ValueError(f"Skill name '{name}' must not contain ':' (the namespace is derived from the "f"plugin name '{self.manifest.name}' automatically).")@@ -40,10 +41,11 @@ def register_skill(path = Path(path)if not path.exists():raise FileNotFoundError(f"SKILL.md not found at {path}")- namespace = self.manifest.skill_namespace or self.manifest.name+ namespace = _portable_slug(self.manifest.name) if self.manifest.portable else self.manifest.namequalified = f"{namespace}:{name}"if self.manifest.portable and qualified in self._manager._plugin_skills:- raise ValueError(f"Plugin skill '{qualified}' is already registered")+ owner = self._manager._plugin_skills[qualified].get("plugin_key", "?")+ raise ValueError(f"Plugin skill '{qualified}' is already registered by plugin '{owner}'")entry = {"path": path, "plugin": namespace, "plugin_key": self.plugin_id, "bare_name": name,"description": description, "frontmatter": dict(frontmatter or {}),diff --git a/hermes_cli/plugins_loader.py b/hermes_cli/plugins_loader.pyindex 8ad2ef2d0e9..16056a09303 100644--- a/hermes_cli/plugins_loader.py+++ b/hermes_cli/plugins_loader.py@@ -722,7 +722,7 @@ class PluginLoaderMixin:try:from hermes_cli.agent_plugins import load_agent_pluginpackage = load_agent_plugin(- Path(manifest.path), get_hermes_home() / "plugin-data" / manifest.skill_namespace)+ Path(manifest.path), get_hermes_home() / "plugin-data" / manifest.data_namespace)ctx = PluginContext(manifest, self)for diagnostic in package.diagnostics:logger.warning("Agent Plugin '%s' [%s]: %s", lookup_key, diagnostic.scope, diagnostic.message)diff --git a/hermes_cli/plugins_manifest.py b/hermes_cli/plugins_manifest.pyindex 1781fc46895..8153f476a41 100644--- a/hermes_cli/plugins_manifest.py+++ b/hermes_cli/plugins_manifest.py@@ -56,8 +56,8 @@ def _plugins_debug() -> bool:return _origin._PLUGINS_DEBUG-def _portable_skill_namespace(key: str) -> str:- """Return a readable, collision-resistant namespace for a portable plugin."""+def _portable_data_namespace(key: str) -> str:+ """Return a readable, collision-resistant ``plugin-data`` directory name for a portable plugin."""slug = _portable_slug(key)digest = hashlib.sha256(key.encode("utf-8")).hexdigest()[:8]return f"agent-plugin-{slug}-{digest}"@@ -70,8 +70,8 @@ def _portable_slug(key: str) -> str:def portable_mcp_server_name(key: str, server: str) -> str:"""Internal name of a portable plugin's MCP server: exactly the name its ``mcp.json`` gives it, the same- rule a user's own ``mcp_servers`` block in config.yaml follows. The plugin's skill namespace- (``agent-plugin-<slug>-<digest>``) is NOT prepended: it keeps plugin-data and skill names collision-free+ rule a user's own ``mcp_servers`` block in config.yaml follows. The plugin's data namespace+ (``agent-plugin-<slug>-<digest>``) is NOT prepended: it keeps plugin-data dirs collision-freewithout coordination, but here it cost ~40 chars of every ``mcp__<server>__<tool>`` name, which providerscap at 64, so the tool verb was hash-clamped away. A duplicate is refused at load (native config first,then first-loaded plugin) with a warning naming both owners; that beats hiding it behind a digest."""@@ -368,7 +368,9 @@ class PluginManifest:# recorded with an error and skipped before import — see ``requires_hermes_error``.requires_hermes: str = ""portable: bool = False- skill_namespace: str = ""+ # ``plugin-data/<data_namespace>`` for a portable plugin; its skills are named after the plugin+ # itself (``<name>:<skill>``), like every native plugin's.+ data_namespace: str = ""# Declared capability ids, normalized to KNOWN ids. Declaration is consent metadata, NOT a grant: live# only via plugins.entries.<id>.granted_capabilities or the legacy allow_* key.# See #64228.@@ -501,7 +503,7 @@ def portable_plugin_manifest(child: Path, source: str, prefix: str) -> PluginManreturn PluginManifest(name=data["name"], version=data.get("version", ""), description=data.get("description", ""),author=_display_author(data.get("author", "")), source=source, path=str(child), key=key,- portable=True, skill_namespace=_portable_skill_namespace(key),+ portable=True, data_namespace=_portable_data_namespace(key),config_schema=_config_schema_entries(key, manifest_config_schema(data)),)diff --git a/hermes_cli/plugins_state.py b/hermes_cli/plugins_state.pyindex 97a6986bc87..05d9be0af03 100644--- a/hermes_cli/plugins_state.py+++ b/hermes_cli/plugins_state.py@@ -11,7 +11,7 @@ from pathlib import Pathfrom typing import Any, Dict, Mappingfrom hermes_constants import get_hermes_home-from hermes_cli.plugins_manifest import _portable_skill_namespace+from hermes_cli.plugins_manifest import _portable_data_namespace_PLUGIN_SETTING_SEGMENT_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$")_PLUGIN_SETTING_RESERVED_ROOTS = frozenset({"model", "plugins", "security", "settings"})@@ -90,15 +90,15 @@ def save_plugin_setting(plugin_id: str, segments: tuple[str, ...], value: Any) -config_mod.save_config(partial, preserve_keys={full_path}, merge_existing=True)-def _plugin_data_namespace(plugin_id: str, skill_namespace: str) -> str:+def _plugin_data_namespace(plugin_id: str, data_namespace: str) -> str:"""Return one Windows-safe directory component for plugin-owned data. Portable Agent Plugins alreadyreceive this exact PLUGIN_DATA path; otherwise the fixed prefix avoids Windows reserved device names andthe digest prevents fold collisions."""- candidate = skill_namespace or plugin_id- portable = skill_namespace and candidate.startswith("agent-plugin-")+ candidate = data_namespace or plugin_id+ portable = data_namespace and candidate.startswith("agent-plugin-")if portable and re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_-]{0,191}", candidate):return candidate- return _portable_skill_namespace(candidate)+ return _portable_data_namespace(candidate)@contextmanager@@ -134,8 +134,8 @@ def _locked_plugin_state(path: Path):class PluginState:"""Atomic, quota-bounded JSON key/value state owned by one plugin."""- def __init__(self, plugin_id: str, skill_namespace: str = "") -> None:- self._data_namespace = _plugin_data_namespace(plugin_id, skill_namespace)+ def __init__(self, plugin_id: str, data_namespace: str = "") -> None:+ self._data_namespace = _plugin_data_namespace(plugin_id, data_namespace)@propertydef data_dir(self) -> Path:diff --git a/tests/hermes_cli/test_plugin_config_state_bridge.py b/tests/hermes_cli/test_plugin_config_state_bridge.pyindex a5dc767e5a7..8202f1b5127 100644--- a/tests/hermes_cli/test_plugin_config_state_bridge.py+++ b/tests/hermes_cli/test_plugin_config_state_bridge.py@@ -20,7 +20,7 @@ def _context(*, name: str = "fixture-plugin", key: str = "", namespace: str = "") -> PluginContext:return PluginContext(- PluginManifest(name=name, key=key, skill_namespace=namespace),+ PluginManifest(name=name, key=key, data_namespace=namespace),PluginManager(),)diff --git a/tests/hermes_cli/test_plugins.py b/tests/hermes_cli/test_plugins.pyindex a597191743b..520caf48595 100644--- a/tests/hermes_cli/test_plugins.py+++ b/tests/hermes_cli/test_plugins.py@@ -21,7 +21,7 @@ from hermes_cli.plugins import (get_pre_verify_continue_message,has_middleware,resolve_plugin_command_result,- _portable_skill_namespace,+ _portable_data_namespace,)from hermes_cli.relay_plugin_cutover import RELAY_PLUGINS_CONFIG_ENVfrom hermes_cli.middleware import (@@ -35,10 +35,10 @@ from hermes_cli.middleware import (# ── Helpers ────────────────────────────────────────────────────────────────-def test_portable_skill_namespace_is_ascii_safe():+def test_portable_data_namespace_is_ascii_safe():from agent.skill_utils import is_valid_namespace- namespace = _portable_skill_namespace("café/portable")+ namespace = _portable_data_namespace("café/portable")assert namespace.isascii()assert is_valid_namespace(namespace)diff --git a/tests/hermes_cli/test_plugins_live_notice.py b/tests/hermes_cli/test_plugins_live_notice.pyindex 6b461be7e75..7247e13a8fc 100644--- a/tests/hermes_cli/test_plugins_live_notice.py+++ b/tests/hermes_cli/test_plugins_live_notice.py@@ -13,7 +13,7 @@ from agent.prompt_builder import CONTROL_FRAME_OPENERSfrom hermes_cli.plugins_activation_live import live_noticefrom tools.registry import registry-SKILL = "agent-plugin-blender-5a80e4ba:blender"+SKILL = "blender:blender"TOOLS = ["mcp__blender__execute_blender_code", "mcp__blender__get_objects_summary","mcp__blender__render_viewport_to_path"]diff --git a/tests/tools/test_setup_beat_plugin_skills.py b/tests/tools/test_setup_beat_plugin_skills.pyindex 30b5cb0a555..bfc3eee0a34 100644--- a/tests/tools/test_setup_beat_plugin_skills.py+++ b/tests/tools/test_setup_beat_plugin_skills.py@@ -1,9 +1,9 @@"""The build beat names a plugin's skill by the name it registered under.-A first task writes a plugin skill readably (``blender:blender``), but a portable plugin's skills-register under a collision-resistant namespace (``agent-plugin-blender-<sha8>:blender``). In a live run-the build beat sent the readable form, ``skill_view("blender:blender")`` missed, and the model rendered-headless without the skill. Real plugin discovery against a temp ``HERMES_HOME``.+A first task writes a plugin skill as ``<catalog-name>:<skill>`` and a portable plugin's skills register+under the plugin's own name, so ``blender:blender`` is the name ``skill_view`` resolves. Skills saved+under the older ``agent-plugin-<slug>-<sha8>:<skill>`` form still resolve. Real plugin discovery+against a temp ``HERMES_HOME``."""from __future__ import annotations@@ -59,12 +59,22 @@ def test_the_build_beat_names_an_installed_plugin_skill_by_its_registered_name(hmanager = plugins_mod.get_plugin_manager()manager.discover_and_load(force=True)[registered] = [skill["name"] for skill in manager.list_plugin_skill_metadata()]- assert registered.startswith("agent-plugin-blender-") and registered.endswith(":blender")+ assert registered == "blender:blender"- line = _build_skills_line()+ assert registered in _build_skills_line()- assert registered in line- assert "blender:blender" not in line.replace(registered, "")++def test_a_skill_saved_under_the_hashed_portable_name_still_loads(home):+ from hermes_cli.plugins_manifest import _portable_data_namespace+ from tools.skills_tool import skill_view++ _install_blender_from_catalog(home)+ plugins_mod.get_plugin_manager().discover_and_load(force=True)++ result = json.loads(skill_view(f"{_portable_data_namespace('blender')}:blender"))++ assert result["success"] is True+ assert result["name"] == "blender:blender"def test_a_plugin_skill_that_is_not_installed_is_dropped(home):diff --git a/tools/skills_tool.py b/tools/skills_tool.pyindex 64ea103bfa0..27081a03220 100644--- a/tools/skills_tool.py+++ b/tools/skills_tool.py@@ -317,6 +317,16 @@ def skills_list(category: str | None = None, task_id: str | None = None) -> str:return tool_error(str(e), success=False)+def _legacy_portable_skill_name(pm, namespace, bare):+ """Portable plugin skills were named ``agent-plugin-<slug>-<sha8>:<skill>`` before they took the+ plugin's own name; prompts and cron jobs saved since then may still carry that form."""+ if not namespace.startswith("agent-plugin-"):+ return None+ from hermes_cli.plugins_manifest import _portable_slug+ return next((f"{_portable_slug(loaded.manifest.name)}:{bare}" for loaded in pm._plugins.values()+ if loaded.manifest.portable and loaded.manifest.data_namespace == namespace), None)++def _resolve_plugin_skill(name, file_path, task_id, preprocess):"""``plugin:skill`` dispatch: ``(result_json, None)`` when answered, else ``(None,local_category_name)`` to fall through to the flat-tree scan — categorized local skills also use@@ -328,6 +338,9 @@ def _resolve_plugin_skill(name, file_path, task_id, preprocess):return _fail(f"Invalid namespace '{namespace}' in '{name}'. Namespaces must match [a-zA-Z0-9_-]+."), Nonediscover_plugins() # idempotentpm = get_plugin_manager()+ if legacy := _legacy_portable_skill_name(pm, namespace, bare):+ name = legacy+ namespace = legacy.partition(":")[0]active_memory_provider = Nonetry:from plugins.memory import _get_active_memory_provider, _prune_inactive_memory_provider_skillsdiff --git a/website/docs/developer-guide/plugins/index.md b/website/docs/developer-guide/plugins/index.mdindex 1dab2a0674c..e1b20105471 100644--- a/website/docs/developer-guide/plugins/index.md+++ b/website/docs/developer-guide/plugins/index.md@@ -86,9 +86,12 @@ them. An enabled package may provide immediate `skills/*/SKILL.md` directoriesand stdio MCP servers from root `mcp.json`. Skills are read-only, namespaced,and loaded through `skills_list` plus `skill_view`. MCP commands are passed asone executable token with a separate argument list, never through a shell.-Use `skills_list` to discover the full qualified skill name. Portable skill-namespaces have the deterministic form `agent-plugin-<slug>-<hash>`, derived-from the discovered plugin key so sanitized names cannot collide. A portable+A portable package's skills are named after the plugin, `<plugin-name>:<skill>`+(`blender:blender`), the same form as a native plugin's; when two loaded plugins+would register the same qualified name, the second one's skill is skipped with a+warning naming both. Its data directory, `plugin-data/agent-plugin-<slug>-<hash>`,+keeps a name derived from the discovered plugin key so sanitized names cannot+collide on disk. A portablepackage's MCP servers keep the names their `mcp.json` gives them, the same ruleas a user's own `mcp_servers` block, so the model-facing `mcp__<server>__<tool>`name keeps the tool verb inside the 64-character provider cap. A duplicate server