Hermes Agent Memory: How It Works and How to Improve It
< BlogGuides
October 19, 2026
Updated October 21, 2026
20 minutes read

Hermes Agent Memory: How It Works and How to Improve It

Cognee Editorial Team
Cognee Editorial TeamCognee team

Hermes Agent memory is the persistence layer that lets Nous Research's self-improving agent carry context across sessions: a built-in learning loop that creates skills from experience, refines them during use, searches past conversations, and gradually builds a model of the user. This guide is for engineers operating or extending a self-hosted Hermes Agent install. It walks through how the built-in loop works in practice, the MEMORY.md file for environment facts, the USER.md file for the user profile, and the skills directory under ~/.hermes/skills/, where that file-based approach starts to strain, and how to extend it with an external memory provider or an MCP server, using Cognee's native provider as the worked example.

What does Hermes Agent memory need to work?

In practical terms, Hermes Agent memory is the set of files, stores, and tools the agent uses to remember environment facts, user preferences, and reusable procedures across sessions. According to the Hermes memory documentation, the core components are: MEMORY.md in ~/.hermes/memories/ for environment facts, conventions and lessons, capped at 2,200 characters (~800 tokens) by memory_char_limit; USER.md alongside it for the user profile, capped at 1,375 characters (user_char_limit); a skills directory at ~/.hermes/skills/ holding on-demand procedure documents compatible with the agentskills.io standard and managed through the skill_manage tool; a session store in SQLite (~/.hermes/state.db) with FTS5 full-text search that the session_search tool queries; and a pluggable external memory provider slot where exactly one provider is active at a time while the built-in files keep running alongside it. Providers available through hermes memory setup include the bundled RetainDB and ByteRover plugins plus catalog plugins such as Honcho, Hindsight, Supermemory, Mem0, OpenViking and Holographic. A knowledge-graph engine such as Cognee fits that external slot, either as a provider plugin or over the Model Context Protocol.

How does Hermes memory fit into an agent stack?

Agents are now expected to carry context across sessions, surfaces, and tools, so persistent memory is table stakes rather than a nice-to-have. Hermes ships a minimum viable implementation: a MEMORY.md file for environment facts and lessons, a USER.md profile, a ~/.hermes/skills/ directory, and FTS5 search over the SQLite session log. Both memory files are rendered into the system prompt on every turn, so their character limits are really a token budget (roughly 1,300 tokens in total). That design is readable and easy to inspect, but file-based memory hits ceilings when context spans months, teams, or tool chains. A mature setup adds a searchable knowledge graph, time-stamped facts for period-constrained recall, and source references on every retrieved fact, which is the shape of memory the external provider slot exists to supply.

What are the common problems with Hermes Agent memory?

Hermes agent memory works well for a single workstation and a handful of sessions, but friction appears once teams deepen usage: longer-running projects, more users, and more skills written to disk. The built-in store is two capped text files, MEMORY.md at 2,200 characters and USER.md at 1,375 characters, plus keyword search over past sessions. Those defaults are convenient, but they also set hard limits on what a Hermes agent can remember, how it finds that memory, and how teams reason about what has been stored.

Where Hermes memory breaks down

  • Memory budget forces deletions. Memory does not auto-compact: when a write would exceed the 2,200-character cap, the memory tool returns an error, so the agent has to remove or rewrite something it already knew before it can store something new. Important lessons quietly age out, and there is no structure to preserve the relationships between the evicted facts.
  • Flat text search limits recall. session_search is FTS5 keyword search over raw session messages. It handles exact phrases well but struggles with paraphrase, cross-document reasoning, or questions that require joining several small facts into one answer.
  • No source attribution for stored facts. Entries in MEMORY.md are lessons the agent wrote to itself. Operators cannot easily tell which conversation, file, or skill produced a given line, which complicates review, redaction, and debugging of bad memories.
  • Fragmented memory across providers. Hermes exposes a pluggable external provider slot, but only one external provider is active at a time while MEMORY.md and USER.md keep running alongside it. Memory is also scoped per profile, so a second agent profile gets its own files. Teams end up with two parallel memory surfaces and no shared schema.

