Day 6 · Memory and State: Sessions, Compression, Backup
Today’s Goal
Section titled “Today’s Goal”Have Hermes proactively remember one piece of information about you, compress a long conversation into a summary that carries into a new session, and take a full backup.
Prerequisites
Section titled “Prerequisites”Day 2 complete. Having some prior conversations with Hermes helps — the session demos in this chapter need existing history.
First: Hermes memory has three layers
Section titled “First: Hermes memory has three layers”Most people picture memory as one big bucket. Hermes actually has three independent systems:
| Layer | Location | Stores | When read/written |
|---|---|---|---|
| Long-term memory | ~/.hermes/memories/MEMORY.md ~/.hermes/memories/USER.md | Environmental facts, your preferences, cross-session experience | Injected into system prompt at session startup; writes during a session don’t take effect immediately (prefix cache optimization) |
| Session history | ~/.hermes/sessions/*.jsonl + ~/.hermes/state.db (SQLite) | Full messages and tool calls from each conversation | Appended continuously during the session; archived when it ends |
| Full-text search index | SQLite FTS5 index | Searchable copy of all past sessions | The session_search tool queries this on demand during conversations |
Two key design choices to remember:
- Long-term memory uses a frozen snapshot model — if you tell Hermes “remember this from now on” during a session, it writes to disk, but the new memory doesn’t enter the system prompt until the next session starts. This maximizes LLM prefix cache usage (faster, cheaper).
MEMORY.mdhas a 2200-character limit;USER.mdhas 1375 characters. Hitting the limit forces you to consolidate — intentional design to keep memories concise.
-
Check your existing memories
Terminal window ls ~/.hermes/memories/cat ~/.hermes/memories/MEMORY.mdcat ~/.hermes/memories/USER.mdIf you haven’t configured the memory system before, these files may be empty or freshly created. Initialize:
Terminal window hermes memory setuphermes memory statusstatusshows current usage (character count / limit). -
Have Hermes actively remember something
Start Hermes and state a clear preference:
You: Remember this: whenever I paste code for review, give feedback in English, not any other language.Hermes should:
- Call the
memorytool (addaction) - Write this preference to
USER.md - Reply “Got it — takes effect from the next session”
- Call the
-
Use /compress to condense a long conversation
If you’ve been talking for a while (context approaching the model limit), or you want to switch topics without losing what came before:
You: /compressHermes will:
- Read the full current conversation
- Generate a structured summary (preserving key decisions, to-dos, verified facts)
- Write the summary to long-term memory
- Create a continuation session — a new session starting from that summary
Focus the summary with a parameter:
You: /compress --focus "progress on the login module refactor" -
Name your session (/title)
Hermes auto-titles sessions after the first exchange. Override manually:
You: /title Hermes Tutorial Day 6Limit: 100 characters max, globally unique, control characters stripped.
-
Browse history and resume sessions
Back in the terminal:
Terminal window hermes sessions list # shows the last 20 by defaulthermes sessions list --limit 50hermes sessions list --source telegram # filter by platformhermes sessions stats # total count, message volume, database sizeThree levels of granularity for resuming:
Terminal window hermes --continue # most recent CLI sessionhermes -c # same, shorthandhermes -c "Project A" # find the latest session matching that title (A → A #2 → A #3)hermes --resume 7e4f2b8c # resume by exact session ID -
View and search past conversations
Inside a conversation,
/historyshows the full scroll of the current session:You: /historyFor cross-session search, use the
session_searchtool — Hermes calls it automatically, but you can prompt it:You: Last week we discussed a K8s operator design. Help me find it.Hermes calls
session_searchto run a full-text query against the SQLite FTS5 index and summarizes matching passages. -
Take a full backup
Hermes stores config, skills, sessions, cron jobs, and credentials all under
~/.hermes/. Back up the whole state:Terminal window hermes backup # default: ~/hermes-backup-<timestamp>.ziphermes backup -o /tmp/hermes.zip # specify output pathhermes backup --quick # core state only (config + state.db + .env + cron)hermes backup --quick --label "pre-upgrade" # safety snapshot before an upgrade -
Restore a backup
Terminal window hermes import hermes-backup-2026.04.15.ziphermes import backup.zip --force # overwrite existing files without prompting
Advanced: external memory providers
Section titled “Advanced: external memory providers”If the built-in memory isn’t enough (knowledge-graph retrieval across hundreds of sessions, or shared long-term memory across a team), you can attach an external provider:
| Provider | Best for |
|---|---|
| Mem0 | Lightweight cloud service, simple API |
| Honcho | User modeling for AI agents |
| Supermemory | Browser and note aggregation search |
| OpenViking / Hindsight / Holographic / RetainDB / ByteRover | Various specialized use cases |
External providers are additive, not replacements — the built-in MEMORY.md is always the primary source; external providers supplement with semantic retrieval. Full config: official Memory docs.
Expected Output
Section titled “Expected Output”$ hermes memory statusMEMORY.md: 1423 / 2200 chars (64%)USER.md: 672 / 1375 chars (48%)
$ hermes sessions list --limit 3● 2026-04-23 21:10 Hermes Tutorial Day 6 cli 24 messages● 2026-04-23 20:05 Login module refactor cli 89 messages (compressed)● 2026-04-23 19:30 Login module refactor #2 cli 11 messages
$ hermes backup --quick --label "day6-done"✓ state.db (WAL-safe copy)✓ config.yaml / .env✓ cron jobs✓ credentialsArchive: ~/hermes-backup-day6-done.zip (2.1 MB)