How duongcoder04/hermes-agent works
Hermes Agent is a self-improving, multi-surface AI agent. A user starts a turn through the CLI/TUI or a messaging platform; the conversation loop builds context, calls a selected model, dispatches tools, and returns a response. Context compression and learning support ongoing sessions, while scheduled jobs and subagents extend work beyond a single turn. The graph combines sampled source references with README-documented capabilities; some feature wiring is documented but its implementation was not sampled, so those links cite the README.
Main entry points: conversation_loop.py Conversation loop · server.py Messaging gateway · tool_executor.py Tool execution · console_engine.py Hermes CLI
Components 28
User surfaces
- Hermes CLI
hermes_cli/console_engine.py - Terminal UI
ui-tui/src/app/turnController.ts - ACP adapter
acp_adapter/server.py - ACP command
hermes_cli/subcommands/acp.py
Agent runtime
- Conversation loop
agent/conversation_loop.py - Turn context
agent/turn_context.py - Prompt builder
agent/prompt_builder.py - Subagents
agent/subagent_lifecycle.py - Configuration
hermes_cli/config.py - Shared constants
hermes_constants.py - Data redaction
agent/redact.py - Process compatibility
hermes_cli/_subprocess_compat.py
Models and context
- Model selection
hermes_cli/model_switch.py - Model metadata
agent/model_metadata.py - Auxiliary model client
agent/auxiliary_client.py - Context compression
agent/context_compressor.py - Conversation compression
agent/conversation_compression.py - Model catalog CLI
hermes_cli/models.py
Tools and learning
- Tool execution
agent/tool_executor.py - Terminal backends
tools/environments/local.py - Large-result storage
tools/tool_result_storage.py - Agent memory
agent/memory_manager.py - Skills and learning
agent/learning_graph.py
Gateway and automation
- Messaging gateway
tui_gateway/server.py - Signal channel
gateway/platforms/signal.py - Cron scheduler
cron/scheduler_worker_env.py - Gateway status
gateway/status.py
Other components
- User
Connections 28
- User → Hermes CLI: starts a turn
- User → Terminal UI: starts a turn
- User → Messaging gateway: sends messages
- Hermes CLI → Conversation loop: runs conversation
- Terminal UI → Messaging gateway: sends turn requests
ui-tui/src/app/turnController.ts - Messaging gateway → Conversation loop: runs conversation
tui_gateway/server.py - Signal channel → Messaging gateway: carries messages
- Conversation loop → Prompt builder: builds prompt
agent/conversation_loop.py - Conversation loop → Turn context: uses turn context
agent/conversation_loop.py - Conversation loop → Model metadata: uses model metadata
agent/conversation_loop.py - Conversation loop → Tool execution: dispatches tools
- Conversation loop → Context compression: compresses context
agent/conversation_loop.py - Context compression → Auxiliary model client: requests summaries
agent/context_compressor.py - Conversation loop → Conversation compression: supports compression
agent/conversation_loop.py - Model selection → Conversation loop: selects model
- Model catalog CLI → Model metadata: lists models
- Tool execution → Terminal backends: runs commands
- Tool execution → Large-result storage: persists large output
- Conversation loop → Agent memory: uses memory
- Conversation loop → Skills and learning: creates and improves skills
- Conversation loop → Subagents: spawns subagents
- Cron scheduler → Messaging gateway: delivers scheduled jobs
- Configuration → Conversation loop: configures runtime
- Shared constants → Configuration: provides shared settings
hermes_constants.py - Data redaction → Conversation loop: sanitizes content
- Messaging gateway → Gateway status: reports status
- ACP command → ACP adapter: starts adapter
acp_adapter/server.py - Process compatibility → Hermes CLI: supports subprocesses
hermes_cli/_subprocess_compat.py