Mitigation starts with standardization: pick one canonical place for durable, queryable memory and treat the local files as a short-term cache. Next, make memory writes an explicit, owned step rather than an implicit side effect, so every stored fact has a known producer. When the 2,200-character budget is exhausted, reach for an external provider instead of accepting silent deletions. A graph-based provider restores what the built-in store cannot: every entity and relation carries a pointer back to the source document and chunk, so recall returns facts with their references attached, and multi-hop questions are answered by traversing the graph rather than by matching keywords.

How should you design Hermes memory?

A Hermes memory strategy should start from the workload, not from a tool shortlist. The built-in files hold roughly 1,300 tokens of always-on context, which is enough for short-horizon tasks but forces the agent to prune prior knowledge once the cap is reached. The strategy question is where that limit stops being acceptable: multi-session user state, document-grounded answers, auditable decisions, or long-running research. Decide which of those matter, then pick capabilities that match. Treat the built-in store as scratch memory and plan an external layer for anything that must persist, be cited, or be queried structurally.

Must-have capabilities for a scalable Hermes memory strategy

  • Persistence beyond the 2,200-character cap. The external memory layer stores facts without evicting older entries to make room, so the agent can accumulate knowledge across sessions instead of overwriting it each time the default limit is hit.
  • Structured retrieval that combines graph and vector. Retrieval uses vector similarity to locate relevant entities, then traverses typed relations to assemble multi-hop context, rather than returning a flat list of nearest-neighbor chunks.
  • Source attribution on every recall. Each returned fact carries a pointer back to the ingested document and chunk it came from, so the agent and reviewers can verify where an answer originated.
  • Time-aware facts. The store extracts events and timestamps so queries can be scoped to a period ("what did we decide last quarter") instead of returning the most semantically similar text regardless of when it was true.
  • Self-hostable deployment. The memory layer runs inside the same trust boundary as Hermes, including air-gapped or bring-your-own-cloud environments, so sensitive context never leaves controlled infrastructure.

These five capabilities are the checklist to hold any provider against. Keyword search and capped files cover none of them; a vector-only provider covers the first; graph-structured recall with provenance and timestamps is what separates a memory layer from a larger scratchpad. The "How Cognee" section below shows how one graph-based provider maps onto them.

How do you choose a memory architecture for Hermes?

Engineering teams running self-hosted Hermes usually hit the architecture question once the built-in memory starts clipping context or once a second agent needs access to what the first one learned. The decision context is practical: two capped memory files, FTS5 session search, and a single active external memory provider slot. The right architecture depends on how many agents and developers share state, how strict compliance is, and whether the team wants to maintain a provider plugin or lean on an existing one.

Selection criteria that matter most

Start with headroom beyond the memory_char_limit, since anything larger than the file budget has to live in an external store. Interoperability comes next: the external store should fit the single provider slot cleanly, or expose itself through Hermes's built-in MCP client so it can coexist with other tools. Source attribution matters when answers need to be auditable, so prefer stores that return the records behind a result. Security covers encryption, tenant isolation, and deployment mode (air-gapped, BYOC, or cloud). Maintainability is whether upgrades, migrations, and backups are someone's documented job.

Build vs buy tradeoffs

Writing a custom provider plugin for the Hermes memory slot is viable when internal data models are unusual or when an existing storage system has to be reused as-is. The cost is ongoing: schema changes, extraction prompts, eval harnesses, and keeping pace with Hermes releases all become the team's responsibility. Adopting a catalog provider such as Mem0 trades that work for an opinionated fact-extraction pipeline wired in through hermes memory setup. Adopting a graph-based provider trades it for a knowledge graph plus vector index with pluggable backends. Buying usually wins unless the memory model itself is the product being built.

Reference architectures by team size

A solo developer running Hermes locally is often fine with the built-in stack alone: MEMORY.md, USER.md, and FTS5 session search, tuned by raising memory_char_limit in ~/.hermes/config.yaml if sessions get long. A small team that wants shared user profiles and automatic fact extraction can slot in Mem0 through hermes memory setup, picking Mem0 Cloud, a self-hosted Docker server, or the in-process OSS mode. A larger team coordinating several agents and IDE clients can mount a graph memory server over MCP so Hermes, Claude Code, and Cursor share one graph through remember, recall, and forget tools, backed by Postgres with pgvector or Neo4j.

