Engineering 12 min read

How Hermes Agent Improves Itself After Every Turn

MMNMNOTE
githubhermes-agentnous-researchai-agentsagent-memorypython
Updated June 8, 2026

Reference: NousResearch/hermes-agent — MIT · Python

Hermes Agent is Nous Research's open-source, self-hostable AI agent runtime — "the agent that grows with you." Unlike most agent frameworks, its headline feature is a closed learning loop: after every turn it forks a copy of itself to decide which skills and memories to save, curates that collection in the background, and searches its own past conversations. It is MIT-licensed Python and model-agnostic.

That last word matters. "Grows with you" reads like marketing until you open the source and find it is a set of named subsystems with strict invariants. This post walks the architecture from the source tree out.

What is Hermes Agent and who built it?

Hermes Agent is an open-source agent runtime from Nous Research, the lab behind the Hermes family of open-weight language models. It runs as a terminal app, a messaging gateway (Telegram, Discord, Slack, WhatsApp, Signal), and an API server — all from one agent core. As of 2026-06-05 the repo carries 181,534 stars and is MIT-licensed.1

Two clarifications up front. First, the star count is genuinely that high — verify it yourself with the command in the footnote. Second, despite the shared name, the agent is not tied to the Hermes models. It speaks to any OpenAI-compatible endpoint and you switch providers with hermes model, "no code changes, no lock-in" per the README.2 The Hermes models are simply one of the 300-plus options it can drive.

What does "grows with you" actually mean?

It means three concrete subsystems, not a slogan. The README states it plainly: Hermes "creates skills from experience, improves them during use, nudges itself to persist knowledge, searches its own past conversations, and builds a deepening model of who you are across sessions."3 In the code, that breaks into a post-turn self-review fork, a background skill curator, and a full-text session index.

The project frames this as its differentiator — its own claim is that "it's the only agent with a built-in learning loop."3 Treat the superlative as marketing; treat the mechanism as real, because each piece is a file you can read.

flowchart TD
  U[User input: CLI / Telegram / API] --> E[Entry point]
  E --> L[AIAgent.run_conversation - one turn:<br/>prompt build, model call, tool dispatch, compaction]
  L --> R{After turn}
  R --> F[spawn_background_review:<br/>forked AIAgent, memory+skill tools only]
  F --> M[(Memory store)]
  F --> S[(Skill store)]
  C[Curator - inactivity-triggered] -.maintains.-> S
  L -.FTS5 recall.-> DB[(SQLite session DB)]

How does one turn run through the agent?

Everything funnels through a single class. The architecture docs are blunt: "One AIAgent class serves CLI, gateway, ACP, batch, and API server. Platform differences live in the entry point, not the agent."4 So the messaging gateway and the terminal UI share the exact same brain; only the plumbing differs.

A turn is driven by run_conversation. The module that holds it does not undersell its size — the docstring describes "the roughly 3,900-line run_conversation body that drives one user turn through the agent (model call, tool dispatch, retries, fallbacks, compression, post-turn hooks, background memory/skill review nudges)."5 That single function is the loop: build the prompt, call the model, dispatch tools, compress context if needed, then fire the post-turn hooks. The "nudges" at the end are where the learning loop hangs.

How does the self-improvement loop work?

This is the cleverest part, and it is small. After a turn, run_conversation may call spawn_background_review, which launches a daemon thread that replays the conversation in a forked agent and asks one question. The docstring says it best:

"After every turn, AIAgent.run_conversation may call spawn_background_review to fire off a daemon thread that replays the conversation snapshot in a forked AIAgent and asks itself 'should any skill/memory be saved or updated?'. Writes go straight to the memory + skill stores. Main conversation and prompt cache are never touched."6

Two design decisions make this safe. The fork inherits the parent's live provider, model, and cached system prompt, so it hits the same prefix cache and costs almost nothing extra. And it "runs with a tool whitelist limited to memory and skill management tools; everything else is denied at runtime."6 The reviewer agent literally cannot run shell commands or edit files — it can only write what it learned. That separation of concerns is what lets the loop run unattended on every turn without becoming a liability.

How does it keep its own skills from rotting?

Self-created skills accumulate, so Hermes ships a janitor. agent/curator.py is "a background skill maintenance orchestrator" — an auxiliary-model task that runs when the agent is idle, with no cron daemon, transitioning stale skills, consolidating duplicates, and patching or pinning agent-created ones. It is governed by a strict, quotable invariant.

"Never auto-deletes — only archives. Archive is recoverable. Pinned skills bypass all auto-transitions."7

This is the kind of guardrail that separates a demo from a tool people trust with months of accumulated knowledge. An autonomous process that can prune your skill library is terrifying unless every action is reversible — so the curator archives instead of deletes, leaves anything you pinned alone, and only ever touches skills the agent itself created, never yours.

How does Hermes search its own past conversations?

By treating its session history as a searchable database, not a context window. Sessions are stored in SQLite, and hermes_state.py builds an FTS5 virtual table over every message: CREATE VIRTUAL TABLE ... messages_fts USING fts5(...), plus a second trigram FTS5 table so substring search works for CJK languages.8 The recall tool reads that index.

Worth a precise note: the README mentions "FTS5 session search with LLM summarization," but the search tool itself is deliberately model-free. Its discovery mode "runs FTS5, dedupes hits by session lineage" and returns real message windows with "Zero LLM cost" — "No LLM calls anywhere — every shape returns actual messages from the DB."9 Recall is cheap and deterministic; any summarization is a separate, optional path. That is a good pattern to copy: keep retrieval boring and fast, and spend tokens only when you actually need synthesis. Plain, queryable state beats opaque embeddings for anything you must trust — the same instinct behind agent designs built for inspectable, observable state.

