OpenClaw-Mem0 Plugin Adds Persistent Memory Outside Context Window

The openclaw-mem0 plugin addresses OpenClaw's default memory limitations by storing memories outside the context window, making them immune to context compaction, token limits, and session restarts.
The Memory Problem in OpenClaw
OpenClaw agents are stateless between sessions, with default memory stored in files that must be explicitly loaded. Context compaction summarizes older context to save tokens, causing injected memory to become lossy - large memory files and learned facts get compressed, rewritten, or dropped without warning.
Community workarounds like comprehensive MEMORY.md files, local BM25 + vector search engines, and SQLite-backed session logs all share the same limitation: they store memory inside the context window, making them vulnerable to compaction or session restarts.
How the Plugin Works
The plugin runs two processes on every conversation turn:
- Auto-Recall: Searches Mem0 for relevant memories before the agent responds, injecting matching context (preferences, past decisions, project details) into the working context every turn
- Auto-Capture: Sends each exchange to Mem0 after the agent responds, with Mem0's extraction layer determining what's worth persisting - new facts get stored, outdated ones updated, duplicates merged
Both processes are enabled by default on install.
Memory Structure
The plugin separates memory into two scopes:
- Long-term memories: User-scoped, persist across all sessions (name, tech stack, project structure, decisions)
- Short-term memories: Session-scoped, track active work without polluting long-term store
Both scopes are searched during every recall, with long-term memories surfaced first.
The agent gets five tools for explicit memory management:
memory_search- semantic queries across all memoriesmemory_store- explicitly save a specific factmemory_list- view all stored memoriesmemory_get- retrieve a specific memory by IDmemory_forget- delete memories (GDPR-compliant)
Setup Options
Cloud setup (easiest):
openclaw plugins install @mem0/openclaw-mem0Get an API key from app.mem0.ai, then add to openclaw.json:
{
"openclaw-mem0": {
"enabled": true,
"config": {
"apiKey": "${MEM0_API_KEY}",
"userId": "your-user-id"
}
}
}Fully local, fully private (self-hosted):
Set "mode": "open-source" and bring your own stack:
{
"openclaw-mem0": {
"enabled": true,
"config": {
"mode": "open-source",
"userId": "your-user-id",
"oss": {
"embedder": {
"provider": "ollama",
"config": {
"model": "nomic-embed-text"
}
},
"vectorStore": {
"provider": "qdrant",
"config": {
"host": "localhost",
"port": 6333
}
}
}
}
}
}📖 Read the full source: r/openclaw
👀 See Also

Phantom: A Persistent AI Agent Built with Claude's Agent SDK
Phantom is an open-source Bun/TypeScript process that wraps Claude's Agent SDK (Opus 4.6) with persistent vector memory, a self-evolution engine, and an MCP server interface. It runs continuously on its own VM or Docker Compose and communicates via Slack.

Four Claude Code Hooks Enforce Voice and Tone Consistency in AI-Written Copy
A developer built a system using four Claude Code hooks to prevent AI-generated copy from drifting off-brand. The system gates editing of copy files (.tsx, .md) until a reviewer agent validates content against a VOICE-AND-TONE.md guide.

AiPayGen: An AI Agent Marketplace with MCP Integration for Claude Code
AiPayGen is a marketplace with 142 AI agents across 27 categories including finance, legal, healthcare, DevOps, security, and marketing. It functions as an MCP server for direct use in Claude Code, allowing users to browse, invoke, and manage agents through specific commands.

Open Source Vigil Tool Addresses Agent Identity Problem in OpenClaw Ecosystem
An OpenClaw user building a web service discovered agent traffic indistinguishable from human users, prompting development of Vigil - an open source identity layer based on W3C DID that provides cryptographic credentials and behavioral history for agents.