# How to give Hermes Agent better memory

[Hermes](https://www.knowman.io/integrations/hermes) Agent keeps bounded, curated [memory that persists across sessions](https://www.knowman.io/guides/ai-agent-memory), split across two files: `MEMORY.md`, capped at 2,200 characters, and `USER.md`, capped at 1,375 characters, both injected into the [system prompt](https://www.knowman.io/guides/give-your-ai-context) at session start ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). Every CLI and messaging session is also stored in SQLite and searchable with `session_search`, returning actual messages with no truncation ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). Hermes also ships with 8 external memory provider plugins that run alongside built-in memory ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)).

## What Hermes Agent remembers

Hermes Agent keeps bounded, curated memory that persists across sessions, so it can [remember preferences](https://www.knowman.io/guides/teach-hermes-your-knowledge), projects, environment facts and things it has learned ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). Two files make up this memory. `MEMORY.md` holds the agent's personal notes, such as environment facts and conventions, with a limit of 2,200 characters, about 800 tokens. `USER.md` holds your profile, with preferences, communication style and expectations, limited to 1,375 characters, about 500 tokens.

Both files are stored in `~/.hermes/memories/` and injected into the system prompt as a frozen snapshot at session start ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). The guide also names two context files, `SOUL.md` and `AGENTS.md`, and tells the agent to skip saving their content into memory. [Persistent memory](https://www.knowman.io/guides/persistent-memory-for-ai-agents) totals roughly 1,300 tokens, while session search capacity is unlimited across all stored sessions ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)).

## How the agent writes to memory

The agent manages its own memory via the `memory` tool, which can add, replace or remove entries ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). It saves automatically, you do not need to ask. There is no read action, because memory content is already injected into the system prompt at session start. If the substring used by replace or remove matches multiple entries, the tool returns an error and asks for a more specific match ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)).

Exact duplicate entries are rejected automatically ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). Entries are also scanned for injection and exfiltration patterns before being accepted, since they land in the system prompt. If you would rather approve saves first, set `memory.write_approval` to `true` ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)).

## Limits to know

Memory does not auto-compact. A write that would exceed the limit makes the `memory` tool return an error instead of silently dropping entries ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). The system prompt block is captured once at session start and never changes mid-session, which is intentional and preserves the LLM's prefix cache for performance. Changes made during a session are persisted to disk immediately, but they do not appear in the system prompt until the next session starts ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)).

When memory is above 80% capacity, visible in the system prompt header, the guide says to consolidate entries before adding new ones ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). One caution from the same guide: two agent processes sharing one Hermes home directory will compound each other's memory writes into state neither of them, nor you, authored.

## Session search covers every conversation

All CLI and messaging sessions are stored in SQLite at `~/.hermes/state.db` with FTS5 full-text search, and you search them with the `session_search` tool ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). Search queries return actual messages from the database, with no LLM summarization and no truncation. Persistent memory holds roughly 1,300 tokens in total, while session search reaches all stored sessions.

The documented practice is to run `/new` at natural boundaries, such as a finished task, a change of topic, or the start of a day, so memory and session search pay off ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). On messaging platforms a chat is one continuous session. Shutting the machine down overnight does not end it, and the next message picks up exactly where it left off.

## External memory providers

