feat(agent): load global HERMES.md, AGENTS.md, and CLAUDE.md from HERMES_HOME - #12255
feat(agent): load global HERMES.md, AGENTS.md, and CLAUDE.md from HERMES_HOME#12255mhazim2 wants to merge 1 commit into
Conversation
655dbc3 to
b106437
Compare
…MES_HOME Add _load_global_hermes_md(), _load_global_agents_md(), and _load_global_claude_md() functions that load from HERMES_HOME (~/.hermes/) unconditionally after project context is assembled. Mirrors the existing SOUL.md pattern for global loading. - P1 fix: removed early return that blocked global loaders when no project context and skip_soul=True — global loaders now always run - P2 fix: empty uppercase file falls through to lowercase variant (continue instead of return on empty content) Closes: enables project-independent agent operating preferences.
b106437 to
23277df
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused implementation and coverage. The global-context goal remains a maintainer design choice: current main documents SOUL.md as the sole HERMES_HOME context file and treats AGENTS.md / CLAUDE.md as project-local (website/docs/user-guide/features/context-files.md:9-23).
Problems
- The new unconditional append duplicates a file when the launch cwd is
HERMES_HOME: normal project discovery runs first, then the added loaders read the same pathname again. Current selection is atagent/prompt_builder.py:1976-1984; the added global append has no exclusion. - The branch concatenates all three global files, so it needs an explicit precedence contract before it can align with the documented first-match project model.
Suggested changes
- Choose and document the global-context precedence model, then add path-identity deduplication and a
cwd == HERMES_HOMEregression test.
Automated hermes-sweeper review.
| if soul_content: | ||
| sections.append(soul_content) | ||
|
|
||
| # Global HERMES.md / AGENTS.md / CLAUDE.md from HERMES_HOME — always appended after project context |
There was a problem hiding this comment.
When cwd == HERMES_HOME, normal project discovery has already selected this same context path before this append block runs, so the file is injected twice. Add path-identity exclusion and a regression test for that launch directory.
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Three PRs propose persistent, non-project context files under HERMES_HOME; no underlying issue or reported defect is present in the supplied evidence. #1805 and #1812 add global AGENTS.md loading, while #12255 broadens the proposal to global HERMES.md, AGENTS.md, and CLAUDE.md loading.
Related pull requests
- #1805 [closed]
related— (+69/-14) — closed overlapping implementation: Adds HERMES_HOME/AGENTS.md before project AGENTS.md, with injection scanning, truncation, tests, and documentation. It remains relevant because its diff substantially overlaps #1812, although the supplied evidence gives no closure or supersession reason. - #1812 [closed]
related— (+104/-32) — closed after maintainer design rejection: Implements the same global AGENTS.md concept with scanning, truncation, ordering tests, and documentation, but contributor teknium1 explicitly rejected blurring the intentional SOUL.md-global versus AGENTS.md-project boundary; the non-contributor documentation concern does not override that decision. - #12255
related— (+244/-0) — keep open for design resolution and revision, not merge-ready: Extends the earlier concept to three unconditional global files and adds broad tests, but the keep_open review on #12255 identifies unresolved path-identity duplication when cwd equals HERMES_HOME and the absence of an explicit precedence contract; it also notes that adopting global context files remains a maintainer design choice.
Duplicates
#1805 and #1812 are substantially duplicate implementations of global HERMES_HOME/AGENTS.md loading. #12255 overlaps both on AGENTS.md but is broader because it also adds global HERMES.md and CLAUDE.md.
Suggested consolidation
Do not merge any PR yet. Keep #12255 as the sole active consolidation candidate only while maintainers explicitly reconsider the global-context design; before merge it must define and document precedence, deduplicate identical project/global paths, and test cwd == HERMES_HOME. #1805 and #1812 are already closed and need not be reopened; #1812 must remain closed absent an explicit resolution of teknium1's blocking design objection.
Cross-PR triage: Reviewed 3 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 32 kB of PR diffs, 9 kB of issue/PR text, 2 kB of discussion (3 comments), 1 verify verdict. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
What does this PR do?
Adds support for loading global context files (
HERMES.md,AGENTS.md,CLAUDE.md) fromHERMES_HOME(~/.hermes/) unconditionally on every session, after project context is assembled. This mirrors the existingSOUL.mdglobal loading pattern.This enables users to store project-independent agent operating preferences (e.g. orchestration model, delegation policies, preferred workflows) that survive across sessions without relying on the memory cap or skill loading.
Related Issue
Fixes #
Type of Change
Changes Made
agent/prompt_builder.py: Added_load_global_hermes_md(),_load_global_agents_md(), and_load_global_claude_md()functions. Called unconditionally at the end ofbuild_context_files_prompt()after project context is assembled.tests/agent/test_prompt_builder.py: Added 15 tests covering global context loading, injection blocking, frontmatter stripping, truncation, case priority, P1 early-return fix, and P2 empty-file fallthrough fix.Implementation Notes
return ""that blocked global loaders when no project context existed andskip_soul=True. Global loaders now always run after project context assembly.HERMES.mdwith whitespace only) falls through to lowercase variant (.hermes.md,agents.md,claude.md) viacontinueinstead ofreturn "".How to Test
~/.hermes/HERMES.md(orAGENTS.md/CLAUDE.md)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A — not a skill PR
Screenshots / Logs
N/A