- Notifications
You must be signed in to change notification settings - Fork5.3k
feat: add OpenClaw plugin and documentation#3964
Conversation
Add the @mem0/openclaw-mem0 plugin that provides long-term memory for OpenClaw agents:- Auto-recall injects relevant memories before agent responses- Auto-capture stores important facts after each turn- Supports both Mem0 Cloud (platform) and self-hosted (open-source) modes- Includes 5 agent tools for explicit memory operationsAlso adds integration documentation to the docs site.Co-authored-by: Cursor <cursoragent@cursor.com>
| // ============================================================================ | ||
| // Types | ||
| // ============================================================================ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
interfaces and types can go into a types.ts for better modularity and readibility
| page_size?: number; | ||
| } | ||
| interface MemoryItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
memory item can also contain run_id
| } | ||
| interface SearchOptions { | ||
| user_id: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
entities can be extracted in a single type and then extended in this type
| } | ||
| interface ListOptions { | ||
| user_id: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Same as above
| private async _init(): Promise<void> { | ||
| const { default: MemoryClient } = await import("mem0ai"); | ||
| const opts: Record<string, string> = { apiKey: this.apiKey }; | ||
| if (this.orgId) opts.org_id = this.orgId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is kind off redundant
| if (options.enable_graph) opts.enable_graph = options.enable_graph; | ||
| if (options.output_format) opts.output_format = options.output_format; | ||
| const result = await this.client.add(messages, opts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This can be done async to unblock the execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Event loop will handle this
| // Default Custom Instructions & Categories | ||
| // ============================================================================ | ||
| const DEFAULT_CUSTOM_INSTRUCTIONS = `Your Task: Extract and maintain a structured, evolving profile of the user from their conversations with an AI assistant. Capture information that would help the assistant provide personalized, context-aware responses in future interactions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Prompts can go into a separate prompts file
| - Raw code snippets (capture the intent/decision, not the code itself) | ||
| - Information the user explicitly asks not to remember`; | ||
| const DEFAULT_CUSTOM_CATEGORIES: Record<string, string> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This can also go into a constants file
| // ============================================================================ | ||
| // Config Schema | ||
| // ============================================================================ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Same as above
| ); | ||
| } | ||
| return new PlatformProvider(cfg.apiKey!, cfg.orgId, cfg.projectId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Again sending org id and project id is redundant
| // ============================================================================ | ||
| // Provider Factory | ||
| // ============================================================================ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This can go into a factory.ts
| // Tools | ||
| // ======================================================================== | ||
| api.registerTool( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
a tools.ts would have been better suited here
deshraj commentedFeb 2, 2026
Thanks Saket. Will incorporate these in the follow up PR. Right now, trying to meet the deadline. |
whysosaket commentedFeb 2, 2026
Sounds good! Approved |
3d3e875 intomainUh oh!
There was an error while loading.Please reload this page.
Zlo7 commentedFeb 12, 2026
@deshraj thanks for the OpenClaw plugin! I discovered an issue with the auto-recall feature and wanted to bring it to your attention. Issue: Auto-recall silently fails due to property name mismatch
I've submitted:
The fix is minimal and maintains all your original functionality. Would appreciate your review when you have a moment! I realize this is a pretty large repo so it isn't critical for mem0 overall, but I believe it's critical for the OpenClaw plugin. |
Uh oh!
There was an error while loading.Please reload this page.
Summary
@mem0/openclaw-mem0plugin that provides long-term memory for OpenClaw agentsmemory_search,memory_list,memory_store,memory_get,memory_forget)