-
-
Notifications
You must be signed in to change notification settings - Fork 132
feat: enhance Hermes Agent support #2026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dyoshikawa
merged 7 commits into
dyoshikawa:main
from
rudironsoni:feature/enhance-hermesagent-support
Jun 25, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c2c5d9
feat: enhance hermes agent support
rudironsoni 1333034
fix: address hermes e2e failures
rudironsoni 208db67
chore: update generated ignore rules
rudironsoni e3f43af
chore: format hermes support fixes
rudironsoni 24fb5d9
fix: preserve hermes mcp network timeout
rudironsoni 0fecd2e
fix: address hermes review feedback
rudironsoni 01026e4
fix: address hermes review suggestions
rudironsoni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { RULESYNC_COMMANDS_RELATIVE_DIR_PATH } from "../../constants/rulesync-paths.js"; | ||
| import { HermesagentCommand } from "./hermesagent-command.js"; | ||
| import { RulesyncCommand } from "./rulesync-command.js"; | ||
|
|
||
| describe("HermesagentCommand", () => { | ||
| it("uses rulesync command description and body when generating SKILL.md", () => { | ||
| const rulesyncCommand = new RulesyncCommand({ | ||
| relativeDirPath: RULESYNC_COMMANDS_RELATIVE_DIR_PATH, | ||
| relativeFilePath: `${RULESYNC_COMMANDS_RELATIVE_DIR_PATH}/review.md`, | ||
| frontmatter: { | ||
| description: "Review the current changes", | ||
| }, | ||
| body: "Review the diff carefully.", | ||
| fileContent: "", | ||
| }); | ||
|
|
||
| const command = HermesagentCommand.fromRulesyncCommand({ | ||
| outputRoot: ".", | ||
| rulesyncCommand, | ||
| }); | ||
|
|
||
| expect(command.getFileContent()).toContain("description: Review the current changes"); | ||
| expect(command.getFileContent()).toContain("Review the diff carefully."); | ||
| expect(command.getFileContent()).not.toContain("targets:"); | ||
| }); | ||
|
|
||
| it("strips Hermes skill frontmatter when importing back to rulesync command", () => { | ||
| const command = new HermesagentCommand({ | ||
| relativeDirPath: ".hermes/skills/review", | ||
| relativeFilePath: "SKILL.md", | ||
| fileContent: [ | ||
| "---", | ||
| "name: review", | ||
| "description: Review the current changes", | ||
| "---", | ||
| "", | ||
| "Review the diff carefully.", | ||
| "", | ||
| ].join("\n"), | ||
| }); | ||
|
|
||
| const rulesyncCommand = command.toRulesyncCommand(); | ||
|
|
||
| expect(rulesyncCommand.getFrontmatter().description).toBe("Review the current changes"); | ||
| expect(rulesyncCommand.getBody()).toBe("Review the diff carefully.\n"); | ||
| expect(rulesyncCommand.getBody()).not.toContain("---"); | ||
| }); | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import { basename, dirname, join } from "node:path"; | ||
|
|
||
| import { HERMESAGENT_SKILLS_DIR_PATH } from "../../constants/hermesagent-paths.js"; | ||
| import { RULESYNC_COMMANDS_RELATIVE_DIR_PATH } from "../../constants/rulesync-paths.js"; | ||
| import { type AiFileParams, ValidationResult } from "../../types/ai-file.js"; | ||
| import { parseFrontmatter, stringifyFrontmatter } from "../../utils/frontmatter.js"; | ||
| import { RulesyncCommand } from "./rulesync-command.js"; | ||
| import { ToolCommand, type ToolCommandFromRulesyncCommandParams } from "./tool-command.js"; | ||
|
|
||
| const SKILL_FILE_NAME = "SKILL.md"; | ||
|
|
||
| type HermesagentCommandParams = AiFileParams & { | ||
| slug?: string; | ||
| }; | ||
|
|
||
| function commandSlug(relativeFilePath: string): string { | ||
| return basename(relativeFilePath, ".md").replace(/[^a-zA-Z0-9_-]/g, "-"); | ||
| } | ||
|
|
||
| function commandSkillContent(rulesyncCommand: RulesyncCommand): string { | ||
| const slug = commandSlug(rulesyncCommand.getRelativeFilePath()); | ||
| const description = rulesyncCommand.getFrontmatter().description ?? `${slug} command`; | ||
|
|
||
| return stringifyFrontmatter(rulesyncCommand.getBody().trim(), { | ||
| name: slug, | ||
| description, | ||
| }); | ||
| } | ||
|
|
||
| export class HermesagentCommand extends ToolCommand { | ||
| static override isTargetedByRulesyncCommand(rulesyncCommand: RulesyncCommand): boolean { | ||
| const targets = rulesyncCommand.getFrontmatter().targets; | ||
|
|
||
| return !targets || targets.includes("*") || targets.includes("hermesagent"); | ||
| } | ||
|
|
||
| static getSettablePaths({ slug = "command" }: { slug?: string; global?: boolean } = {}) { | ||
| return { | ||
| relativeDirPath: join(HERMESAGENT_SKILLS_DIR_PATH, slug), | ||
| relativeFilePath: SKILL_FILE_NAME, | ||
| }; | ||
| } | ||
|
|
||
| constructor({ slug, ...params }: HermesagentCommandParams) { | ||
| const resolvedSlug = | ||
| slug ?? basename(dirname(params.relativeDirPath)) ?? commandSlug(params.relativeFilePath); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| super({ | ||
| ...params, | ||
| ...HermesagentCommand.getSettablePaths({ slug: resolvedSlug }), | ||
| }); | ||
| } | ||
|
|
||
| validate(): ValidationResult { | ||
| return { success: true, error: null }; | ||
| } | ||
|
|
||
| toRulesyncCommand(): RulesyncCommand { | ||
| const slug = basename(dirname(this.getRelativePathFromCwd())); | ||
| const { frontmatter, body } = parseFrontmatter(this.getFileContent(), this.getFilePath()); | ||
| const description = | ||
| typeof frontmatter.description === "string" ? frontmatter.description : undefined; | ||
|
|
||
| return new RulesyncCommand({ | ||
| relativeDirPath: RULESYNC_COMMANDS_RELATIVE_DIR_PATH, | ||
| relativeFilePath: `${slug}.md`, | ||
| frontmatter: { description }, | ||
| body: body.trimStart(), | ||
| } as ConstructorParameters<typeof RulesyncCommand>[0]); | ||
| } | ||
|
|
||
| static override fromRulesyncCommand({ | ||
| outputRoot, | ||
| rulesyncCommand, | ||
| }: ToolCommandFromRulesyncCommandParams): HermesagentCommand { | ||
| return new HermesagentCommand({ | ||
| outputRoot, | ||
| relativeDirPath: "", | ||
| relativeFilePath: SKILL_FILE_NAME, | ||
| slug: commandSlug(rulesyncCommand.getRelativeFilePath()), | ||
| fileContent: commandSkillContent(rulesyncCommand), | ||
| }); | ||
| } | ||
| getFileContent(): string { | ||
| return this.fileContent; | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { parseHermesConfig } from "./hermes-config.js"; | ||
|
|
||
| describe("parseHermesConfig", () => { | ||
| it("returns empty config for non-object YAML roots", () => { | ||
| expect(parseHermesConfig("- item")).toEqual({}); | ||
| }); | ||
|
|
||
| it("drops prototype-pollution keys recursively", () => { | ||
| const config = parseHermesConfig(` | ||
| model: hermes-3 | ||
| __proto__: | ||
| polluted: true | ||
| mcp_servers: | ||
| docs: | ||
| url: https://example.com/mcp | ||
| constructor: | ||
| polluted: true | ||
| plugins: | ||
| enabled: | ||
| - rulesync-subagents | ||
| prototype: | ||
| polluted: true | ||
| `); | ||
|
|
||
| expect(config).toEqual({ | ||
| model: "hermes-3", | ||
| mcp_servers: { | ||
| docs: { | ||
| url: "https://example.com/mcp", | ||
| }, | ||
| }, | ||
| plugins: { | ||
| enabled: ["rulesync-subagents"], | ||
| }, | ||
| }); | ||
| expect(({} as Record<string, unknown>).polluted).toBeUndefined(); | ||
| }); | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { dump, load } from "js-yaml"; | ||
|
|
||
| import { | ||
| omitPrototypePollutionKeys, | ||
| PROTOTYPE_POLLUTION_KEYS, | ||
| } from "../utils/prototype-pollution.js"; | ||
| import { isPlainObject } from "../utils/type-guards.js"; | ||
|
|
||
| type HermesConfig = Record<string, unknown>; | ||
|
|
||
| function sanitizeHermesConfigValue(value: unknown): unknown { | ||
| if (Array.isArray(value)) { | ||
| return value.map(sanitizeHermesConfigValue); | ||
| } | ||
|
|
||
| if (!isPlainObject(value)) { | ||
| return value; | ||
| } | ||
|
|
||
| const sanitized = omitPrototypePollutionKeys(value); | ||
| const result: Record<string, unknown> = {}; | ||
|
|
||
| for (const [key, nestedValue] of Object.entries(sanitized)) { | ||
| if (PROTOTYPE_POLLUTION_KEYS.has(key)) continue; | ||
| result[key] = sanitizeHermesConfigValue(nestedValue); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| export function parseHermesConfig(fileContent: string): HermesConfig { | ||
| if (!fileContent.trim()) { | ||
| return {}; | ||
| } | ||
|
|
||
| const parsed = load(fileContent); | ||
|
|
||
| if (isPlainObject(parsed)) { | ||
| return sanitizeHermesConfigValue(parsed) as HermesConfig; | ||
| } | ||
|
|
||
| return {}; | ||
| } | ||
|
|
||
| export function stringifyHermesConfig(config: HermesConfig): string { | ||
| return dump(config, { noRefs: true, sortKeys: false }).trimEnd() + "\n"; | ||
| } | ||
|
|
||
| export function mergeHermesConfig(fileContent: string, patch: HermesConfig): string { | ||
| return stringifyHermesConfig({ | ||
| ...parseHermesConfig(fileContent), | ||
| ...patch, | ||
| }); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HERMESAGENT_CONFIG_FILE_NAMEandHERMESAGENT_MCP_FILE_NAMEare both"config.yaml". Two constants for the same value invites drift — consider collapsing to one.