The self-improving AI agent built by Nous Research
github.com/NousResearch/hermes-agent — 9.6k stars — MIT License — v0.3.0
What is Hermes Agent and why should you care?
Imagine a personal AI assistant that lives on your computer, learns from every conversation, and gets better at helping you over time.
Most AI chatbots forget everything when you close the window. Hermes Agent has a closed learning loop:
"Fix the auth bug in my API and deploy it"
Reads code, runs tests, debugs, commits, deploys
Next time, it already knows the approach
Your deploy workflow, coding style, preferred tools
Hermes Agent isn't just a terminal tool. It's one brain, many interfaces:
| Interface | How It Works |
|---|---|
| Terminal (CLI) | Full TUI, autocomplete, streaming |
| Telegram | Chat + voice notes + photos |
| Discord | Server bot, threads, voice channels |
| Slack | Workspace integration + threads |
| WhatsApp / Signal | Encrypted messaging |
| IDE (VS Code, Zed) | Editor agent via ACP |
Same memory, same skills, same personality. Ask it something on Telegram at lunch, pick up where you left off in the terminal at your desk.
OpenRouter (200+ models), Anthropic, OpenAI, Nous Portal, custom endpoints. Switch with one command.
Architecture, code patterns, and technical details
| Metric | Value |
|---|---|
| Stars | 9,611 |
| Forks | 1,176 |
| Contributors | 153+ |
| Commits | 2,406 |
| Language | Python (91.6%) |
| License | MIT |
| Latest Release | v0.3.0 (Mar 17, 2026) |
| Created | July 22, 2025 |
agent/ Core agent loop + prompt assembly tools/ 50+ tool implementations gateway/ Multi-platform messaging skills/ Skill categories (25+ domains) cron/ Scheduled job execution environments/ RL + sandbox backends hermes_cli/ CLI TUI + commands honcho_integration/ Cross-session memory tinker-atropos/ RL training (submodule)
The system is organized around a central AIAgent class that orchestrates everything:
Interfaces Core Backends ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ CLI (TUI) │ │ │ │ Local shell │ │ Telegram │ │ │ │ Docker │ │ Discord │──────▶ │ AIAgent │──▶ │ SSH │ │ Slack │ │ + ToolRegistry │ │ Daytona │ │ WhatsApp/Signal │ │ + MemoryStore │ │ Singularity │ │ IDE (ACP) │ │ + SkillIndex │ │ Modal │ └──────────────────┘ └──────────────────┘ └──────────────────┘ │ ┌───────┴────────┐ │ LLM Providers │ │ OpenRouter │ │ Anthropic │ │ OpenAI │ │ Nous Portal │ │ Custom │ └────────────────┘
The core loop in run_agent.py drives multi-turn conversations with tool calling:
# Simplified agent loop while not done: # 1. Build system prompt system = build_system_prompt( identity, memory, skills, context_files ) # 2. Call LLM with tools response = call_llm( messages, tools, system ) # 3. Execute tool calls (parallel when safe) if response.tool_calls: results = execute_tools( response.tool_calls, parallel=is_parallel_safe(calls) ) messages.extend(results) else: done = True # Natural stop # 4. Compress if needed if should_compress(messages): messages = compress_context(messages)
agent/prompt_builder.py constructs the system prompt from layered sources:
# System prompt layers (in order) 1. Identity SOUL.md (custom persona) or DEFAULT_AGENT_IDENTITY 2. Platform Hint "You are on Telegram..." "You are a CLI agent..." 3. Memory Snapshot MEMORY.md (agent notes) USER.md (user profile) 4. Skills Index All available skills by category <available_skills> block 5. Context Files (priority order) .hermes.md > AGENTS.md > CLAUDE.md > .cursorrules 6. Behavioral Guidance Memory, session search, skills
Every context file is scanned before injection:
Memory writes update files on disk immediately but do NOT change the system prompt mid-session. The snapshot is frozen at session start to preserve the Anthropic prefix cache.
Persistent, bounded, file-backed memory in tools/memory_tool.py:
Priority rule: User preferences and corrections > environment facts > procedural knowledge. The most valuable memory prevents repeating yourself.
Skills are reusable approaches the agent creates from experience (tools/skill_manager_tool.py):
# Skill directory structure ~/.hermes/skills/ my-deploy-skill/ SKILL.md # YAML frontmatter + instructions references/ # Supporting docs templates/ # Reusable templates scripts/ # Automation scripts assets/ # Other files data-science/ # Category grouping pandas-etl/ SKILL.md # SKILL.md frontmatter --- name: my-deploy-skill description: Deploy Node.js apps to fly.io metadata: hermes: requires_toolsets: [terminal, file] fallback_for_tools: [docker] --- # Step-by-step instructions...
apple, data-science, gaming, github, media, mlops, music, productivity, research, smart-home, software-dev...
SQLite FTS5 full-text search over all past conversations (tools/session_search_tool.py):
Memory stores facts. Session search recovers context. When a user says "remember that deploy issue last week?", the agent searches past transcripts instead of asking the user to repeat themselves.
Parent-session resolution follows delegation chains, so subagent work is searchable from the parent session context.
Tools are organized into composable toolsets via toolsets.py:
| Category | Tools |
|---|---|
| Terminal | terminal, process |
| File | read_file, write_file, patch, search_files |
| Web | web_search, web_extract |
| Browser | 11 browser_* tools (CDP) |
| Vision | vision_analyze, image_generate |
| Memory | memory, session_search |
| Skills | skills_list, skill_view, skill_manage |
| Scheduling | cronjob (CRUD) |
| Delegation | delegate_task |
| Code | execute_code (Python sandbox) |
| Advanced | mixture_of_agents, clarify, todo |
# Composite toolsets "debugging": ["web", "file"] "safe": ["web", "vision", "image_gen"] # Platform toolsets use ALL core tools "hermes-cli": _HERMES_CORE_TOOLS "hermes-telegram": _HERMES_CORE_TOOLS "hermes-discord": _HERMES_CORE_TOOLS # Meta toolset "hermes-gateway": [all platforms]
Tools self-register via tools/registry.py with schema, handler function, requirement checks, and emoji metadata.
tools/terminal_tool.py supports running commands in six different backends:
| Backend | Use Case |
|---|---|
| Local | Direct host execution, persistent shell |
| Docker | Containerized with resource limits |
| SSH | Remote host execution with preflight |
| Daytona | Cloud dev environments via API |
| Singularity | HPC/scientific computing containers |
| Modal | Serverless cloud sandboxes |
agent/context_compressor.py automatically manages conversation length:
# Context window management ┌─────────────────────────────────┐ │ Protected head (first 3 turns) │ │ System prompt, initial context │ ├─────────────────────────────────┤ │ │ │ Compressible middle │ │ Summarized by auxiliary LLM │ │ → 2,500 token target summary │ │ │ ├─────────────────────────────────┤ │ Protected tail (last 4 turns) │ │ Recent context, active work │ └─────────────────────────────────┘ # Trigger: 50% of context limit used
tools/delegate_tool.py spawns isolated child agents for parallel work:
# Example: parallel research delegate_task( tasks=[ {"goal": "Research React 19 changes"}, {"goal": "Audit our auth module"}, {"goal": "Write migration tests"} ], toolsets=["terminal", "file", "web"] ) # Returns per-task results: { "results": [ {"status": "success", "summary": "...", "api_calls": 12, "duration": "45.2s", "tool_trace": [...]}, ... ], "total_duration": "52.1s" }
gateway/ provides a unified bridge between messaging platforms and the agent core:
# Gateway architecture GatewayRunner # Lifecycle management ├── platforms/ # Platform adapters │ ├── telegram # Long-polling + webhook │ ├── discord # Bot + voice channels │ ├── slack # Thread-aware integration │ ├── whatsapp # Bridge protocol │ ├── signal # E2E encrypted │ ├── email # IMAP + SMTP │ └── sms # Plain text (1600 char) ├── session.py # Per-user/group isolation ├── delivery.py # Route responses to platforms ├── hooks.py # Pre/post message processing └── stream_consumer.py # Real-time streaming
The gateway background thread calls cron.tick() every 60 seconds to execute scheduled jobs.
cron/scheduler.py runs jobs autonomously on a schedule:
Telegram, Discord, Slack, WhatsApp, Signal, Matrix, Mattermost, Home Assistant, DingTalk, Email, SMS
# Natural language cron job cronjob( "Every morning at 8am, check my GitHub notifications and summarize them", schedule="0 8 * * *", deliver="telegram" ) # Silent execution (no delivery) # Agent responds with [SILENT] # Output saved locally only # The cron prompt includes: # "You are running as a scheduled # cron job. There is no user # present -- execute fully and # autonomously."
Security is woven through every layer of the system:
tools/skills_guard.py scans skills across 8 threat categories:
| Category | Examples Detected |
|---|---|
| Exfiltration | curl with $TOKEN, cat .env, DNS exfil |
| Injection | Role hijack, instruction override |
| Destructive | rm -rf /, chmod 777, disk format |
| Persistence | Cron mods, shell rc files, systemd |
| Network | Reverse shells, tunneling, /dev/tcp |
| Obfuscation | base64 decode pipes, eval/exec |
| Privilege | sudo, setuid/setgid, sudoers |
| Credentials | Embedded API keys, private keys |
# Trust level x Verdict → Action safe caution dangerous builtin: allow allow allow trusted: allow allow block community: allow block block agent-made: allow allow block
safe = no findings. caution = high severity matches. dangerous = critical severity findings. LLM audit can only raise severity, never lower it.
The centralized provider router supports switching models with zero code changes:
| Provider | Notes |
|---|---|
| OpenRouter | 200+ models, primary default |
| Anthropic | Native API + prompt caching |
| OpenAI | GPT-5.x with reasoning support |
| Nous Portal | Nous Research's own endpoint |
| z.ai / GLM | Chinese model providers |
| Kimi / Moonshot | Long-context models |
| MiniMax | Anthropic-compatible API |
| Vercel AI Gateway | New in v0.3.0 |
| Custom endpoints | Any OpenAI-compatible URL |
# Switch models instantly $ hermes model # or in chat: /model anthropic:claude-4-sonnet
Hermes Agent is designed for model training, not just usage:
environments/ agent_loop.py # HermesAgentLoop hermes_base_env.py # Base RL environment agentic_opd_env.py # On-Policy Distillation web_research_env.py# Web research tasks hermes_swe_env/ # SWE-bench environment terminal_test_env/ # Terminal testing benchmarks/ # Evaluation suites
On-Policy Distillation environment for training agent policies within the expanded tinker-atropos ecosystem. The agent generates its own training data from real usage.
environments/agent_loop.py is a reusable multi-turn engine for RL environments:
class HermesAgentLoop: # Works with VLLM, SGLang, OpenRouter, # ManagedServer implementations def __init__(self, server, tool_schemas, valid_tool_names, max_turns=30, temperature=1.0): ... async def run(self, messages, handle_fn): # Per-turn: API call → parse → execute # → track errors → check termination # Fallback parsing for raw tool tags # when structured calls unavailable # Returns AgentResult with: # - messages, turns, reasoning # - tool_errors, natural_stop # - managed_state return AgentResult(...)
The agent loop is decoupled from the CLI/gateway infrastructure, allowing it to run in benchmark harnesses and training pipelines independently.
Three ways to extend Hermes Agent:
| Skill | Domain |
|---|---|
| Linear | Project management |
| X/Twitter | Social media (x-cli) |
| Telephony | Twilio, SMS, AI calls |
| 1Password | Password management |
| NeuroSkill | Brain-computer interface |
| Blender MCP | 3D modeling |
| OSS Security | Forensics |
| Parallel CLI | Research tool |
| OpenCode CLI | Development |
The mixture_of_agents tool queries multiple LLMs in parallel and synthesizes their responses. Think "ensemble inference" at the agent level.
Native smart home control: ha_list_entities, ha_get_state, ha_list_services, ha_call_service. Combine with cron for automated home routines.
image_generate tool creates images on demand. Results delivered natively on messaging platforms (inline photos on Telegram, attachments on Discord/Slack).
Released March 17, 2026 — the latest major version:
PRs from @teknium1
Bug fixes
New skills
Contributors
Migration from OpenClaw: hermes claw migrate preserves persona, memory, skills, settings, and API keys.
# Linux, macOS, WSL2 curl -fsSL https://raw.githubusercontent.com/\ NousResearch/hermes-agent/main/\ scripts/install.sh | bash # Reload shell and start chatting source ~/.bashrc hermes
| hermes | Start chatting |
| hermes model | Choose LLM |
| hermes tools | Configure tools |
| hermes gateway | Start messaging bridge |
| hermes setup | Full setup wizard |
| hermes doctor | Diagnose issues |
git clone https://github.com/\ NousResearch/hermes-agent.git cd hermes-agent # Init submodules git submodule update --init mini-swe-agent # Setup Python environment curl -LsSf https://astral.sh/uv/install.sh | sh uv venv venv --python 3.11 source venv/bin/activate uv pip install -e ".[all,dev]" # Run tests python -m pytest tests/ -q # Optional: RL training git submodule update --init tinker-atropos uv pip install -e "./tinker-atropos"
github.com/NousResearch/hermes-agent
Docs: hermes-agent.nousresearch.com • Skills: agentskills.io • Discord: discord.gg/NousResearch