Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Memory: Moltis vs OpenClaw

This page provides a detailed comparison of the memory systems in Moltis and OpenClaw. Both projects share the same core architecture for long-term memory, but differ in implementation details, tool surface, and configuration.

Overview

Both systems follow the same fundamental approach: plain Markdown files are the source of truth for agent memory, indexed for semantic search using hybrid vector + keyword retrieval. The agent reads from memory via search tools and writes to memory via file-writing tools (either dedicated or general-purpose).

Feature Comparison

Storage and Indexing

FeatureMoltisOpenClaw
Storage formatMarkdown files on diskMarkdown files on disk
Index storageSQLite (per data dir)SQLite (per agent)
Default backendBuilt-in (SQLite + FTS5 + vector)Built-in (SQLite + BM25 + vector)
Alternative backendQMD (sidecar, BM25 + vector + reranking)QMD (sidecar, BM25 + vector + reranking)
Keyword searchFTS5BM25
Vector searchCosine similarityCosine similarity
Hybrid scoringConfigurable vector/keyword weightsConfigurable vector/text weights
ChunkingMarkdown-aware (~400 tokens, configurable)Markdown-aware (~400 tokens, 80-token overlap)
Embedding cacheSQLite with LRU evictionSQLite, chunk-level
File watchingReal-time sync via notifyFile watcher with 1.5s debounce
Auto-reindex on provider changeNo (manual)Yes (fingerprint-based)

Embedding Providers

ProviderMoltisOpenClaw
Local GGUFEmbeddingGemma-300M via llama-cpp-2Auto-download GGUF (~0.6 GB)
Ollamanomic-embed-textNot listed
OpenAItext-embedding-3-smallVia API key
GeminiNot availableVia API key
VoyageNot availableVia API key
Custom endpointOpenAI-compatibleNot listed
Batch embeddingOpenAI batch API (50% cost saving)OpenAI, Gemini, Voyage batch
Fallback chainAuto-detect + circuit breakerAuto-select in priority order
Offline supportYes (local embeddings)Yes (local embeddings)

Memory Files

