Merge pull request #2891 from NousResearch/hermes/hermes-gateway-context

fix(gateway): stop loading hermes repo AGENTS.md into gateway sessions (~10k wasted tokens)
This commit is contained in:
Teknium
2026-03-24 17:43:41 -07:00
committed by GitHub

View File

@@ -2361,7 +2361,13 @@ class AIAgent:
prompt_parts.append(skills_prompt)
if not self.skip_context_files:
context_files_prompt = build_context_files_prompt(skip_soul=_soul_loaded)
# Use TERMINAL_CWD for context file discovery when set (gateway
# mode). The gateway process runs from the hermes-agent install
# dir, so os.getcwd() would pick up the repo's AGENTS.md and
# other dev files — inflating token usage by ~10k for no benefit.
_context_cwd = os.getenv("TERMINAL_CWD") or None
context_files_prompt = build_context_files_prompt(
cwd=_context_cwd, skip_soul=_soul_loaded)
if context_files_prompt:
prompt_parts.append(context_files_prompt)