Tool categories required for a complete Hermes memory stack

A complete stack covers four categories. Persistent file memory handles identity and project notes; Hermes already provides this through MEMORY.md and USER.md. An external memory provider fills Hermes's single provider slot and holds structured long-term memory, with the provider catalog (RetainDB, ByteRover, Honcho, Hindsight, Supermemory, Mem0, OpenViking, Holographic) and Cognee as options. An MCP transport exposes memory tools to Hermes and other clients over HTTP, SSE, or stdio. Finally, a graph or vector backend persists the data itself: SQLite for the built-in session log, and pgvector, Neo4j, Kuzu, Neptune, LanceDB, Qdrant, or Redis for larger external stores.

How to improve Hermes Agent memory step by step

Improving Hermes Agent memory in production works best as a phased rollout rather than a single cutover. The built-in MEMORY.md and USER.md files keep running throughout, so teams can layer external memory in without breaking existing sessions. The sequence below moves from measuring the current limits of the built-in files, to installing a memory provider, to ingesting real knowledge, and finally to validating recall with source references. Each phase is reversible, which matters when agents are already serving traffic. The worked example below uses one graph-based provider; the same shape applies to any provider in the catalog.

Extending Hermes memory end to end

1. Audit current MEMORY.md and USER.md usage against the caps. The memory block in the system prompt shows live usage (for example [67% — 1,474/2,200 chars]). Pull current file contents from running agents and measure how often writes approach the cap. Once it fills, the agent has to remove something it already knew before it can store something new, so the audit is really a measurement of how much institutional knowledge is evicted silently each session.

2. Decide between an external memory provider and a raw MCP server. Hermes exposes a single external memory provider slot, and only one provider is active at a time. Hermes also ships an MCP client, so any MCP memory server can be attached as a tool set. The provider route is deeper: according to the Hermes docs, a provider prefetches relevant memories before each turn, syncs conversation turns after each response, extracts memories at session end, and mirrors built-in memory writes, rather than only exposing tools the agent has to remember to call.

3. Install the Cognee provider. The plugin is published on PyPI as cognee-integration-hermes-agent; a Hermes catalog listing (hermes plugins install cognee) follows catalog acceptance. The pip path works today:

In local mode the wizard asks for an LLM API key, writes non-secrets to ~/.hermes/cognee.json and secrets to ~/.hermes/.env, and the next hermes session starts a memory server on 127.0.0.1:8011 (or attaches to one already running for the Claude Code, Codex or OpenClaw plugins) with storage in ~/.cognee. In remote mode it takes a hosted tenant URL and API key instead; nothing runs locally and no LLM key is needed. Re-run the wizard to switch modes; values in cognee.json take precedence over environment variables.

4. Verify the round trip.

Then, in a hermes chat: "Remember that my favorite editor is Helix." The agent should call cognee_remember. Start a fresh conversation with /new and ask "What's my favorite editor?"; it should answer via cognee_recall.

5. Ingest existing knowledge and index the codebase. The provider stores each completed turn and its tool calls in session memory under a capture policy that skips calls touching secret files and redacts secrets from what it keeps. For repositories, hermes cognee index-repo builds a deterministic code graph that cognee_code_search answers structural questions from (callers, dependencies, paths). Documents can be added with cognee_remember, which returns as soon as the server has the text; the graph is built in the background.

6. Validate recall with source references. Every recalled fact carries the graph context it came from, so validation is a matter of asking representative questions and checking both the answer and its sources. User-directed deletion ("forget what we said about tennis") goes through cognee_forget with a preview-then-confirm flow, and the standup, digest and timeline subcommands summarise what was worked on, what was left open, and how one topic evolved across recorded sessions. At session end, and before Hermes compresses a long conversation, the provider runs an improve pass so turns that get compressed away still reach the graph.

Best practices for Hermes memory

Hermes agent memory holds up over months of use when teams treat it as a system that needs discipline, periodic review, and clear standards for what belongs where. The two profile files, MEMORY.md and USER.md, drift quickly if every session appends raw notes, and a 2,200-character window will surface noise if nothing is pruned. External memory layers deserve the same care: schedule reviews, keep source references on every recalled fact, and document the split between local and external storage.

