feat(hermes): support Hermes agent as a sync target - #269
Merged
Conversation
Adapt teamai to Hermes Agent (NousResearch). Resources land in
Hermes-native, user-level locations under $HERMES_HOME (default ~/.hermes):
- skills -> .hermes/skills/ (via toolPaths)
- rules -> .hermes/SOUL.md (teamai-managed marker block)
- hooks -> config.yaml hooks block + .hermes/hooks/*.sh script
+ shell-hooks-allowlist.json pre-authorization
Both hook paths are wired to Hermes' native YAML format: the local
status-report hook (reconcileHooksToAllTools) and server-dispatched
agent hooks (local-agent runHookRuleCommand), instead of the JSON
settings.json path Hermes never reads.
config.yaml is edited via the yaml Document API so user comments and
formatting survive. Install/uninstall are symmetric and only touch the
teamai-managed block, preserving user content. Writes are gated on the
.hermes home existing, so users who don't run Hermes are never touched.
Adds 16 unit tests for the config/SOUL/hook read-modify-write logic.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for Hermes Agent (NousResearch) as a teamai sync target. Motivating scenario: users configure Hermes via a cloud web UI, where the workspace has no
.claude/or.cursor/directories — so every resource must land in Hermes' native, user-level locations.Hermes was already in
known-agents.tsfor detection but was never wired intotoolPaths, soteamai pullinstalled nothing for it. Hermes also uses config formats that none of the existing adapters (Claude / OpenClaw / Cursor) match.Closes #267.
Resource mapping (all user-level,
H = $HERMES_HOME, default~/.hermes/)H/skills/<name>/SKILL.mdtoolPaths.hermes.skills; Hermes scans this nativelyH/SOUL.mdH/config.yamlhooks:block +H/hooks/*.sh+H/shell-hooks-allowlist.json"hermes"Key design points
settingstoolPath for Hermes. Giving it one would route server-dispatched agent hooks through the JSONsettings.jsonwriter — a file Hermes never reads (silent "fake success"). All Hermes hooks go through the nativeconfig.yamlYAML path instead.reconcileHooksToAllTools) and server-dispatched agent hooks (local-agentrunHookRuleCommand/removeAllAgentHooks) both dispatch to the Hermes YAML adapter fortool === 'hermes', bypassingresolveToolSettingsPath(which would otherwise throw).config.yamlis modified via theyamlDocument API, so user comments/formatting survive pull and uninstall.SOUL.mdandconfig.yaml.$HERMES_HOMEexists, so users who don't run Hermes never get a~/.hermescreated.uninstall --agent <other>never touches Hermes.Files
New:
src/hermes-home.ts,src/hermes-config.ts,src/hermes-hooks.ts,src/__tests__/hermes-config.test.ts.Changed:
src/types.ts,src/usage-tracker.ts,src/resources/rules.ts,src/hooks.ts,src/local-agent.ts,src/uninstall.ts.Test Plan
npx tsc --noEmit— zero errorsnpm run build— successnpx vitest run— 1884 passed (incl. 16 new Hermes tests)pull: skills →.hermes/skills/, rules →.hermes/SOUL.mdblock, hooks →config.yaml+.hermes/hooks/*.sh(executable) + allowlistSOUL.md/config.yaml(incl. comments) preservedpullis idempotent (no duplicate blocks/entries)uninstall --agent hermesremoves all three resource types; fulluninstallsymmetric; user content keptpulldoes not create~/.hermesHERMES_HOME→ install gate and write both honor it🤖 Generated with Claude Code