feat(agent): .hermes.md per-repository project config#1200
Closed
ch3ronsa wants to merge 1 commit intoNousResearch:mainfrom
Closed
feat(agent): .hermes.md per-repository project config#1200ch3ronsa wants to merge 1 commit intoNousResearch:mainfrom
ch3ronsa wants to merge 1 commit intoNousResearch:mainfrom
Conversation
Add support for `.hermes.md` / `HERMES.md` project configuration files that define per-repository rules and context for the agent — similar to CLAUDE.md in Claude Code and .cursorrules in Cursor. Discovery walks from CWD up to the git root, loading the nearest match. YAML frontmatter is stripped (body only is injected into the system prompt). Content passes through the existing injection scanner. New helpers: - _find_hermes_md() — nearest-first upward discovery - _find_git_root() — locate repo boundary - _strip_yaml_frontmatter() — remove structured config block 22 new tests covering discovery, priority, parent walking, git root boundary, frontmatter stripping, injection blocking, and coexistence with AGENTS.md/.cursorrules/SOUL.md. Closes NousResearch#681 (Phase 1 — discovery & injection)
Contributor
|
Merged via PR #1712. Your .hermes.md discovery implementation was cherry-picked onto current main with authorship preserved — all 22 tests pass cleanly. Great work on the design (nearest-first discovery, git root boundary, YAML frontmatter stripping, injection scanning). Phase 2 (frontmatter parsing for model/tool overrides) can follow up separately. |
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
.hermes.md/HERMES.mdper-repository project configuration — the #1 most requested UX pattern from the competitor analysis in #681. Every major AI coding agent has this (Claude Code'sCLAUDE.md, Cursor's.cursorrules, Windsurf's.windsurfrules). Hermes now has it too.When the agent starts a session, it discovers the nearest
.hermes.mdand injects its contents into the system prompt as project context — eliminating the need to re-explain project conventions every session.How it works
Example
.hermes.md:Changes
Modified:
agent/prompt_builder.py— 3 new helper functions + integration intobuild_context_files_prompt()_find_hermes_md(cwd).hermes.mdorHERMES.md_find_git_root(start)_strip_yaml_frontmatter(content)---delimited YAML block (structured config for future PR)Modified:
tests/agent/test_prompt_builder.py— 22 new testsDesign decisions
build_context_files_prompt()— same pattern as AGENTS.md and .cursorrules discovery. No new code paths..hermes.mdpreferred overHERMES.md— dotfile convention (hidden by default), uppercase as fallback_scan_context_content()protection as all other context files_truncate_content()limit as AGENTS.mdScope (Phase 1)
This PR covers discovery & injection only. Future PRs can add:
.hermesignorefor file/dir exclusion/projectslash command to view/reload configTest plan
.hermes.mdandHERMES.mddiscovery_find_hermes_md,_find_git_root,_strip_yaml_frontmatter.hermes.mdin a repo, runhermes chat, verify rules appear in contextCloses #681 (Phase 1)