AspectMoltisOpenClaw
Data directory~/.moltis/ (configurable)~/.openclaw/workspace/
Long-term memoryMEMORY.mdMEMORY.md
Daily logsmemory/YYYY-MM-DD.mdmemory/YYYY-MM-DD.md
Session transcriptsmemory/sessions/*.mdSession JSONL files (separate)
Extra pathsVia memory_dirs configVia memorySearch.extraPaths
MEMORY.md loadingAlways available in system promptOnly in private sessions (not group chats)

Agent Tools

This is where the two systems differ most significantly in approach.

ToolMoltisOpenClaw
memory_searchDedicated tool, hybrid searchDedicated tool, hybrid search
memory_getDedicated tool, by chunk IDDedicated tool, by path + optional line range
memory_saveDedicated tool with path validationNo dedicated tool
General file writingexec tool (shell commands)Generic write_file tool
Silent memory turnPre-compaction flush via MemoryWriterPre-compaction flush via write_file

How “Remember X” Works

When a user says “remember that I prefer dark mode”, here is how each system handles it:

Moltis: The agent calls the memory_save tool directly:

{
  "content": "User prefers dark mode.",
  "file": "MEMORY.md",
  "append": true
}

The memory_save tool validates the path, writes the file, and re-indexes it so the content is immediately searchable. The agent does not need shell access or a generic file-writing tool.

OpenClaw: The agent calls the generic write_file tool (which is also used for writing code, configs, and any other file):

{
  "path": "MEMORY.md",
  "content": "User prefers dark mode.",
  "append": true
}

The system prompt instructs the agent which paths are for memory. The tool itself has no special memory awareness – it is a general-purpose file writer. The memory indexer’s file watcher detects the change and re-indexes asynchronously (1.5s debounce).

Key difference: Moltis uses a purpose-built memory_save tool with built-in path validation (only MEMORY.md and memory/*.md are writable) and immediate re-indexing. OpenClaw uses a general-purpose write_file tool that can write anywhere, relying on the system prompt to guide the agent to memory paths and the file watcher to re-index.

Session Memory and Compaction

FeatureMoltisOpenClaw
Session storageSQLite databaseJSONL files (append-only, tree structure)
Auto-compactionYes, near context window limitYes, near context window limit
Manual compactionNot yet/compact command with optional instructions
Pre-compaction memory flushSilent turn via MemoryWriter traitSilent turn via write_file tool
Flush visibilityCompletely hidden from userHidden via NO_REPLY convention
Session export to memoryMarkdown files in memory/sessions/Optional (sessionMemory experimental flag)
Session pruningNot yetCache-TTL based, trims old tool results
Session transcript indexingVia session exportExperimental, async delta-based

Pre-Compaction Memory Flush: Detailed Comparison

Both systems run a hidden LLM turn before compaction to persist important context. The implementation differs:

Moltis:

  • The gateway detects that compaction is needed
  • A run_silent_memory_turn() call creates a temporary agent loop with a write_file tool backed by MemoryWriter
  • The MemoryWriter trait is implemented by MemoryManager, which validates paths and re-indexes after writing
  • The LLM’s response text is discarded
  • Written file paths are returned to the caller for logging

OpenClaw:

  • A soft threshold (default 4000 tokens below compaction trigger) activates the flush
  • The flush executes as a regular turn with NO_REPLY prefix to suppress user-facing output
  • The agent writes memory files via the same write_file tool used during normal conversation
  • Flush state is tracked in sessions.json (memoryFlushAt, memoryFlushCompactionCount) to run once per compaction cycle
  • Skipped for read-only workspaces

Write Path Security

AspectMoltisOpenClaw
Path validationStrict allowlist (MEMORY.md, memory.md, memory/*.md)No special memory path restrictions
Traversal preventionRejects .., absolute paths, non-.md extensionsRelies on workspace sandboxing
Size limit50 KB per writeNo documented limit
Write scopeOnly memory filesAny file in workspace
Mechanismvalidate_memory_path() in MemoryWriterWorkspace access mode (rw/ro/none)

Search Features

FeatureMoltisOpenClaw
LLM rerankingOptional (configurable)Built-in with QMD
CitationsConfigurable (auto/on/off)Configurable (auto/on/off)
Result formatChunk ID, path, source, line range, score, textPath, line range, score, snippet (~700 chars)
FallbackKeyword-only if no embeddingsBM25-only if no embeddings

Configuration

SettingMoltis (moltis.toml)OpenClaw (openclaw.json)
Backendmemory.backend = "builtin"memory.backend = "builtin"
Providermemory.provider = "local"Auto-detect from available keys
Citationsmemory.citations = "auto"memory.citations = "auto"
LLM rerankingmemory.llm_reranking = falseVia QMD config
Session exportmemory.session_export = truememorySearch.experimental.sessionMemory
UI configurationSettings > Memory pageConfig file only
QMD settings[memory.qmd] sectionmemory.backend = "qmd"

CLI Commands

CommandMoltisOpenClaw
StatusSettings > Memory (web UI)openclaw memory status [--deep]
Index/reindexAutomatic on startupopenclaw memory index [--verbose]
SearchVia agent tool onlyopenclaw memory search "query"
Per-agent scopingSingle agent--agent <id> flag

Architecture

AspectMoltisOpenClaw
LanguageRustTypeScript/Node.js
Memory crate/modulemoltis-memory cratememory-core plugin
Write abstractionMemoryWriter trait (shared by tools and silent turn)Direct file I/O via write_file tool
Plugin systemMemory is a core crateMemory is a swappable plugin slot
Multi-agentSingle agentPer-agent memory isolation

What Moltis Has That OpenClaw Does Not

  • Dedicated memory_save tool with path validation and immediate re-indexing, reducing reliance on the system prompt for write guidance
  • Ollama embedding support as a provider option
  • Custom OpenAI-compatible embedding endpoints
  • Circuit breaker with automatic fallback chain for embedding providers
  • Web UI for memory configuration (Settings > Memory page)
  • Pure Rust implementation with zero external runtime dependencies

What OpenClaw Has That Moltis Does Not (Yet)

  • Manual /compact command with user-specified instructions
  • CLI memory commands (status, index, search) for debugging
  • Session pruning (cache-TTL based trimming of old tool results)
  • Gemini and Voyage embedding providers
  • Per-agent memory isolation for multi-agent setups
  • Automatic re-indexing on embedding provider/model change (fingerprint detection)
  • Memory plugin slot allowing third-party memory implementations
  • Flush-once-per-compaction tracking to avoid redundant silent turns
  • Configurable flush threshold (soft threshold tokens before compaction)

Summary

The two systems are architecturally equivalent – both use Markdown files, hybrid search, and pre-compaction memory flushes. The main differences are:

  1. Tool approach: Moltis provides a purpose-built memory_save tool with security validation; OpenClaw uses a general-purpose write_file tool guided by the system prompt.

  2. Write safety: Moltis validates write paths at the tool level (allowlist

    • traversal checks); OpenClaw relies on workspace-level access control.
  3. Implementation: Moltis is pure Rust with a MemoryWriter trait abstraction; OpenClaw is TypeScript with direct file I/O through a plugin system.

  4. Maturity: OpenClaw has more CLI tooling and configuration knobs for advanced memory management; Moltis has a simpler, more opinionated setup with a web UI.