How m0at/hermes-lite works
hermes-lite is a local-first coding agent with CLI and native Rust TUI entry points. Its main workflow accepts a prompt, builds and sends model context, interprets the response, dispatches tools, and returns results; the TUI can run multiple Python agents through a subprocess protocol. Separate branches provide persistent sessions, shared memory, skills, terminal backends, and Rust-assisted loop control. README statements establish the product-level workflows; source excerpts and the index support selected implementation links, so unsampled subsystem internals are represented conservatively.
Main entry points: run_agent.py Agent loop · main.rs Native TUI · terminal_tool.py Terminal execution · hermes_agent.py Hermes agent
Components 25
User interfaces
- CLI and REPL
src/cli.py - CLI entry
src/hermes_cli/main.py - Native TUI
hermes_tui/src/main.rs - Pane state
hermes_tui/src/app.rs - TUI rendering
hermes_tui/src/ui.rs - Mentions and routing
hermes_tui/src/mention.rs - Agent subprocess
hermes_tui/src/subprocess.rs - JSON protocol
hermes_tui/src/protocol.rs
Agent runtime
- Hermes agent
src/hermes_agent.py - Agent loop
src/run_agent.py - FSM loop driver
src/agent/loop_driver.py - Prompt building
src/agent/prompt_builder.py - Context compression
src/agent/context_compressor.py - Tool-call parsing
src/agent/tool_call_parser.py - Model service
Tools and integrations
- Tool registry
src/tools/registry.py - Terminal execution
src/tools/terminal_tool.py - Terminal backends
src/tools/environments - File operations
src/tools/file_operations.py - Persistent memory
src/tools/memory_tool.py - Skills system
src/tools/skill_tools.py
State and Rust
- Rust FSM
hermes_rs/src/lib.rs - Session database
hermes_rs/src/session_db.rs - Shared memory files
Other components
- User
Connections 25
- User → CLI entry: starts chat
README.md - CLI entry → CLI and REPL: starts REPL
src/hermes_cli/main.py - User → Native TUI: starts TUI
README.md - Native TUI → Pane state: updates panes
hermes_tui/src/main.rs - TUI rendering → Pane state: renders state
hermes_tui/src/ui.rs - Native TUI → Mentions and routing: routes mentions
README.md - Native TUI → Agent subprocess: spawns agents
README.md - Native TUI → JSON protocol: exchanges JSON
README.md - Agent subprocess → Hermes agent: runs process
README.md - CLI and REPL → Hermes agent: starts agent
src/hermes_agent.py - Hermes agent → Agent loop: extends runner
src/hermes_agent.py - Agent loop → FSM loop driver: uses loop driver
README.md - FSM loop driver → Rust FSM: drives states
README.md - Agent loop → Prompt building: builds context
src/run_agent.py - Agent loop → Model service: requests completion
README.md - Agent loop → Context compression: compresses context
src/run_agent.py - Agent loop → Tool-call parsing: parses calls
src/run_agent.py - Agent loop → Tool registry: dispatches tools
src/run_agent.py - Tool registry → Terminal execution: registers tool
src/tools/terminal_tool.py - Terminal execution → Terminal backends: selects backend
src/tools/terminal_tool.py - Terminal execution → File operations: uses file tools
src/tools/terminal_tool.py - Agent loop → Persistent memory: provides memory
README.md - Agent loop → Skills system: offers skills
README.md - Agent loop → Session database: stores sessions
src/run_agent.py - Persistent memory → Shared memory files: reads and writes
README.md