Reading order#
Hermes decomposes former “god files” into a facade plus topical siblings. Reading the facade first is the expensive way.
Habit#
- Name the topic you care about (overflow, slash command, MCP discovery, …)
- Search siblings:
agent/turn_*.py,gateway/run_*.py,hermes_cli/cli_*_mixin.py - Open the matching sibling; only then skim the facade for public entry points
Example: turn overflow lives under agent/turn_overflow*.py (and related), not as a mystery buried only in run_agent.py.
Facade vs loop#
| You open… | You actually get… |
|---|---|
run_agent.py | AIAgent public surface, mixins assembly, constructors |
agent/conversation_loop.py | The turn while loop |
agent/turn_*.py | One phase per file (API call, tools, compression, recovery, …) |
AIAgent.run_conversation forwards into the conversation loop after taking a session turn lease.
Patch where production reads#
Siblings often late-import names from the facade inside functions so tests can monkeypatch the facade attribute. Patching only the defining module can silently miss the call site.
Recommended tour sequence#
tools/registry.py
→ toolsets.py
→ model_tools.py
→ agent/conversation_loop.py (+ skim turn_*.py names)
→ run_agent.py (facade only)
→ agent/prompt_builder.py
→ gateway/run.py (facade) + one run_*.py of interest
→ hermes_cli/commands.pyThat order matches the real import/dependency story: tools exist before agents call them.
Anti-patterns while reading#
- Treating line counts in a facade as “where the logic is”
- Grepping only
run_agent.pyfor behavior that lives inturn_*.py - Assuming
website/docs mirror today’s file names without checking — preferAGENTS.mdrouting tables
Next#
Further reading#
- Root
AGENTS.md§ Facade + siblings evals/codebase_navigability/— metrics for file/function distributionswebsite/docs/developer-guide/architecture.md— recommended reading order