Curate what MEMORY.md stores versus what belongs in external memory. Keep MEMORY.md focused on short, stable environment facts and hard-won lessons that Hermes needs in every session: build commands, repo conventions, known gotchas. Push bulky project knowledge, document corpora, and conversation history into an external store where it can be queried on demand rather than pasted into context. Hermes supports write_approval: true in config.yaml if memory writes should be reviewed before they land.

Keep source references on every recalled fact. When memory returns a claim, the agent should be able to point to the document and chunk it came from. A graph store that keeps every entity and relation linked to its ingested source, and returns those references with each recall, makes it straightforward to audit and correct the memory layer rather than guessing where a stale answer originated.

Schedule periodic re-ingestion so only new or updated files are processed. A good ingestion pipeline classifies documents, checks permissions, extracts chunks, uses an LLM to extract entities and relationships, generates summaries, and then embeds everything into the vector store and commits edges to the graph, and on re-runs processes only new or updated files. A weekly or on-commit schedule keeps the external memory synchronized with the source of truth without rebuilding the whole graph.

Separate user profile from shared project knowledge. Keep USER.md scoped to the individual user's preferences and working style, and keep shared project knowledge in the external store where multiple agents or teammates can query it. Pair this with time-aware memory that extracts events and timestamps, so retrieval can answer questions constrained to particular periods and older project state is still reachable without polluting current context.

How Cognee Simplifies and Scales Hermes Agent Memory

Cognee ships a native memory provider for Hermes Agent (cognee-integration-hermes-agent, Apache-2.0, source in topoteretes/cognee-integrations) rather than relying on a generic MCP connection. The provider hooks the Hermes session lifecycle: it captures each completed turn and its tool traces into session memory, injects a per-prompt memory block with the retrieved graph context trimmed to what Hermes does not already have, mirrors explicit Hermes memory writes through on_memory_write, and bridges the session into the permanent knowledge graph at session end from a detached worker, so exiting Hermes never waits on a graph build. Turns the server missed while booting are queued and replayed.

The agent gets six tools: cognee_recall for explicit search, cognee_remember for durable graph memory, cognee_forget for confirmed per-document deletion, cognee_switch_dataset, cognee_code_search over an indexed repository, and cognee_recap. On recall, Cognee's default GRAPH_COMPLETION mode uses vector search to locate relevant graph triplets, traverses the knowledge graph to assemble structured context, and returns the facts with the graph context they came from. Every entity and relation keeps a pointer to its source document and chunk, so recall ships with references; temporal search answers questions constrained to a period; and opt-in contradiction detection records a contradicts edge instead of overwriting. The cognify pipeline (classify, permission-check, chunk, extract entities and relations, summarise, embed and commit edges) reprocesses only new or updated files on re-runs. Against the five must-have capabilities above, that covers persistence beyond the file cap, graph-plus-vector retrieval, source attribution, time-aware facts, and self-hostable deployment.

Backends are pluggable, so teams can reuse existing infrastructure: Kuzu, Neo4j, Amazon Neptune or Postgres for the graph, LanceDB or pgvector for vectors. The same local server is shared with the Claude Code, Codex and OpenClaw plugins, which is how one memory ends up serving every agent on a developer's machine. Teams that already run the Cognee MCP server (Docker image cognee/cognee-mcp, HTTP, SSE or stdio) can mount it through Hermes's MCP client instead. The engine is Apache-2.0, self-hostable, air-gap capable, encrypted at rest and in transit, and available as Cognee Cloud at $1.00 per 1M tokens processed plus $5 per additional workspace as of October 2026, with a free tier of 1M tokens and one workspace; Enterprise is delivered as a BYOC engagement with SLAs and a dedicated support engineer. Full details are in the Cognee documentation and on GitHub.

Key takeaways

Hermes ships a working built-in memory: MEMORY.md (2,200 characters, ~800 tokens) and USER.md (1,375 characters) rendered into every prompt, plus FTS5 search over past sessions in SQLite, which is enough for short sessions but tight for long-running agents. For more capacity, Hermes exposes one external provider slot (RetainDB, ByteRover, Honcho, Hindsight, Supermemory, Mem0, OpenViking, Holographic) while the built-in files keep running alongside it, or teams can route through an MCP server. A graph layer adds source references and temporal recall on top. To try the worked example from this guide, install the Cognee provider from PyPI, run hermes memory setup, and start on the free tier (1M tokens, one workspace) or a local server.

