openclaw-memcontext
v1.0.0
Published
OpenClaw memory plugin backed by MemContext
Readme
OpenClaw MemContext
OpenClaw memory plugin backed by MemContext.in.
It connects OpenClaw to the hosted MemContext product:
- app:
https://app.memcontext.in - api:
https://api.memcontext.in
The plugin gives OpenClaw persistent memory across sessions with:
- automatic recall before relevant user turns
- manual save and recall commands in chat
- optional automatic capture after successful turns
- project-aware memory with global fallback
Quick Start
- Create an API key in
https://app.memcontext.in - Install the plugin:
openclaw plugins install openclaw-memcontext- Run setup:
openclaw memcontext setup- Restart OpenClaw:
openclaw gateway restart- Test it in chat:
/remember I prefer pnpm over npm.
/recall pnpmWhat It Does
- searches MemContext before user turns and injects relevant memory silently
- stores memories with
source: "openclaw" - supports
/rememberand/recallin chat - exposes
memcontext_storeandmemcontext_searchtools - supports optional automatic capture of durable facts after successful turns
- supports project-aware recall with global fallback when project search is empty
Install
Published package
openclaw plugins install openclaw-memcontextLocal development link
openclaw plugins install -l /Users/ayush/Coding/WebSite/openclaw-memcontextThe published npm package is openclaw-memcontext.
After installing, run setup and then restart the gateway.
Setup
Use the interactive setup command:
openclaw memcontext setupIt will:
- ask for your MemContext API key
- confirm the API URL, defaulting to
https://api.memcontext.in - optionally ask for a fixed project scope
- ask whether to enable automatic capture after successful turns
- write config to
~/.openclaw/openclaw.json - set the OpenClaw memory slot to
openclaw-memcontext
Project scope behavior during setup:
- enter a value -> store that fixed project with
projectStrategy: "config" - leave it blank on first setup -> use
projectStrategy: "workspace" - leave it blank on rerun -> keep the existing project behavior
- enter
--> clear the fixed project and switch back to workspace-derived scope
That includes legacy configurations which may already be using projectStrategy: "none".
Auto-capture behavior during setup:
- first-time setup defaults to off unless you enable it
- rerunning setup preserves the current auto-capture setting unless you change it
API key and API URL behavior during setup:
- on first setup, you must provide an API key
- on rerun, leaving the API key blank keeps the current stored key
- leaving the API URL blank keeps the current URL, or the default hosted URL if none is stored
OpenClaw derives workspace scope from the workspace name when projectStrategy is "workspace".
Auto-Recall And Auto-Capture
Auto-recall
autoRecall is on by default.
Before a normal user turn, the plugin searches memory like this:
- if a project is resolved, search that project first
- if nothing is found, retry globally
- if no project is resolved, search globally directly
The recalled memories are injected silently into the prompt.
Auto-capture
autoCapture is optional and disabled by default unless you enable it during setup.
If enabled, after a successful turn the plugin:
- inspects the last user turn
- extracts durable candidates like preferences, facts, and decisions
- skips likely secrets and noisy content
- saves the extracted memories to MemContext
This is not full transcript dumping. It is filtered capture.
If you want to change it later, update ~/.openclaw/openclaw.json:
{
"plugins": {
"entries": {
"openclaw-memcontext": {
"config": {
"autoCapture": true
}
}
}
}
}Then restart:
openclaw gateway restartManual Configuration
You usually do not need to edit config manually, but a typical configuration looks like this:
{
"plugins": {
"slots": {
"memory": "openclaw-memcontext"
},
"entries": {
"openclaw-memcontext": {
"enabled": true,
"config": {
"apiKey": "${MEMCONTEXT_OPENCLAW_API_KEY}",
"apiUrl": "https://api.memcontext.in",
"projectStrategy": "workspace",
"autoRecall": true,
"autoCapture": false,
"maxRecallResults": 5,
"flushOnReset": false,
"flushOnCompaction": false,
"requestTimeoutMs": 8000,
"debug": false
}
}
}
}
}Chat Commands
/remember <text>: explicitly store a memory/recall <query>: explicitly search memories
Examples:
/remember I prefer pnpm over npm.
/recall pnpmCLI Commands
openclaw memcontext setup
openclaw memcontext status
openclaw memcontext searchopenclaw memcontext search is interactive and will prompt for the query.
How Memory Search Works
The plugin uses project-aware search semantics:
- if a project is resolved or configured, search that project first
- if no memory is found there, retry globally
- if no project is resolved, search globally directly
This helps keep project context relevant while still recovering useful global memories.
How To Verify It Works
Explicit save and recall
In chat:
/remember I prefer pnpm over npm.
/recall pnpmExpected:
/rememberreturnssaved,updated,extended, orduplicate/recallreturns relevant memory results
Automatic recall
- save a memory with
/remember - start a new session with
/new - ask a natural question like:
What package manager do I usually prefer?Expected:
- OpenClaw answers using the saved memory without needing
/recall
Automatic capture
If autoCapture is enabled, try:
Remember that we use pnpm for this repo.Then start a new session and ask:
What package manager do we use in this repo?Expected:
- OpenClaw recalls the saved fact in the next session
Environment Variables
The plugin resolves credentials in this order:
MEMCONTEXT_OPENCLAW_API_KEYMEMCONTEXT_API_KEYapiKeyin~/.openclaw/openclaw.json
Optional:
MEMCONTEXT_API_URL
Security notes:
- setup writes
~/.openclaw/openclaw.jsonwith0600permissions openclaw memcontext statusredacts the API key- if you prefer env-based auth, replace the stored key with
${MEMCONTEXT_OPENCLAW_API_KEY}
Update
If installed from npm:
openclaw plugins update openclaw-memcontext
openclaw gateway restartOr update all plugins:
openclaw plugins update --all
openclaw gateway restartIf installed from a local path, OpenClaw uses your local checkout directly. Restart the gateway after local changes.
Troubleshooting
Plugin loads but does not work
Run:
openclaw memcontext statusConfirm:
- the plugin is enabled
- the API URL is correct
- the API key is present and redacted
Recall is not finding anything
- verify the memory was actually saved with
/remember - test with
/recall <query>first - enable
debug: trueif needed - remember that auto-recall runs before relevant user turns, not as a visible command
Auto-capture is not saving enough
- enable
autoCapture - use phrasing that expresses durable facts, preferences, and decisions clearly
- remember that auto-capture intentionally filters noise and likely secrets
Wrong project scope
- set a fixed
projectduring setup if you want one stable scope - otherwise leave project blank and let the plugin derive scope from the workspace
Notes
- plugin runtime is local to OpenClaw; only MemContext is hosted
- MemContext API calls use standard HTTPS with
X-API-Key - saved memories from this plugin use
source: "openclaw"