What is worth stealing from this design?

Three ideas travel well beyond Hermes. The forked reviewer with a tool whitelist is the standout: run reflection in a sandboxed copy that can only write memory, never act, and the loop becomes safe to run constantly. The reversible curator — archive, never delete; never touch user-authored items — is a template for any autonomous maintenance process. And FTS5-first recall shows you can get long-term memory with a SQLite index and zero inference cost before reaching for a vector store.

If you are comparing agent runtimes, the contrast with peers is instructive. AgentScope leans on full observability of every step, and Agno organizes agents into a managed platform. Hermes bets on a different axis: a single agent that quietly compounds what it knows about one user over time.

Verdict — is it worth your attention?

Hermes Agent is worth studying even if you never run it, because its learning loop is implemented with unusual discipline: a sandboxed self-fork, a reversible curator, and deterministic FTS5 recall. The "only agent with a learning loop" claim is the project's own and best ignored; the engineering underneath is the real lesson. For a self-hosted personal agent that accrues skills and memory, it is one of the more thoughtful open designs available today.

Frequently Asked Questions

What is Hermes Agent?

Hermes Agent is an open-source, MIT-licensed, self-hostable AI agent runtime from Nous Research, written in Python. It runs as a terminal app, a multi-platform messaging gateway, and an API server from one agent core, and it works with any OpenAI-compatible model provider rather than a fixed one.

How does Hermes Agent "grow with you"?

Through three subsystems: a post-turn fork that decides which skills and memories to save, a background "curator" that maintains the skill collection, and an FTS5 index over past sessions for recall. Together they let the agent compound knowledge about one user across many sessions.3

Is Hermes Agent tied to the Hermes language models?

No. Despite the shared name, the agent is model-agnostic. The Hermes 4 models are an open-weight family with hybrid reasoning and tool use,10 but Hermes Agent drives any OpenAI-compatible endpoint and lets you switch providers with one command, "no code changes, no lock-in."2

What is the background review loop?

After each turn, run_conversation can spawn a daemon thread that replays the conversation in a forked agent and asks "should any skill/memory be saved or updated?". The fork is restricted to memory and skill tools and never touches the main prompt cache, so it can run safely on every turn.6

Will the curator delete my skills?

No. The curator only touches agent-created skills, never your own, and its invariant is "Never auto-deletes — only archives. Archive is recoverable." Pinned skills bypass all automatic transitions entirely, so anything you mark as important is left alone.7

Does Hermes Agent only run on my laptop?

No. It supports six terminal backends including Docker, SSH, Modal, and Daytona, and the serverless options hibernate when idle. You can run it on a small VPS or a GPU cluster and talk to it from Telegram while it works on a remote machine.2

How does it search past conversations?

Sessions live in SQLite with an FTS5 full-text index over every message, plus a trigram table for CJK substring matching.8 The discovery search returns real message windows with "No LLM calls anywhere," making recall fast, deterministic, and free of inference cost.9

Is Hermes Agent open source and free to self-host?

Yes. The repository is MIT-licensed, so you can self-host, fork, and modify it freely.1 You bring your own model provider and pay that provider for inference; the agent code itself carries no license fee.


Software that compounds what it knows about you is rarer than software that merely answers — and the difference lives in a few hundred lines of disciplined loop.


For notes that stay yours and stay local, see mnmnote.com.

Footnotes

  1. GitHub REST API, accessed 2026-06-05: curl -s https://api.github.com/repos/NousResearch/hermes-agent | python3 -c 'import json,sys;d=json.load(sys.stdin);print(d["stargazers_count"], d["license"]["spdx_id"])'181534 MIT. LICENSE file: "MIT License / Copyright (c) 2025 Nous Research." 2

  2. NousResearch/hermes-agent, README.md, accessed 2026-06-05. https://github.com/NousResearch/hermes-agent/blob/main/README.md 2 3

  3. NousResearch/hermes-agent, README.md (project's own description of the learning loop), accessed 2026-06-05. 2 3

  4. Hermes Agent docs, Developer Guide → Architecture, accessed 2026-06-05. https://hermes-agent.nousresearch.com/docs/developer-guide/architecture

  5. NousResearch/hermes-agent, agent/conversation_loop.py module docstring, accessed 2026-06-05. https://github.com/NousResearch/hermes-agent/blob/main/agent/conversation_loop.py

  6. NousResearch/hermes-agent, agent/background_review.py module docstring, accessed 2026-06-05. https://github.com/NousResearch/hermes-agent/blob/main/agent/background_review.py 2 3

  7. NousResearch/hermes-agent, agent/curator.py module docstring, accessed 2026-06-05. https://github.com/NousResearch/hermes-agent/blob/main/agent/curator.py 2

  8. NousResearch/hermes-agent, hermes_state.py (lines defining messages_fts and messages_fts_trigram), accessed 2026-06-05. 2

  9. NousResearch/hermes-agent, tools/session_search_tool.py module docstring, accessed 2026-06-05. https://github.com/NousResearch/hermes-agent/blob/main/tools/session_search_tool.py 2

  10. "Nous Research Team Releases Hermes 4," MarkTechPost, 2025-08-27, accessed 2026-06-05. https://www.marktechpost.com/2025/08/27/nous-research-team-releases-hermes-4-a-family-of-open-weight-ai-models-with-hybrid-reasoning/