Hermes ships with 8 external memory provider plugins, including Honcho, OpenViking, Mem0, Hindsight, Holographic, RetainDB, ByteRover and Supermemory ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)). External providers run alongside built-in memory, never replacing it, and add capabilities like knowledge graphs, [semantic search](https://www.knowman.io/guides/ai-knowledge-base), automatic fact extraction and cross-session user modeling ([Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md)).

KnowMan is a personal knowledge base that saves articles and links, reads and tags them, answers questions with citations, and keeps memories such as claims, decisions and playbooks ([personal knowledge base guide](https://www.knowman.io/guides/personal-knowledge-base)). The next section covers its [MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base).

## The KnowMan MCP server

KnowMan also provides an open-source MCP client, package `@knowman/mcp`, that runs locally as a [stdio server](https://www.knowman.io/guides/what-is-an-mcp-server) with `npx -y @knowman/mcp` on Node 22 or newer, and a hosted server at `https://api.knowman.io/mcp` ([MCP server knowledge base guide](https://www.knowman.io/guides/mcp-server-knowledge-base)). The hosted server can be used with OAuth sign-in or an API key. Its tools include `kb_search` for finding [saved items](https://www.knowman.io/guides/how-to-save-articles) by keyword or meaning, `kb_ask` for answers with citations, `kb_memories` for saved claims, decisions and playbooks, `kb_get_item` for the readable content of one item, `kb_save` to save a URL, and `kb_recent` for recent items.

The client configurations documented for the KnowMan MCP server cover [Claude Desktop](https://www.knowman.io/guides/claude-desktop-memory), [Claude Code](https://www.knowman.io/guides/claude-code-memory) and Cursor ([Claude knowledge base guide](https://www.knowman.io/guides/claude-knowledge-base)). For the wider pattern of durable context across sessions, see [persistent memory for AI agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents).

## Use hosted KnowMan with Hermes Agent

KnowMan also offers a hosted MCP server at https://api.knowman.io/mcp. In clients that support remote MCP servers, add this server URL and sign in through the KnowMan consent page with OAuth, or use an API key as an Authorization: Bearer header.

KnowMan's open-source local MCP client is available at [GitHub](https://github.com/Essatt/knowman-mcp). It runs locally with `npx -y @knowman/mcp` on Node 22 or newer.

## Questions

### Where does Hermes Agent store memory?

In two files under `~/.hermes/memories/`: `MEMORY.md` for the agent's notes, capped at 2,200 characters, and `USER.md` for your profile, capped at 1,375 characters. Both are injected into the system prompt as a frozen snapshot at session start. See the [Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md).

### Why does memory not update during a session?

The system prompt injection is captured once at session start and never changes mid-session, intentionally, to preserve the LLM's prefix cache for performance. Writes are persisted to disk immediately but appear in the system prompt only when the next session starts. See the [Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md).

### What happens when Hermes memory is full?

Memory does not auto-compact, so the `memory` tool returns an error instead of silently dropping entries. The guide says to consolidate entries before adding new ones once memory is above 80% capacity, which is visible in the system prompt header. See the [Hermes memory guide](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/memory.md).

### Can KnowMan add long-term memory to Hermes Agent?

KnowMan is a personal knowledge base that saves articles and links, reads and tags them, answers questions with citations, and keeps memories such as claims, decisions and playbooks ([personal knowledge base guide](https://www.knowman.io/guides/personal-knowledge-base)). Its MCP server is a local stdio server, and the client configurations documented for it cover Claude Desktop, Claude Code and Cursor ([Claude knowledge base guide](https://www.knowman.io/guides/claude-knowledge-base)).

## Related guides

- [Persistent Memory for AI Agents](https://www.knowman.io/guides/persistent-memory-for-ai-agents)

- [Connect your knowledge base through KnowMan's MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base)

- [How to Build a Claude Knowledge Base](https://www.knowman.io/guides/claude-knowledge-base)

- [What Is a Knowledge Base for AI Agents?](https://www.knowman.io/guides/knowledge-base-for-ai-agents)

- [How to Give Your AI Context from What You Read](https://www.knowman.io/guides/give-your-ai-context)

## More in this topic

- [How to give OpenClaw better memory](https://www.knowman.io/guides/openclaw-memory)
- [How to set up JetBrains AI Assistant rules](https://www.knowman.io/guides/jetbrains-memory)
- [Kilo Code memory: what persists and what to add](https://www.knowman.io/guides/kilo-code-memory)

## More for Hermes Agent

- [KnowMan MCP server for Hermes Agent](https://www.knowman.io/integrations/hermes)
- [How to teach Hermes Agent your knowledge](https://www.knowman.io/guides/teach-hermes-your-knowledge)

## Give your agent a longer memory

Try KnowMan Pro for 14 days with no credit card. [Create your account](https://app.knowman.io/signup)

[Start free](https://app.knowman.io/signup)

Every new account starts with 14 days of Pro. No credit card.

Source: https://www.knowman.io/guides/hermes-memory
