Architecture
How the Hermes Brain memory pipeline works, stage by stage.
Hermes Brain turns raw chat sessions into durable, human-reviewed agent memory through four stages.
Stage 1 — Archiving
Raw agent sessions are exported to 04-Archives/Daily/YYYY/MM/DD/ as plain Markdown. A manifest.jsonl tracks every exported session for deduplication.
Two triggers:
- Real-time —
on_session_start/on_session_endhooks write notes instantly - Hourly cron —
hourly_archive.pycatches up on anything missed
Stage 2 — Scrubbing & candidate extraction
consolidate_memory.py runs a mechanical, LLM-free pass:
- Scrubs secrets (API keys, tokens) before anything hits disk
- Extracts candidate facts into
04-Archives/Memory-Review/ - Keeps an audit log of every action
Stage 3 — Human review
promote_memory.py --review walks you through pending candidates one by one. For each you can:
- Promote to
MEMORY.mdor your User Profile - Dismiss it
- Skip it for later
Every action lands in the consolidation audit log. Nothing auto-promotes.
Stage 4 — Permanent injection
Promoted facts sync to Hermes native MEMORY.md and USER.md via sync_to_hermes.py. These files are injected into every Hermes turn, so your agent remembers across sessions — but only what you approved.
Local git safety net
Since v1.24, session_git_snapshot.py can be wired as a Hermes on_session_end hook. It commits a local snapshot of the vault after every session (local-only, never pushes/fetches) and refuses to commit if it spots something that looks like a secret. A bad edit is one git revert away.
Folder map
04-Archives/Daily/ → raw session archives
04-Archives/Memory-Review/ → staged candidates awaiting your review
MEMORY.md / USER.md → Hermes native memory (injected every turn)
_System/Scripts/ → archive, consolidate, promote, sync scripts