Hermes Web UI

repository·master·Indexed 12 days ago

https://github.com/nesquena/hermes-webui

A lightweight, dark-themed web interface for the Hermes Agent that provides full parity to the Hermes CLI. It enables users to interact with self-hosted autonomous agents, manage chat sessions, browse workspace files, and configure AI providers. Features include support for OIDC, Passkeys, multiple visual skins, and a dedicated daemon management script (ctl.sh).

Tokens
79K
Snippets
113
Records
337
Agent score
96%

What's inside Hermes Web UI

  1. Understand the Hermes Web UI Server Architecture

    master

    The Hermes Web UI server is built using Python's ThreadingHTTPServer. Each HTTP request is handled in its own thread. The server uses a flat routing structure (if/elif chains) within do_GET and do_POST methods rather than a routing framework.

    Key API Routes

    GET Routes:

    • /: Root
    • /health: Health check
    • /api/session: Session data
    • /api/sessions: List of sessions
    • /api/list: File listing
    • /api/chat/stream: SSE streaming endpoint
    • /api/file: File access
    • /api/approval/pending: Check for pending tool approvals
    • /api/session/worktree/status: Worktree status

    POST Routes:

    • /api/upload: File upload
    • /api/session/new: Create a new session
    • /api/session/update: Update session metadata
    • /api/session/delete: Delete a session
    • /api/chat/start: Initiate an agent chat session (returns stream_id)
    • /api/chat: Synchronous chat fallback
    • /api/approval/respond: Respond to a pending tool approval
    • /api/session/worktree/remove: Remove a worktree
  2. Access Hermes Web UI documentation

    master

    The Hermes Web UI documentation is organized into several functional categories to help you get started, customize the interface, deploy the system, or contribute to its design.

    Getting Started

    • Why Hermes: Understand the mental model and how it compares to tools like Claude Code, Cursor, or Codex.
    • Onboarding: Follow the first-run wizard, set up providers, and configure local model server Base URLs.
    • Troubleshooting: Use diagnostic flows for common failures, such as when an AIAgent is unavailable.

    Customization & Extensions

    • Themes: Learn about the theme and skin system and how to create custom themes.
    • Workspace Git: Manage Git controls within your workspace.
    • Extensions: Understand how administrators can inject WebUI extensions.

    Deployment & Operations

    • Remote Access: Configure SSH tunnels, Tailscale, or mobile access.
    • Advanced Chat Setup: Implement dynamic recall-prefill and Gateway-backed browser chat for self-hosted environments.
    • Docker: Use Docker Compose for setup and manage bind-mount migrations.
    • Process Supervision: Set up the service using launchd, systemd, supervisord, runit, or s6.
    • WSL2: Configure auto-start for Windows users via WSL2.
    • Agent Onboarding: Review safety rules and checklists for assistant-led installation support.

    Architecture & Design

    • System Design: View all API endpoints and implementation notes in the ARCHITECTURE.md file.
    • Design Principles: Explore design tokens, the 'calm-console' direction, and UI/UX principles.
    • RFCs & Contracts: Review project contracts and Request for Comments (RFCs) for architectural proposals.
  3. Understand Hermes Run Adapter Modes

    master

    Hermes supports different execution modes (adapters) that determine how agent runs are managed and where the execution state lives:

    • legacy-direct (Default): The default mode when no adapter environment variable is set. It uses the internal _start_chat_stream_for_session(...) helper directly within the WebUI process.
    • legacy-journal: A behavior-preserving mode that still delegates to the same stream-start helper but preserves the public response shape.
    • runner-local: Uses a supervised runner client. When HERMES_WEBUI_RUNNER_BASE_URL is configured, WebUI acts as a client to an external runner process. This mode moves ownership of AIAgent execution, session-to-run lookups, and terminal state recording away from the main WebUI process and into the runner/journal boundary.
  4. Implement the conversation hierarchy and trace rendering

    master

    Conversations should follow a clear visual hierarchy to maintain a 'calm developer console' feeling. Avoid rendering every internal event as a first-class chat card.

    Chat Turn Structure

    1. User message: Right-aligned, compact bubble.
    2. Assistant content: Left-aligned, prose-first (not a heavy bubble).
    3. Traces (Tool, thinking, progress, context): Quiet disclosure rows inside or adjacent to the assistant turn.
    4. Raw logs/Verbose details: Hidden until explicitly expanded.

    Rendering Tool and Activity Traces

    • Tool Cards: These are debug event rows, not chat messages. Show the icon, name, short target/preview, and status. Arguments, result snippets, and long logs must be placed behind an expansion affordance.
    • Thinking/Context Cards: Use a quiet metadata visual style that does not overpower assistant prose.
    • Activity Summaries: Should be terse (e.g., Activity: 4 tools). Do not list every tool name or add redundant badges.
    • Automatic Compression: Render as a centered, non-interactive divider with quiet horizontal rules (e.g., Compressing context or Context auto-compressed). Do not use interactive elements like carets or status dots for this.
  5. Supported surfaces for reaching Hermes

    master

    Because Hermes runs on your server, you can interact with the same agent identity and history from multiple interfaces:

    • Terminal: Via SSH.
    • Web UI: The browser-based interface.
    • Messaging Apps: Telegram, Discord, Slack, WhatsApp, Signal, and Matrix.
  6. Understand multi-container isolation and boundaries

    master

    The multi-container (two- and three-container) setups provide process, network, and resource isolation, but they do not provide full filesystem or trust isolation.

    What is isolated:

    • Process & Lifecycle: Each service has its own PID namespace. A crash in the agent does not take down the WebUI.
    • Network: The gateway API (port 8642) is bound only by the agent service. Other containers communicate via the hermes-net Docker network.
    • Resources: You can apply independent resource limits (e.g., CPU/Memory) to the agent vs. the dashboard using deploy.resources.limits.
    • Logs & Health: Restart policies and health checks are scoped per service.

    What is NOT isolated:

    • Filesystem: Both services share the hermes-home volume. The WebUI mounts the agent's source from hermes-agent-src as read-only.
    • UID/GID: Both services default to ${UID:-1000} to ensure they can read/write shared volumes. Changing these to different values will cause permission errors.
    • Trust: The WebUI runs code from the shared hermes-agent-src volume to install dependencies at startup.

    Recommendation: If you require strict filesystem isolation (e.g., you do not trust the WebUI to access agent state), run the agent on a separate host and connect the WebUI via the gateway HTTP API.

  7. Compare Hermes with Claude.ai and ChatGPT

    master

    Claude.ai and ChatGPT are powerful chat interfaces with service connectors and scheduled tasks, but they are fundamentally different from Hermes in execution and privacy.

    Key Differences:

    • Execution Environment: Claude and ChatGPT run code and shell commands in sandboxed environments (e.g., Anthropic's Cowork VM). Hermes runs with full shell and filesystem access on your own server.
    • Hosting & Privacy: Claude and ChatGPT are hosted by their respective providers. Hermes is self-hosted, meaning your memory, session history, and agent execution stay on your hardware.
    • Model Agnosticism: Hermes is provider-agnostic; Claude and ChatGPT are locked to their respective model families.
  8. Understand context auto-compression behavior

    master

    Auto Compression is a context lifecycle transition used during long-running sessions to manage context window limits. It is not a tool call or final answer content.

    Expected UI/UX behavior:

    • During live work: Display compression as a quiet, transient status.
    • After compression: Converge to a completed status such as Context auto-compressed.
    • In the settled transcript: Do not include compression status text unless it explains an error or recovery state.
    • Failure case: If compression cannot free enough space, surface compression_exhausted as a terminal outcome.
  9. Compare Hermes with OpenClaw

    master

    Hermes and OpenClaw are both open-source, self-hosted, always-on agents with persistent memory and cron scheduling.

    Key Differences:

    • Skill Acquisition: OpenClaw relies on human-authored plugins from a marketplace (ClawHub). Hermes uses a self-improving agent loop that automatically writes and saves its own skills from session experience.
    • Ecosystem: OpenClaw is built on Node.js/TypeScript; Hermes is built in Python, making it better suited for ML and data science workflows.
    • Messaging: OpenClaw has broader coverage (24+ channels including iMessage, LINE, WeChat, and Teams) compared to Hermes.
    • Control: OpenClaw provides native Chrome/Chromium control via CDP; Hermes performs control via shell and tools.
    • Security: Hermes has a smaller attack surface because it lacks a third-party marketplace like ClawHub.
  10. Understand workspace path trust levels in api/workspace.py

    master

    The Hermes Web UI implements two distinct validation mechanisms for workspace paths to balance user intent with security. When working with the workspace API, you must distinguish between the registration phase and the operational phase:

    1. Registration (validate_workspace_to_add): Used by the /api/workspaces/add endpoint. This is a permissive check. It allows users to register external paths (like WSL mounts) by only blocking paths that are non-existent, not a directory, or system root paths. This prevents circular dependencies where a path couldn't be added because it wasn't already in the trusted list.

    2. Operation (resolve_trusted_workspace): Used for actual file read/write operations within an existing workspace. This is a strict check. To prevent path traversal and unauthorized access, the path must reside under the user's home directory, be present in the saved workspace list, or be under BOOT_DEFAULT_WORKSPACE.

    // Note: These are internal logic patterns used by the workspace API
    // validate_workspace_to_add(path) -> Permissive (for registration)
    // resolve_trusted_workspace(path) -> Strict (for file I/O)
  11. Design System Overview: Hermes Calm Console

    master
    The Hermes WebUI design philosophy, known as the 'Calm Console', prioritizes conversational content over agent metadata. The goal is to provide a restrained developer interface where tool traces, thinking processes, and context compaction are treated as quiet transcript metadata rather than primary visual elements. The interface follows a 'Linear/Vercel precision' aesthetic with 'Claude-style' conversational warmth, utilizing quiet surfaces, clear spacing, and progressive disclosure for debugging details.
  12. Understand the WebUI Turn Journal concept

    master

    The Turn Journal is a write-ahead log (WAL) designed to make chat turn submissions crash-safe. It records the lifecycle of a chat turn (from user submission to assistant completion) in a durable JSONL file. This allows the system to deterministically recover or report unfinished turns after a server crash, rather than attempting to reconstruct intent from fragmented metadata like pending_user_message or .json.bak files.

    Key Lifecycle States (Turn State Machine):

    • submitted -> worker_started -> assistant_started -> completed (Terminal)
    • submitted -> interrupted (Terminal)
    • worker_started -> interrupted (Terminal)
    • assistant_started -> interrupted (Terminal)

    Note: completed and interrupted are terminal states. Recovery should not silently resume a provider call; instead, it should report or reconstruct the turn using the journaled data.