Docs: Hermes Agent integration, Hermes on Cognee Cloud, MCP overview.

FAQ

What is Hermes Agent memory and how does the built-in system work?

Hermes Agent is Nous Research's self-improving agent with a built-in learning loop that creates skills from experience, searches past conversations, and builds a model of the user across sessions. Persistent memory lives in two files inside ~/.hermes/memories/: MEMORY.md for environment facts and lessons, capped at 2,200 characters (~800 tokens), and USER.md for the user profile, capped at 1,375 characters. Both are injected into the system prompt on every turn. Past sessions are stored in SQLite with FTS5 full-text search and queried through the session_search tool, and skills live under ~/.hermes/skills/.

Why do teams add an external memory layer to Hermes Agent?

The built-in file store has a hard ceiling. Memory does not auto-compact: when a write would exceed the 2,200-character cap in MEMORY.md, the memory tool returns an error and the agent must remove something it already knew before it can write anything new, which erodes long-horizon recall. Hermes exposes a pluggable external memory provider slot with options such as RetainDB, ByteRover, Honcho, Hindsight, Supermemory, Mem0, OpenViking and Holographic. Only one external provider is active at a time, and the built-in memory continues running alongside it. Teams add an external layer to grow capacity, keep source references, and share memory across agents.

How do I connect Cognee to Hermes Agent?

The native route is simpler than wiring MCP by hand. Install cognee-integration-hermes-agent, run cognee-hermes-install, then pick "cognee" in hermes memory setup (local mode stores the graph in ~/.cognee; remote mode points at a Cognee Cloud tenant). Hermes gets cognee_recall, cognee_remember, cognee_forget, cognee_switch_dataset, cognee_code_search, and cognee_recap as first-class tools, plus hermes cognee status|index-repo|standup|digest|timeline. Hermes also ships a built-in MCP client, so teams that already run the Cognee MCP server (Docker or pip install cognee-mcp, HTTP/SSE/stdio) can mount that instead and share one graph with Claude Code, Codex, and Cursor.

What's the difference between using Mem0 and Cognee as a Hermes memory provider?

Both install through hermes memory setup and occupy the single external provider slot. Mem0 runs in Mem0 Cloud, self-hosted Docker, or in-process OSS modes, extracts facts server-side in a background thread, and adds mem0_profile, mem0_search, and mem0_conclude tools. Cognee builds a knowledge graph where every entity and relation keeps a pointer to the ingested document and chunk, so recall returns facts with source references, and adds code-graph search over an indexed repository. GRAPH_COMPLETION uses vector search as a hint, then traverses the graph for structured context. See Mem0 alternatives for a fuller comparison.

Can Hermes Agent memory be self-hosted and air-gapped end to end?

Yes. Hermes already stores MEMORY.md, USER.md, skills, and its SQLite session database on the local machine. An external provider has to meet the same bar: Cognee's open-source engine is Apache-2.0 licensed, GDPR-compliant, encrypted at rest and in transit, and supports air-gapped and bring-your-own-cloud deployments. In local mode the provider runs on 127.0.0.1:8011 with storage in ~/.cognee, and the MCP server runs in Docker over stdio, SSE, or HTTP, so either can sit on the same host as Hermes with no outbound network. Pair that with self-hosted graph and vector stores and a local LLM, and the entire Hermes memory path, including graph recall with citations, stays inside the environment.

Related reading

OpenClaw Memory: How It Works, Where It Breaks, and How to Make It Persistent
Codebase Memory: What It Is and How to Give AI Coding Agents Persistent Memory of Your Repository
MCP Memory: What It Is and How to Give Any MCP Client Persistent Memory
Get started

Cognee is the fastest way to start building reliable Al agent memory.

Cognee Cloud
Latest
Claude Code vs Codex vs Cursor: What Coding Agents Really Cost in 2026
Coding Agent Memory with cognee: Hooks, Capture, and Recall
Dataset Routing in cognee: How recall() Picks Which Datasets to Search