Skip to content

The agent that grows with you

fix(skills): ClawHub installs read as installed on catalog cards and in hub search

Austin Pickettf73b3147f3a1
diff --git a/hermes_cli/web_server_profiles.py b/hermes_cli/web_server_profiles.py
index bbfd9c02c72..6a474887adf 100644
--- a/hermes_cli/web_server_profiles.py
+++ b/hermes_cli/web_server_profiles.py
@@ -465,18 +465,29 @@ def _hub_action_name(verb: str, key: str) -> str:
def _installed_hub_identifiers(profile: Optional[str] = None) -> dict:
"""identifier -> installed lock entry for hub-installed skills (UI marks installed search
- results). Scoped to ``profile``'s skills/.hub/lock.json when given — HubLockFile takes an
- explicit path, sidestepping the import-time LOCK_FILE binding. {} when unreadable."""
+ results and catalog cards). Scoped to ``profile``'s skills/.hub/lock.json when given —
+ HubLockFile takes an explicit path, sidestepping the import-time LOCK_FILE binding. {} when
+ unreadable.
+
+ A ClawHub row is also listed under ``ClawHubSource.catalog_identifiers``, so a card's
+ ``clawhub/<slug>`` and a search hit's bare slug match the lock's ``@owner/slug``. Exact
+ lock ids win."""
try:
from tools.skills_hub import HubLockFile
+ from tools.skills_hub_clawhub import ClawHubSource
if _is_current_profile(profile):
lock = HubLockFile()
else:
profile_dir = _resolve_profile_dir(profile.strip())
lock = HubLockFile(profile_dir / "skills" / ".hub" / "lock.json")
keys = ("name", "trust_level", "scan_verdict")
- return {entry["identifier"]: {k: entry.get(k) for k in keys}
- for entry in lock.list_installed() if entry.get("identifier")}
+ rows = [entry for entry in lock.list_installed() if entry.get("identifier")]
+ installed = {entry["identifier"]: {k: entry.get(k) for k in keys} for entry in rows}
+ for entry in rows:
+ if entry.get("source") == "clawhub":
+ for alias in ClawHubSource.catalog_identifiers(entry["identifier"]):
+ installed.setdefault(alias, installed[entry["identifier"]])
+ return installed
except HTTPException:
raise # an unknown profile is the scope's 404, not an unreadable lock file
except Exception:
diff --git a/tests/hermes_cli/test_installed_hub_identifiers.py b/tests/hermes_cli/test_installed_hub_identifiers.py
new file mode 100644
index 00000000000..39c5a2aeac5
--- /dev/null
+++ b/tests/hermes_cli/test_installed_hub_identifiers.py
@@ -0,0 +1,69 @@
+"""Installed state for hub skills: the ``installed`` map that ``/api/skills/hub/sources``,
+``/search`` and ``/official`` return, which Desktop catalog cards and the dashboard's hub
+search check with ``installed[identifier]``.
+
+ClawHub records ``@owner/slug`` in the lock, while a catalog card installs
+``clawhub/<slug>`` and the hermes-index / hub search list the bare slug."""
+
+import asyncio
+
+from hermes_cli.web_routers.skills import search_skills_hub
+from hermes_cli.web_server_profiles import _installed_hub_identifiers
+from tools.skills_hub import HubLockFile
+from tools.skills_hub_models import SkillMeta
+
+
+def _lock(*rows):
+ """Write ``(source, identifier, name)`` rows to the active profile's hub lock."""
+ HubLockFile().save({"version": 1, "installed": {
+ name: {"source": source, "identifier": identifier, "trust_level": "community",
+ "scan_verdict": "safe", "install_path": name, "files": ["SKILL.md"]}
+ for source, identifier, name in rows}})
+
+
+def test_clawhub_install_answers_to_the_card_and_search_ids():
+ _lock(("clawhub", "@tmstudio667-commits/agent-git-oracle", "agent-git-oracle"),
+ ("clawhub", "legacy-slug", "legacy-slug"))
+
+ installed = _installed_hub_identifiers()
+
+ record = installed["@tmstudio667-commits/agent-git-oracle"]
+ assert record["name"] == "agent-git-oracle"
+ assert installed["clawhub/agent-git-oracle"] == record
+ assert installed["agent-git-oracle"] == record
+ # A lock row from before owners were recorded keeps its bare id and gains the card id.
+ assert installed["clawhub/legacy-slug"] == installed["legacy-slug"]
+
+
+def test_other_sources_keep_their_exact_ids_only():
+ _lock(("skills.sh", "skills-sh/browserbase/skills/browser", "browser"),
+ ("official", "official/research/arxiv", "arxiv"),
+ ("github", "anthropics/skills/skills/pdf", "pdf"))
+
+ assert set(_installed_hub_identifiers()) == {
+ "skills-sh/browserbase/skills/browser", "official/research/arxiv",
+ "anthropics/skills/skills/pdf"}
+
+
+def test_an_exact_lock_id_beats_a_clawhub_alias():
+ _lock(("hermes-index", "foo", "foo"), ("clawhub", "@alice/foo", "foo-fork"))
+
+ installed = _installed_hub_identifiers()
+
+ assert installed["foo"]["name"] == "foo"
+ assert installed["clawhub/foo"]["name"] == "foo-fork"
+
+
+def test_hub_search_marks_an_installed_clawhub_result(monkeypatch):
+ # Index-backed results carry ClawHub's bare slug; the dashboard checks installed[identifier].
+ hit = SkillMeta(name="Agent Git Oracle", description="", source="clawhub",
+ identifier="agent-git-oracle", trust_level="community")
+ monkeypatch.setattr("tools.skills_hub_search.create_source_router", list)
+ monkeypatch.setattr("tools.skills_hub_search.parallel_search_sources",
+ lambda sources, **kw: ([hit], {"clawhub": 1}, []))
+ _lock(("clawhub", "@tmstudio667-commits/agent-git-oracle", "agent-git-oracle"))
+
+ body = asyncio.run(search_skills_hub(q="agent git oracle"))
+
+ assert [r["identifier"] for r in body["results"]] == ["agent-git-oracle"]
+ assert body["installed"]["agent-git-oracle"]["name"] == "agent-git-oracle"
diff --git a/tools/skills_hub_clawhub.py b/tools/skills_hub_clawhub.py
index ce59608ffbd..5d6e00e9822 100644
--- a/tools/skills_hub_clawhub.py
+++ b/tools/skills_hub_clawhub.py
@@ -234,6 +234,14 @@ class ClawHubSource(GuardedFetchMixin, SkillSource):
return None
return slug, owner
+ @classmethod
+ def catalog_identifiers(cls, identifier: str) -> tuple[str, ...]:
+ """Owner-less forms of an installed ``identifier``: ``clawhub/<slug>`` (what a catalog
+ card installs) and ``<slug>`` (what the hermes-index and hub search list). ``fetch``
+ records ``@owner/slug``. Empty when ``identifier`` is not a ClawHub id."""
+ parsed = cls._parse_identifier(identifier)
+ return (f"clawhub/{parsed[0]}", parsed[0]) if parsed else ()
+
def fetch(self, identifier: str) -> Optional[SkillBundle]:
detail = self._skill_detail(identifier)
if detail is None: