OpenClaw MongoDB Semantic Memory
by @mrlynn
MongoDB-backed long-term semantic memory for recalling, storing, searching, and managing facts, decisions, and user preferences across sessions.
clawhub install openclaw-memory-skillπ About This Skill
OpenClaw Memory β Agent Skill
MongoDB-backed long-term memory with Voyage AI semantic search
When to Use
Use OpenClaw Memory when:
NOT for:
Available Tools
memory_search
Semantically search long-term memory. Use this to recall prior decisions, preferences, context, or facts.
memory_search({
query: "What did we decide about the database schema?",
maxResults: 6 // optional, default: 6
})
Returns: Array of memories with similarity scores, text, tags, and metadata.
When to use:
Example output:
{
"results": [
{
"id": "507f1f77bcf86cd799439011",
"text": "Decided to use MongoDB for vector storage with Atlas Search",
"score": 0.89,
"tags": ["decision", "database"],
"createdAt": "2026-02-20T14:30:00Z"
}
]
}
memory_remember
Store a fact, decision, preference, or important context in long-term memory.
memory_remember({
text: "User prefers TypeScript over JavaScript for new projects",
tags: ["preference", "programming"], // optional
ttl: 2592000 // optional, 30 days default
})
Returns: Stored memory ID and confirmation.
When to use:
Best practices:
memory_get
Read a specific memory file from the workspace. Use memory_search for semantic recall; use this for targeted file reads.
memory_get({
path: "MEMORY.md",
from: 1, // optional, starting line
lines: 50 // optional, number of lines
})
Returns: File contents (text).
When to use:
memory_forget
Delete a specific memory by ID. Use memory_search first to find the memory ID.
memory_forget({
memoryId: "507f1f77bcf86cd799439011"
})
Returns: Confirmation or error.
When to use:
memory_list
Browse stored memories by recency or tag.
memory_list({
tags: "decision,database", // optional, comma-separated
limit: 10, // optional, default: 10
sort: "desc" // optional, "desc" or "asc"
})
Returns: Array of memories with metadata (no similarity scores).
When to use:
memory_status
Check memory system health and stats.
memory_status()
Returns: Daemon status, MongoDB connection, Voyage AI status, total memories, uptime.
When to use:
Configuration
Memory tools connect to a daemon at http://localhost:7654 by default. Configuration is set in ~/.openclaw/openclaw.json:
{
plugins: {
entries: {
"openclaw-memory": {
enabled: true,
config: {
daemonUrl: "http://localhost:7654",
agentId: "openclaw",
maxResults: 6,
minScore: 0.5,
defaultTtl: 2592000 // 30 days
}
}
}
}
}
Automatic Memory Capture
OpenClaw Memory includes lifecycle hooks that capture memories automatically:
auto-remember Hook
Fires after every agent response. Extracts facts, decisions, and preferences using pattern matching:
Limits: Max 5 extractions per message, min 10 chars, deduplicates.
session-to-memory Hook
Fires when starting a new session. Summarizes the ending session and stores it as a searchable memory.memory-bootstrap Hook
Fires on agent startup. Queries for relevant memories (preferences, recent decisions, pinned items) and injects them into context.memory-enriched-tools Hook
Fires before tool results are saved. Appends related memories as context annotations to Read/Grep/Glob/Bash outputs.To disable hooks: Set hooksEnabled: false in plugin config.
Workflow Examples
Example 1: Recall Prior Decision
User asks: "What did we decide about the API authentication?"
Agent response:
1. Call memory_search({ query: "API authentication decision" })
2. Review results
3. Answer based on stored memory
4. If no results, say "I don't have any memory of that decision"
Example 2: Store Preference
User says: "I prefer Material UI over Tailwind for all React projects"
Agent response:
1. Acknowledge the preference
2. Call memory_remember({ text: "User prefers Material UI over Tailwind for React projects", tags: ["preference", "ui"] })
3. Confirm it's stored: "Got it, I'll remember that preference"
Example 3: Check Before Recommending
User asks: "What CSS framework should we use?"
Agent response:
1. Call memory_search({ query: "CSS framework preference" })
2. If match found: "You previously preferred Material UI over Tailwind"
3. If no match: Provide recommendation based on context
Example 4: Session Continuity
New session starts:
1. memory-bootstrap hook auto-runs
2. Loads recent preferences, decisions, project context
3. Agent has continuity without user repeating everything
Tips & Best Practices
Do:
memory_search before answering questions about past workpreference, decision, fact, project-name)Don't:
memory_forget sparingly)memory_remember calls (hooks handle most)Search Tips:
minScore: 0.5 filters low-relevance resultsTTL Guidelines:
Troubleshooting
"Memory daemon not reachable"
curl http://localhost:7654/healthcd openclaw-memory && pnpm dev:daemondocker compose up -d"No memories found"
memory_list({ limit: 5 })openclaw by default)minScore threshold in config"Memory search returns irrelevant results"
minScore threshold (default: 0.5)"Tools not available"
openclaw.jsonopenclaw plugins listAdvanced Features
Web Dashboard
Full installation includes a web dashboard at http://localhost:3002:
Reflection Pipeline
9-stage processing pipeline for:
Trigger reflection:
curl -X POST http://localhost:7654/reflect \
-H "Content-Type: application/json" \
-d '{"agentId":"openclaw"}'
Graph Relationships
Memories can be connected via edges:
SUPPORTS β reinforces/supports another memoryCONTRADICTS β conflicts with another memoryDERIVES_FROM β built upon another memoryCO_OCCURS β frequently appears togetherPRECEDES β temporal sequenceMENTIONS_ENTITY β references an entityAccess via web dashboard at /graph.
Requirements
Installation
# Install plugin
openclaw plugins install openclaw-memoryStart daemon
cd openclaw-memory
pnpm install && pnpm dev:daemonOr use Docker
docker compose up -d
Summary
OpenClaw Memory gives agents persistent, searchable memory across sessions:
1. Search semantically with memory_search
2. Store facts with memory_remember
3. Automatic capture via lifecycle hooks
4. MongoDB-backed with Voyage AI embeddings
5. Web dashboard for visualization and management
Use it to build agents that remember, learn, and improve over time. π§
Version: 0.2.1 Author: Michael Lynn License: MIT Repository: https://github.com/mrlynn/openclaw-mongodb-memory
β‘ When to Use
βοΈ Configuration
Memory tools connect to a daemon at http://localhost:7654 by default. Configuration is set in ~/.openclaw/openclaw.json:
{
plugins: {
entries: {
"openclaw-memory": {
enabled: true,
config: {
daemonUrl: "http://localhost:7654",
agentId: "openclaw",
maxResults: 6,
minScore: 0.5,
defaultTtl: 2592000 // 30 days
}
}
}
}
}
π Tips & Best Practices
"Memory daemon not reachable"
curl http://localhost:7654/healthcd openclaw-memory && pnpm dev:daemondocker compose up -d"No memories found"
memory_list({ limit: 5 })openclaw by default)minScore threshold in config"Memory search returns irrelevant results"
minScore threshold (default: 0.5)"Tools not available"
openclaw.jsonopenclaw plugins list