Repository navigation
feat(hermesagent): track Hermes Agent v0.22.3 hook events and MCP cost keys - #3589
Merged
Merged
Conversation
…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
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
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
Follows the gaps listed in the 2026-10-22 re-check comment on #2414 (Hermes Agent v0.22.3).
Hooks: two new
VALID_HOOKSeventsVALID_HOOKSinhermes_cli/plugins.pygrew from 44 to 46 entries at v0.22.3:on_session_delete(fires after a session delete or archive commits) andpost_compaction(fires once per committed compaction, NousResearch/hermes-agent#118382). Both are observers and allowed as shell hooks (SHELL_UNSUPPORTED_HOOKSis still onlytransform_api_error_classification).HERMESAGENT_NATIVE_HOOK_EVENTS(now 45 of 46).@seelinks,docs/reference/file-formats.mdand the compatibility note indocs/reference/supported-tools.mdto v0.22.3.MCP (global):
tool_costs,spend_limit,cost_unitv0.22.3 documents these per-server keys in
mcp-config-reference.md, andtools/mcp_tool_costs.pyreads them (CONFIG_KEYS = ("tool_costs", "spend_limit", "cost_unit")).copyHermesAdvancedFieldsis an allowlist, so they could not be authored, and a hand-writtenspend_limitwas dropped on the next global generate. That silently removed the user's per-chat spend guard.spend_limit(number) andcost_unit(string) are copied verbatim. They join the existing typed-scalar table next toidle_timeout_seconds/max_lifetime_seconds, which keeps the function under the complexity limit.tool_costsis added toHERMES_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}.hermesagent.mcpServers.<name>override block.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 inshell-command-categories.test.tsunder load passes when run alone)Refs #2414
🤖 Generated with Claude Code
https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv