Skip to content

feat(hermesagent): track Hermes Agent v0.22.3 hook events and MCP cost keys - #3589

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-2414-hermes-2026-10-22
Oct 22, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-2414-hermes-2026-10-22

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Follows the gaps listed in the 2026-10-22 re-check comment on #2414 (Hermes Agent v0.22.3).

Hooks: two new VALID_HOOKS events

VALID_HOOKS in hermes_cli/plugins.py grew from 44 to 46 entries at v0.22.3: on_session_delete (fires after a session delete or archive commits) and post_compaction (fires once per committed compaction, NousResearch/hermes-agent#118382). Both are observers and allowed as shell hooks (SHELL_UNSUPPORTED_HOOKS is still only transform_api_error_classification).

  • Added both to HERMESAGENT_NATIVE_HOOK_EVENTS (now 45 of 46).
  • Re-pinned the "not documented by Hermes Agent ..." warning, JSDoc @see links, docs/reference/file-formats.md and the compatibility note in docs/reference/supported-tools.md to v0.22.3.

MCP (global): tool_costs, spend_limit, cost_unit

v0.22.3 documents these per-server keys in mcp-config-reference.md, and tools/mcp_tool_costs.py reads them (CONFIG_KEYS = ("tool_costs", "spend_limit", "cost_unit")). copyHermesAdvancedFields is an allowlist, so they could not be authored, and a hand-written spend_limit was dropped on the next global generate. That silently removed the user's per-chat spend guard.

  • spend_limit (number) and cost_unit (string) are copied verbatim. They join the existing typed-scalar table next to idle_timeout_seconds / max_lifetime_seconds, which keeps the function under the complexity limit.
  • tool_costs is added to HERMES_OPAQUE_MAPPING_KEYS. It is cloned as an opaque mapping with the pollution keys dropped, because its values can be a number, a [min, max] range or {credits, note}.
  • Import uses the same helper, so all three keys round-trip through the hermesagent.mcpServers.<name> override block.
  • Updated the Hermes MCP note in docs/reference/file-formats.md.

Not changed

Sources

Test plan

  • hermesagent-hooks.test.ts: the new events don't trigger the warning, and the pinned version appears in the warning text.
  • hermesagent-mcp.test.ts: generate writes all three cost keys and import reads them back.
  • pnpm cicheck (one unrelated timeout in shell-command-categories.test.ts under load passes when run alone)

Refs #2414

🤖 Generated with Claude Code

https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv

dyoshikawa and others added 3 commits October 22, 2026 12:18
…t keys

Add on_session_delete and post_compaction to HERMESAGENT_NATIVE_HOOK_EVENTS
(45 of the 46 VALID_HOOKS entries at Hermes Agent v0.22.3) and re-pin the
undocumented-event warning, JSDoc references and docs to v0.22.3.

Carry the per-server MCP cost keys Hermes v0.22.3 reads from
tools/mcp_tool_costs.py through generate and import: spend_limit (number),
cost_unit (string), and tool_costs as an opaque mapping. Before this, a
hand-written spend_limit was deleted on the next global generate, silently
removing the user's per-chat spend guard.

Refs #2414

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
Drop a spend_limit that is not a finite non-negative number, a cost_unit
that is blank or longer than 32 characters, and a tool_costs that is not a
mapping, with a warning, matching tools/mcp_tool_costs.py. Strip
prototype-pollution keys from tool_costs at every depth, since its values
can be objects. Thread the logger through generate and import.

Refs #2414

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
@dyoshikawa
dyoshikawa merged commit 065197d into main Oct 22, 2026
9 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-2414-hermes-2026-10-22 branch October 22, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant