How Working Directory Affects Hermes | Generated by AI

Home 2026.05

Good question. Here’s how working directory actually affects Hermes:

The mechanism: TERMINAL_CWD

When you launch hermes from a directory, that directory becomes TERMINAL_CWD — an env var that every tool reads. It’s the base for:

  1. Terminal commandsbash commands run with cwd=TERMINAL_CWD (terminal_tool.py:1033)
  2. File operationsread_file, write_file, search_files resolve relative paths against it (file_tools.py:122-126)
  3. execute_code — Python scripts run in TERMINAL_CWD by default (code_execution_tool.py:1230)
  4. Context files — AGENTS.md, CLAUDE.md, .cursorrules loaded from cwd
  5. Subagent delegation — child agents inherit the parent’s cwd

For search/grep specifically:

The search_files tool uses ripgrep (rg). When you pass a relative path like . or src/, it resolves against TERMINAL_CWD. When you pass an absolute path, it searches that directly. Ripgrep is extremely fast (~10x faster than grep), so the directory size barely matters for normal project sizes. A 100K-file monorepo still searches in milliseconds.

The real impacts are:

Does it slow things down?

No meaningful impact on grep/search speed. Ripgrep is I/O-bound and blazing fast. The only scenario where cwd matters for performance is if you accidentally launch from $HOME or / — then search_files with a relative path could traverse your entire filesystem. But that’s a user error, not a Hermes design issue.

TL;DR: Cwd affects what context and paths Hermes works with, not how fast it runs. Launch from your project root and everything is fine.


Generated by AI. Curating and sharing still takes effort. If you find it useful, feel free to donate. WeChat: @lzwjavaWeChat QR · X: @lzwjava · Say hi 👋

Back Donate