Skip to content

restructure PR 6: move agent/ + leaf modules → hermes_agent/agent/ + hermes_agent/providers/ #14591

@alt-glitch

Description

@alt-glitch

Parent: #14182
Depends on: #14590 (PR 5)

Goal

The final move PR. Moves the agent core, extracts providers from agent/transports/ + adapter files, and relocates the 6 leaf modules that everything imports. After this PR, no Python source lives outside hermes_agent/ (except tui_gateway/, environments/, and tests/).

What moves (~59 files)

Providers (extracted from agent/)

  • agent/transports/*.pyhermes_agent/providers/*.py (7 files)
  • agent/*_adapter.pyhermes_agent/providers/*.py (6 files)
  • Provider infrastructure (credentials, pricing, rate limiting, etc.) → hermes_agent/providers/ (12 files)

Agent core

  • agent/*.pyhermes_agent/agent/*.py (flat files stay flat)
  • agent/context_engine.pyhermes_agent/agent/context/engine.py
  • agent/context_compressor.pyhermes_agent/agent/context/compressor.py
  • agent/context_references.pyhermes_agent/agent/context/references.py
  • agent/memory_manager.pyhermes_agent/agent/memory/manager.py
  • agent/memory_provider.pyhermes_agent/agent/memory/provider.py
  • agent/image_gen_*.pyhermes_agent/agent/image_gen/*.py

Leaf modules

  • run_agent.pyhermes_agent/agent/loop.py
  • hermes_constants.pyhermes_agent/constants.py
  • hermes_state.pyhermes_agent/state.py
  • hermes_logging.pyhermes_agent/logging.py
  • hermes_time.pyhermes_agent/time.py
  • utils.pyhermes_agent/utils.py

__init__.py re-exports (included in this PR)

Re-exports for: hermes_agent/ (top-level), agent/, agent/context/, agent/memory/, agent/image_gen/, providers/

Also UPDATES earlier empty __init__.py files from PRs 1-3: acp/, cron/, gateway/

Known gotchas

  • Widest fan-out. ~265 prod refs for agent, ~330 for leaf modules — rewrites touch every previously-moved package.
  • Transport discovery: _discover_transports() must scan hermes_agent/providers/*_transport.py.
  • Logger COMPONENT_PREFIXES: Update all prefixes in hermes_agent/logging.py.
  • 4 test files with dynamic plugin code: String-based old-style imports in write_text() calls (see manifest for exact locations).
  • sys.path hacks: Strip from all remaining production files (~20+) and test files (~20).
  • tests/conftest.py: Replace sys.path hack with ImportError guard.
  • logging.py and time.py shadow stdlib names: Safe with absolute imports but worth noting.

pyproject.toml — final form

[project.scripts]
hermes = "hermes_agent.cli.main:main"
hermes-agent = "hermes_agent.agent.loop:main"
hermes-acp = "hermes_agent.acp.entry:main"
hermes-skills-sync = "hermes_agent.tools.skills.sync:main"

[tool.setuptools.packages.find]
include = ["hermes_agent", "hermes_agent.*", "tui_gateway", "tui_gateway.*"]

Delete after moves

run_agent.py, cli.py, hermes_constants.py, hermes_state.py,
hermes_logging.py, hermes_time.py, utils.py, agent/, tools/

Verification

rg "^from (agent|run_agent|hermes_constants|hermes_state|hermes_logging|hermes_time|utils)[\. ]" --type py
rg "^import (agent|run_agent|hermes_constants|hermes_state|hermes_logging|hermes_time|utils)\b" --type py
pytest
hermes --help && hermes-agent --help && hermes-acp --help

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildertype/refactorCode restructuring, no behavior change

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions