Persistent Memory
الذاكرة المستمرة
Start with meaning, then move to detail.
This lesson explains Persistent Memory as part of extending Hermes and connecting external tools. You will learn what it does, when it matters, and the smallest safe test that proves it works.
If you are new, do not memorize names. Focus on three questions: what problem does this solve, what access does it need, and how can you verify the result?
For practice, inspect the first example, identify its effects, run it on test data, and compare the result with the source claim.
For advanced readers, inspect How It Works, How Memory Appears in the System Prompt, Memory Tool Actions, then verify failure modes and version compatibility.
Complete installation and one successful task before adding new capabilities.
A clear outcome before you read.
- Understand Persistent Memory without assumed prior knowledge.
- Separate the source description from what still needs testing in your environment.
- Read the first command and identify its inputs and outputs before copying it.
Short definitions before the details.
- Session & memory
- A session holds conversation context, while memory keeps selected facts that should persist.
- Tool
- A structured action the agent can call to read or change something.
How Hermes Agent remembers across sessions — MEMORY.md, USER.md, and session search
What does the source say, and in what order?
- 01How It Works
Start here to understand the core idea or structure.
- 02How Memory Appears in the System Prompt
Read this after the foundation, then connect it to the previous step.
- 03Memory Tool Actions
Read this after the foundation, then connect it to the previous step.
- 04Substring Matching
Read this after the foundation, then connect it to the previous step.
- 05Two Targets Explained
Read this after the foundation, then connect it to the previous step.
- 06memory — Agent's Personal Notes
Read this after the foundation, then connect it to the previous step.
- 07user — User Profile
Read this after the foundation, then connect it to the previous step.
- 08What to Save vs Skip
Read this after the foundation, then connect it to the previous step.
- 09Save These (Proactively)
Read this after the foundation, then connect it to the previous step.
- 10Skip These
Finish here to verify the result and special cases.
Copy only after you understand the effect.
══════════════════════════════════════════════
MEMORY (your personal notes) [67% — 1,474/2,200 chars]
══════════════════════════════════════════════
User's project is a Rust web service at ~/code/myapi using Axum + SQLx
§
This machine runs Ubuntu 22.04, has Docker and Podman installed
§
User prefers concise responses, dislikes verbose explanationsIf the substring matches multiple entries, an error is returned asking for a more specific match.
## Two Targets Explained
### `memory` — Agent's Personal Notes
For information the agent needs to remember about the environment, workflows, and lessons learned:
- Environment facts (OS, tools, project structure)
- Project conventions and configuration
- Tool quirks and workarounds discovered
- Completed task diary entries
- Skills and techniques that worked
### `user` — User Profile
For information about the user's identity, preferences, and communication style:
- Name, role, timezone
- CoThe agent should then:
1. Read the current entries (shown in the error response)
2. Identify entries that can be removed or consolidated
3. Use `replace` to merge related entries into shorter versions
4. Then `add` the new entry
**Best practice:** When memory is above 80% capacity (visible in the system prompt header), consolidate entries before adding new ones. For example, merge three separate "project uses X" entries into one comprehensive project description entry.
### Practical Examples of Good Memory Entries
**Compact, information-dense entries work best:**Read the first command and identify its inputs and outputs before copying it.
Match every command to your installed Hermes version, review the files and accounts it can reach, and use non-sensitive data for the first test. If this explanation differs from the source, the official source wins.