Parent: #14182
Goal
Create the hermes_agent/ package by moving every source file into it and rewriting all imports. This is the biggest PR — every file moves, no logic changes. One .git-blame-ignore-revs entry.
Commit strategy
| Commit |
What |
Why |
| Commit 1 |
Pure git mv — every file moves, zero content changes |
Git sees 100% similarity, clean blame |
| Commit 2 |
Import rewrite — apply move map across all files |
Content changes only in import lines |
| Commit 3 |
Infrastructure — pyproject.toml, Dockerfile, nix, CI |
Build system points at new locations |
| Commit 4 |
Dynamic imports — string-based importlib.import_module(), __import__(), config refs |
Manual fixes for things the AST rewriter can't catch |
Move areas
Top-level modules → proper homes
| Current |
New |
Notes |
run_agent.py |
hermes_agent/agent/loop.py |
12k-line god file, move as-is |
cli.py |
hermes_agent/cli/repl.py |
11k-line REPL, move as-is |
model_tools.py |
hermes_agent/tools/dispatch.py |
Tool discovery + dispatch |
toolsets.py |
hermes_agent/tools/toolsets.py |
Named tool bundles |
toolset_distributions.py |
hermes_agent/tools/distributions.py |
Datagen distributions |
mcp_serve.py |
hermes_agent/tools/mcp/serve.py |
MCP server |
utils.py |
hermes_agent/utils.py |
Package root |
hermes_constants.py |
hermes_agent/constants.py |
Drop prefix |
hermes_state.py |
hermes_agent/state.py |
Drop prefix |
hermes_logging.py |
hermes_agent/logging.py |
Drop prefix |
hermes_time.py |
hermes_agent/time.py |
Drop prefix |
agent/ → hermes_agent/agent/ + hermes_agent/providers/
- ~48 files
- Core agent files stay in
agent/
- Transports, adapters, credentials, pricing, rate limiting →
providers/
- Context engine, compressor, references →
agent/context/
- Memory manager, provider →
agent/memory/
- Image gen provider, registry →
agent/image_gen/
tools/ → hermes_agent/tools/ + hermes_agent/backends/
- ~77 files
tools/environments/ → hermes_agent/backends/ (promoted — independent axis)
- Browser tools →
tools/browser/
- MCP tools →
tools/mcp/
- Skills tools →
tools/skills/
- Media tools →
tools/media/
- File tools →
tools/files/
- Security tools →
tools/security/
- Remaining flat tools keep
tools/ prefix, drop _tool suffix
hermes_cli/ + cli.py → hermes_agent/cli/
- ~51 files
- Auth modules →
cli/auth/
- Model modules →
cli/models/
- UI modules (banner, colors, output, skin, curses, tips, status, completion) →
cli/ui/
hermes_cli/setup.py → cli/setup_wizard.py (avoid setuptools confusion)
Other packages
| Current |
New |
gateway/* |
hermes_agent/gateway/* |
acp_adapter/* |
hermes_agent/acp/* |
cron/* |
hermes_agent/cron/* |
External consumers (import rewrites only, no moves)
tests/**/*.py
plugins/**/*.py
scripts/*.py
tui_gateway/*.py
environments/*.py (RL envs)
Infrastructure updates
pyproject.toml — entry points, packages.find, package-data
Dockerfile — COPY paths, CMD/ENTRYPOINT
docker/entrypoint.sh — Python invocations
flake.nix — source path
nix/packages.nix, nix/python.nix, nix/nixosModules.nix
.github/workflows/*.yml — test/lint paths
MANIFEST.in — include patterns
AGENTS.md / CLAUDE.md — path references
Things to discover along the way
This list will grow as we hit unknown unknowns:
Verification
python -c "import hermes_agent"
rg "^from (agent|tools|hermes_cli|gateway|cron|acp_adapter|run_agent|model_tools|toolsets|toolset_distributions|mcp_serve|hermes_constants|hermes_state|hermes_logging|hermes_time)[\. ]" hermes_agent/ tests/
pytest
hermes --help
hermes-agent --help
After this PR stabilizes
- Extract the final move map → write
scripts/migrate_imports.py
- Land migration script as a separate PR before this one merges
- Notify contributors with open PRs
Parent: #14182
Goal
Create the
hermes_agent/package by moving every source file into it and rewriting all imports. This is the biggest PR — every file moves, no logic changes. One.git-blame-ignore-revsentry.Commit strategy
git mv— every file moves, zero content changesimportlib.import_module(),__import__(), config refsMove areas
Top-level modules → proper homes
run_agent.pyhermes_agent/agent/loop.pycli.pyhermes_agent/cli/repl.pymodel_tools.pyhermes_agent/tools/dispatch.pytoolsets.pyhermes_agent/tools/toolsets.pytoolset_distributions.pyhermes_agent/tools/distributions.pymcp_serve.pyhermes_agent/tools/mcp/serve.pyutils.pyhermes_agent/utils.pyhermes_constants.pyhermes_agent/constants.pyhermes_state.pyhermes_agent/state.pyhermes_logging.pyhermes_agent/logging.pyhermes_time.pyhermes_agent/time.pyagent/ → hermes_agent/agent/ + hermes_agent/providers/
agent/providers/agent/context/agent/memory/agent/image_gen/tools/ → hermes_agent/tools/ + hermes_agent/backends/
tools/environments/→hermes_agent/backends/(promoted — independent axis)tools/browser/tools/mcp/tools/skills/tools/media/tools/files/tools/security/tools/prefix, drop_toolsuffixhermes_cli/ + cli.py → hermes_agent/cli/
cli/auth/cli/models/cli/ui/hermes_cli/setup.py→cli/setup_wizard.py(avoid setuptools confusion)Other packages
gateway/*hermes_agent/gateway/*acp_adapter/*hermes_agent/acp/*cron/*hermes_agent/cron/*External consumers (import rewrites only, no moves)
tests/**/*.pyplugins/**/*.pyscripts/*.pytui_gateway/*.pyenvironments/*.py(RL envs)Infrastructure updates
pyproject.toml— entry points, packages.find, package-dataDockerfile— COPY paths, CMD/ENTRYPOINTdocker/entrypoint.sh— Python invocationsflake.nix— source pathnix/packages.nix,nix/python.nix,nix/nixosModules.nix.github/workflows/*.yml— test/lint pathsMANIFEST.in— include patternsAGENTS.md/CLAUDE.md— path referencesThings to discover along the way
This list will grow as we hit unknown unknowns:
importlib.import_module("tools." + name))sys.modulesmanipulationVerification
After this PR stabilizes
scripts/migrate_imports.py