Skip to content

fix(agent): load gateway AGENTS.md from HERMES_HOME fallback#65800

Open
henrynguyeninfo1 wants to merge 1 commit into
NousResearch:mainfrom
henrynguyeninfo1:henrynguyeninfo1/issue-11763-agents-md-gateway
Open

fix(agent): load gateway AGENTS.md from HERMES_HOME fallback#65800
henrynguyeninfo1 wants to merge 1 commit into
NousResearch:mainfrom
henrynguyeninfo1:henrynguyeninfo1/issue-11763-agents-md-gateway

Conversation

@henrynguyeninfo1

Copy link
Copy Markdown

Summary

  • add a gateway-only fallback that loads AGENTS.md / agents.md from HERMES_HOME when the resolved gateway cwd has no project context
  • preserve existing cwd-first project context priority so CLI sessions launched from a project root keep their current behavior
  • cover gateway fallback, CLI no-fallback behavior, and missing-file no-crash behavior

Fixes #11763

Tests

  • scripts/run_tests.sh tests/agent/test_prompt_builder.py tests/agent/test_system_prompt.py -q
  • python3 scripts/check-windows-footguns.py agent/prompt_builder.py agent/system_prompt.py tests/agent/test_prompt_builder.py tests/agent/test_system_prompt.py
  • .venv/bin/ruff check agent/prompt_builder.py agent/system_prompt.py tests/agent/test_prompt_builder.py tests/agent/test_system_prompt.py

Platform tested

  • macOS (local worktree)

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Jul 16, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved (read-only token — formal approval requires write access)

Fixes the gateway to load AGENTS.md from HERMES_HOME fallback path. When the running source checkout's AGENTS.md isn't available (e.g., after a git operation), the gateway now falls back to HERMES_HOME.

  • Good fallback handling for a real edge case
  • Clean fix with clear documentation
  • No security concerns

Reviewed by Hermes Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGENTS.md not loaded in gateway mode (WeChat/Telegram/Discord) — inconsistent agent behavior across platforms

3 participants