How Hermes and OpenClaw Differ in Memory Architecture and Skill Management

The article analyzes Hermes Agent's three‑layer memory system—fact memory stored in tiny Markdown files, session history indexed with SQLite + FTS5, and procedural memory via skill management—then compares each layer to OpenClaw's architecture and explains how to integrate self‑summarizing skills into OpenClaw.

Architect
Architect
Architect
How Hermes and OpenClaw Differ in Memory Architecture and Skill Management

Three‑Layer Memory Model in Hermes

Hermes separates long‑term assets into three layers:

Fact memory : Small immutable Markdown files ( MEMORY.md and USER.md) that store facts, preferences, and environment conventions.

Session retrieval : A SQLite database ( ~/.hermes/state.db) with an FTS5 virtual table ( messages_fts) that indexes all past messages for full‑text search.

Procedural memory : Reusable task procedures managed by the skill_manage tool (skills).

These layers form Hermes’s closed learning loop.

Fact Memory Details

Two built‑in memory files reside under ~/.hermes/memories/: MEMORY.md – ~2,200 characters (≈800 tokens) for personal notes, environment facts, tool quirks, etc. USER.md – ~1,375 characters (≈500 tokens) for user profile, preferences, and communication style.

At session start, MemoryStore.load_from_disk() loads these files into a frozen snapshot stored in _system_prompt_snapshot. Writes during a session are persisted to disk but do not modify the current system prompt, preserving prompt‑cache stability.

Before writing, Hermes scans the content against _MEMORY_THREAT_PATTERNS (Unicode control characters, prompt‑injection patterns such as ignore previous instructions, curl with secrets, cat .env) to prevent unsafe data from entering the prompt.

File writes are atomic: a temporary file is created with tempfile.mkstemp, flushed via os.fsync(), then atomically replaced with os.replace() under an exclusive lock obtained via fcntl.flock.

SQLite + FTS5 Session Search

The SQLite database ( ~/.hermes/state.db) runs in WAL mode and stores sessions, messages, and model configuration. A virtual FTS5 table ( messages_fts) provides full‑text search, kept up‑to‑date by triggers on INSERT/DELETE/UPDATE.

Workflow of tools/session_search_tool.py:

Execute an FTS5 query, returning up to 50 matches.

Follow parent_session_id links to aggregate related sessions, excluding the current one.

Fetch full transcripts for the selected sessions.

Truncate around matches with _truncate_around_matches() (default 100 k‑character window, preferring exact phrase matches, then proximity, then word boundaries).

Optionally run a focused LLM summary via asyncio.gather and return the result.

If no query is supplied, the tool returns recent session titles, previews, and timestamps without invoking an LLM.

FTS5 defaults to AND semantics; use OR between keywords for broader recall.

Procedural Memory via Skill Management

Skills are stored under ~/.hermes/skills/ and represent reusable procedures. The skill_manage tool supports: create: New skill with YAML front‑matter and Markdown body. patch: Precise string replacement using old_string / new_string. edit: Full rewrite of the skill file. delete: Remove the entire skill directory. write_file / remove_file: Manage auxiliary files in references/, templates/, scripts/, or assets/.

Two review mechanisms trigger background evaluation:

Memory review – runs every 10 turns ( _turns_since_memory).

Skill review – runs after 10 tool‑iteration cycles ( _iters_since_skill).

When thresholds are met, a background review agent is forked via _spawn_background_review() and uses one of three prompts: _MEMORY_REVIEW_PROMPT – checks for new facts or preferences. _SKILL_REVIEW_PROMPT – looks for non‑trivial workflows, errors, or user‑requested improvements to create or patch a skill. _COMBINED_REVIEW_PROMPT – evaluates both.

If nothing valuable is found, the agent replies Nothing to save.. Successful actions generate concise notifications, e.g., 💾 Memory updated · Skill 'docker-network-fix' created.

All skill modifications pass through tools.skills_guard for security scanning; unsafe changes are rolled back.

External Memory Providers

Hermes can augment built‑in memory with a single external provider (Honcho, Mem0, Hindsight, Supermemory, etc.). Provider lifecycle hooks include prefetch, sync_turn, on_turn_start, on_session_end, on_pre_compress, on_memory_write, and on_delegation. They prefetch results before the tool loop, inject a sanitized context block next to the user message, and sync back after the turn.

External providers never replace the built‑in MEMORY.md / USER.md; they act as an additive layer.

Integrating Self‑Summarizing Skills into OpenClaw

To bring Hermes‑style learning to OpenClaw, focus on where the new mechanism is placed:

Import existing MEMORY.md, USER.md, workspace rules, and skills into OpenClaw‑readable locations (e.g., ~/.openclaw/skills/).

Add a runtime skill‑creation pipeline that supports create, patch, edit, and delete, with security scans analogous to Hermes.

Update the agent prompt to encode the policy: facts → memory files, history → session search, procedures → skill manager.

OpenClaw already supports Honcho, memory search, and experimental dreaming, so the integration mainly moves the “experience archiving” step from an offline cron job to the active runtime path where skills are automatically evaluated, stored, and invoked.

Key Takeaways

Long‑term assets should be split into fact memory, session history, and procedural skills.

Fact memory is tiny, immutable, and loaded as a frozen snapshot to keep the system prompt stable.

Session history is stored in a searchable SQLite + FTS5 database, acting as an archive rather than a live prompt.

Procedural knowledge lives in skills that can be created, patched, and deleted, with background review ensuring quality.

External providers are additive, not replacements, and integrate via well‑defined hooks.

Integrating Hermes‑style learning into OpenClaw requires moving skill creation into the runtime loop and aligning guidance, not merely copying files.

References

https://github.com/NousResearch/hermes-agent
https://hermes-agent.nousresearch.com/docs/user-guide/features/memory
https://hermes-agent.nousresearch.com/docs/user-guide/features/skills
https://hermes-agent.nousresearch.com/docs/user-guide/sessions
https://hermes-agent.nousresearch.com/docs/user-guide/features/memory-providers
https://hermes-agent.nousresearch.com/docs/user-guide/features/honcho
https://docs.openclaw.ai/concepts/memory-honcho
https://docs.openclaw.ai/concepts/memory-search
https://docs.openclaw.ai/concepts/dreaming
https://docs.openclaw.ai/tools/skills
Hermes memory layers
Hermes memory layers
OpenClaw integration diagram
OpenClaw integration diagram
memory managementSQLiteAgent architectureFTS5skill managementOpenClawHermes AgentExternal Memory Provider
Architect
Written by

Architect

Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.