Hermes Agent Backup, Restore & Migration
Run hermes backup to write one zip of your whole Hermes data directory — every profile's config, memories, skills, sessions, cron jobs, and credentials — and hermes import <zip> to restore it, on the same machine or a new one. Stop the gateway before importing.
To move or share one agent without its API keys, use hermes profile export <name> -o file.tar.gz instead. Full backups contain your API keys and sign-in tokens: encrypt them and store them like a password file.
Checked against official Nous Research sources on September 26, 2026 (Hermes Agent v0.21.5).
What actually needs backing up
Everything that makes your agent yours is in the Hermes data directory (HERMES_HOME). The program itself can be reinstalled.
| Install type | Data directory |
|---|---|
| macOS, Linux, WSL2, Desktop app | ~/.hermes/ |
| Native Windows | %LOCALAPPDATA%\hermes\ |
| Docker | The host directory or volume mounted at /opt/data |
| Named profiles and Bot Mode bots | profiles/<name>/ inside the data directory |
Inside it: config.yaml, .env (API keys), auth.json (OAuth tokens), SOUL.md, memories/ (memory), skills/ (skills), state.db (every session), cron/, plugins/, and profiles/.
Every backup-like option, compared
| Tool | What it captures | Credentials? | Restore with | Use it for |
|---|---|---|---|---|
hermes backup | Whole data directory, all profiles (with the exclusions below) | Yes | hermes import | Disaster recovery, moving to a new machine |
hermes backup --quick | Critical state only: config.yaml, state.db, .env, auth, cron jobs | Yes | /snapshot restore <id> | A fast checkpoint before a risky change |
/snapshot create (in a chat) | Same kind of state snapshot, from inside a session | Yes | /snapshot restore <id> | Undoing a config or state change |
Pre-update backup (hermes update) | Quick snapshot by default; --backup adds a full zip | Yes | /snapshot restore | Automatic safety net on native installs |
hermes profile export | One profile: skills, memory, persona, cron jobs, plugins, settings | No — stripped | hermes profile import | Moving or sharing one agent |
hermes sessions export | Conversation transcripts as JSONL, Markdown, or HTML | Only what you typed; --redact masks credential patterns | No documented import | Archiving or sharing conversations |
hermes curator backup | A tar.gz of skills/ | No | hermes curator rollback | Undoing skill cleanup |
| Provider disk snapshots | The whole server disk | Yes | Your provider | Whole-server rollback on a VPS |
Full backup vs. quick backup
$hermes backup # full: ~/hermes-backup-<timestamp>.zip$hermes backup -o ~/Backups/hermes-$(date +%F).zip$hermes backup --quick --label pre-upgrade # quick state snapshot
- Safe while Hermes is running. Databases are copied with SQLite's backup API, so you don't need to stop the gateway to back up.
- Check the exit code.
0means every file landed.1(“Backup incomplete”) keeps a partial zip and lists what was skipped — read it before deleting anything.2means another backup was running. - Old zips are pruned. A full backup keeps the newest 3
hermes-backup-*.zipfiles in the output folder (--keep N;0keeps all). Pruning is skipped after an incomplete backup. - Not included: the Hermes program, downloaded local models and runtimes, browser profiles (they hold real browser cookies and logins), regenerable caches, session checkpoints, earlier backups, and SQLite's
-wal/-shmsidecars. - A quick backup is not a migration backup. The official FAQ says so directly; use a full backup before moving machines.
To restore a quick snapshot, start hermes and use /snapshot (lists snapshots) and /snapshot restore <id>.
hermes snapshot list and hermes backup restore --state pre-update. Neither exists as a CLI command; snapshots are listed and restored with the in-chat /snapshot command. This is tracked in issue #119756 (open as of September 26, 2026).Restoring with hermes import
$hermes gateway stop # and quit the Desktop app / dashboard$hermes import ~/hermes-backup-<timestamp>.zip$hermes doctor$hermes gateway start
- Import overwrites. Every file in the archive replaces the file of the same name in your data directory. If Hermes is already set up there, it asks first;
--forceskips the question. - Damaged archives are refused before anything is written — every member is checksum-checked first.
- Partial restores are reported: exit code
1and an “Import incomplete” summary if any file could not be restored. - Older-over-newer is flagged. If the imported
state.dbhas fewer messages than the one it replaces, the summary warns that anything after the backup date is gone from the restored copy. - Databases are written into the existing file rather than swapped, so a process that still has it open sees the restored data. If that can't be done safely, the database is skipped with a warning — stop the process and rerun.
We checked the current docs for a warning to import only into a fresh, empty install. It is not there today: the documented requirement is to stop the gateway, and the confirmation prompt covers importing over an existing setup. Importing into a new install is still the cleanest case, because nothing is being overwritten.
Profile exports and session exports
$hermes profile export work -o work.tar.gz$hermes profile import work.tar.gz --name work$$hermes sessions export all-sessions.jsonl$hermes sessions export --format html --newer-than 1w --redact archive.html
- Profile exports strip API keys. Static keys have to be re-entered and OAuth logins signed in again on the destination (
hermes -p <name> auth add <provider>). The same export is/exportin chat and ⌘K → Export profile in Desktop. - Machine-specific tools don't travel.
installs/,tools/, andcache/are left out; reinstall dependencies on the destination. - Session exports are one-way. They produce readable or machine-readable archives; there is no documented command to import them back as live sessions. Use a full backup if you need sessions restored.
--redactmasks recognizable credential patterns only. Anything else sensitive you discussed stays in the export.
hermes profile export work ./work-backup.tar.gz and hermes profile import ./work-backup.tar.gz work; both fail with argparse errors (#119756). Use -o and --name as above. The FAQ also says a profile export carries sessions, while the profiles guide lists skills, memory, persona, cron jobs, plugins, and settings without sessions. If conversation history matters, don't rely on a profile export for it.Moving Hermes to a new machine or server
- Install Hermes on the new machine (install guide). Don't start its gateway yet.
- On the old machine:
hermes backup, and confirm it exits0. - Copy the zip over an encrypted channel, e.g.
scp ~/hermes-backup-*.zip newhost:~/. - Stop the gateway on the old machine (
hermes gateway stop, or disable its service). Two gateways using the same Telegram or Discord bot token conflict. - On the new machine:
hermes import ~/hermes-backup-<timestamp>.zip, thenhermes setuporhermes doctorto confirm providers work. - Start the gateway there (on a server, as a service — see the VPS guide) and run
hermes cron doctor.
- Absolute paths don't move. A cron job's
--workdiror a config path that doesn't exist on the new machine will fail;hermes cron doctorflags missing working directories. - Local models aren't in the zip. Re-download them on the new machine.
- The official docs don't describe exporting from or importing into Hermes Cloud or third-party managed hosts. Ask the host before assuming your data can move — see hosting.
Docker specifics
In Docker, the data directory is whatever is mounted at /opt/data. Back it up with Hermes inside the container rather than by copying files on the host, which on Docker Desktop can capture a database mid-write:
# Back up to a folder that lands on the host through the mount$docker exec hermes hermes backup -o /opt/data/backups/hermes-$(date +%F).zip$# Restore: stop the container, then run import in a one-off container$docker compose stop$docker run --rm -it -v ~/.hermes:/opt/data -v ~/Backups:/restore \$ nousresearch/hermes-agent import /restore/hermes-2026-09-26.zip$docker compose up -d
hermes backup/hermes import behavior with the image's documented pattern of passing a Hermes subcommand (as in docker run … nousresearch/hermes-agent setup). The official Docker guide does not give a backup recipe, and we have not run these exact commands. Writing into /opt/data/backups/ relies on the documented rule that full backups don't nest the backups/ folder.Moving from a native install to Docker (or back) uses the same zip: the archive holds the data directory's contents, and the container treats /opt/data as that directory.
Securing backup files
- A full backup is a credential file. It includes
.env(provider API keys, bot tokens) andauth.json(OAuth tokens) for every profile. The official FAQ states both are included. - Encrypt before it leaves the machine (for example with
ageorgpg), and never commit it to a Git repository, including private ones. - Sessions and memory are personal data.
state.dbholds every conversation, including anything you pasted. A profile export has no keys but still carries memory andSOUL.md. - If a backup leaks, rotate the keys and tokens it contained; deleting the file doesn't revoke them.
- Browser profiles are excluded from full backups on purpose, because they hold real browser cookies and saved logins.
When state.db is the problem
Many people look up backups after sessions vanish or Hermes reports its database is locked or corrupt. Some context: v0.21.0 (August 31, 2026) rewrote how the session store handles connections, and for some installs it made state.db fragile. v0.21.2 (September 11), titled “The state.db Patch Release”, lists six fixes closing 44 issues; later releases continued the work. On Docker Desktop, see the bind-mount trap.
$hermes gateway stop # stop EVERY Hermes process: gateway, Desktop, dashboard$hermes doctor # names any process still holding the database$hermes sessions recover --source ~/.hermes/state.db --inspect-only # read-only check
- Don't delete
state.db-walorstate.db-shm. The write-ahead log can hold conversations not yet instate.db; deleting it is how a recoverable state becomes real data loss. - Don't copy
state.dbon its own as a backup — the three files form one image. Usehermes backup. - Don't run
hermes doctor --fixwhile Hermes processes are running, and don't ask the agent to repair its own database. - If recovery isn't possible, restore the newest snapshot from
state-snapshots/or your last full backup.
HERMES_HOME before you need it.Primary sources
- CLI reference: hermes backup and hermes import — official docs
- FAQ: exporting to another machine; backup vs profile export — official docs
- Profiles: sharing a profile — official docs
- Sessions: export formats — official docs
- Session storage recovery — official docs
- Slash commands: /snapshot — official docs
- Hermes Docker Setup (state.db on mounted filesystems) — official docs
- Hermes Agent v0.21.2 release notes (state.db patch release)
- Issue #119756: documented CLI examples that fail
HermesAgentAI.org is an independent educational documentation resource and community guide. It is not affiliated with, sponsored by, or endorsed by Nous Research or FlyHermes. Hermes Agent is released under the MIT License by Nous Research.
Where to go next
The server you're migrating to: service install, updates, and hardening.
The /opt/data volume and the SQLite trap on Docker Desktop.
What the memory files in your backup actually hold.
What moving between local, VPS, and managed hosting involves.