feat: add Hermes Agent support — configs, plugin, README#425
Conversation
07de05b to
a4b5daa
Compare
a4b5daa to
41f6579
Compare
|
Why is it py? |
It's dictated by the Hermes runtime. Hermes Agent is a Python-based application, and its plugin system ( To hook into the agent's tool selection process (e.g., intercepting a This is analogous to the existing plugins in this repo: Cursor's |
EPPCOM-Solutions
left a comment
There was a problem hiding this comment.
HOLD — three blockers before this can merge
The approach (Python plugin for a Python-native runtime) is architecturally defensible — same rationale as OpenClaw's JS plugin. But the PR has gaps that need addressing:
Blocker 1: Verify Hermes Agent exists and hook API matches
The PR claims Nous Research / 130k+ GitHub stars. This cannot be verified from the diff. Please link:
- The actual GitHub repo URL
- The official plugin documentation URL (you reference
build-a-hermes-plugin.mdin the PR body but don't link it) - Confirmation that
pre_tool_call,pre_llm_call, andregister(ctx)match the real API signatures - That the
{"action": "block", "message": ...}return schema is respected by the runtime
Blocker 2: TDD gate — tests required
Your own checklist has [ ] Tests added/updated unchecked. Every other platform in this repo has tests/adapters/<platform>.test.ts. At minimum add a tests/adapters/hermes.test.ts covering:
pre_tool_callblocks disallowed toolspre_tool_callallows tools in ALLOWED listpre_llm_callinjects guidance on first turn only_GUIDANCE_SHOWNdoes not re-inject on subsequent turns
(Can be Python stubs tested via subprocess or JS stubs — your call, but tests must exist.)
Blocker 3: Memory leak in _GUIDANCE_SHOWN
_GUIDANCE_SHOWN is a module-level dict that grows unbounded across sessions with no eviction. In a long-running gateway process (days/weeks uptime) this leaks. Cap it:
if len(_GUIDANCE_SHOWN) > 1000:
_GUIDANCE_SHOWN.clear() # simple LRU approximationMinor fixes (not blockers):
- README has a duplicate
<sup>(CentOS, RHEL, Alpine)</sup></summary>line — merge artifact, remove it - Link the Hermes plugin docs URL inline in the README install section
Happy to re-review once these are addressed — the core idea is sound.
|
@tayuLuc If we implement this, you’ll be responsible for any future issues, bugs, and improvements. Do you agree to this, since I don’t use Hermes Agent? |
|
Fair points on the blockers. The plugin isn't ready to merge. Still, I think there's value in keeping this PR visible — it's a way for the Hermes community to discover context-mode. For the repo side, maybe just a note in the README that Hermes support is in progress? That way when someone searches for it, they find the trail. I'll keep working on the plugin locally, and if there's enough traction, we can address the blockers with proper tests and a clean implementation. |
|
@tayuLuc Close the PR and work on it yourself; reopen the PR when you're ready |
|
there's definitely interest in this... it goes a long way toward solving a token-burning problem in Hermes-Agent, so definitely would love to see this pursued. And to be fair, Blocker 1 is... not really a blocker, more the bot not understanding that... yeah - Hermes does, in fact, exist. Blocker 2 is just a missing test, but... isn't there a test in the commit? And blocker 3 just requires capping the memory leak which the bot even showed a basic approximation of 😅 so... this feels like it's pretty close? Or did I glance too quickly? |
|
How you think about the PR's testing process? What should we do for that? How's going on your side in here? @tayuLuc |
|
@mksglu I've been thinking about the testing setup. pytest is probably the way to go — same pattern as vitest, auto-discovery, fixtures, exit codes. Can keep it inside the vitest call or spin it out as a separate CI step. |
fb56d13 to
7555fad
Compare
|
Why is it closed. @tayuLuc |
|
I accidentally did the wrong merge of commits and force push it.
|
|
OK. Let's reopen. We need manually testing when it's ready. @tayuLuc |
What / Why / How
Adds Hermes Agent support to context-mode — the first upstream integration for this platform.
What: Configuration files, plugin, and README updates to support context-mode on Hermes Agent.
Why: Hermes Agent is an open-source AI agent framework by Nous Research with 130k+ GitHub stars, running across CLI, Telegram, Discord, and other platforms. It natively supports MCP servers and has a Python plugin system — making it a natural fit for context-mode.
How:
configs/hermes/AGENTS.md— routing rules for Hermes (same pattern as OpenClaw/OpenCode configs)plugins/context-saver/— Hermes Agent plugin withpre_tool_callandpre_llm_callhooks that enforce context-mode routingNo dependency on context-mode's npm package — the plugin uses Hermes' native
execute_codeas the sandbox, making it zero-dependency.Affected platforms
Test plan
hermes mcp add context-mode -- npx -y context-mode~/.hermes/plugins/context-saver/plugins.enabled: [context-saver]hermes gateway restartpre_tool_callblockscurl— model redirects toctx_executectx stats/ctx doctorutility commands work via MCPChecklist
npm testpasses (no JS/TS changes — Python plugin only)npm run typecheckpassesnextbranch (unless hotfix)Cross-platform notes
The plugin is pure Python 3.9+ — no native dependencies. Hermes Agent runs on macOS, Linux, and Windows (WSL).