Long-lived memory for your OpenClaw gateway — local SQLite, recall into context, optional LLM pipelines.
This repo is the OpenClaw extension (npm memok-ai-openclaw) that connects the gateway to the memok-ai engine. The heavy lifting (pipelines, CLI, schema) lives in memok-ai; this tree is glue: src/plugin.ts, openclaw.plugin.json, and bundled skills.
Website · memok-ai on npm · Gitee mirror · Contributing · Changelog
English | 简体中文
After openclaw plugins install, OpenClaw loads this package and registers a memory plugin. It can persist conversation transcripts to SQLite, recall candidate memories each turn (skills / tools / prepend modes), and optionally run scheduled “dreaming” pipelines that call your configured LLM — all driven by memok-ai under the hood.
Install path on disk: OpenClaw uses openclaw.plugin.json → id (currently memok-ai), not package.json name, so the live folder is ~/.openclaw/extensions/memok-ai/. Pipeline settings for the core are written to ~/.openclaw/extensions/memok-ai/config.toml (via openclaw memok setup).
- Persist + recall — store transcripts; inject recall markers; tools
memok_recall_candidate_memories/memok_report_used_memory_ids; configurable recall modes (skill,skill+hint,prepend). - Local-first memory — SQLite under your gateway; no hosted vector API required for the default path.
- Wizard + UI schema —
openclaw memok setupand gateway UI hints for LLM provider, keys, and dreaming schedule. - Optional dreaming cron — gateway-side schedule (daily time or cron) for predream / story stages; logs in SQLite
dream_logs. - Bundled skill —
skills/memok-memorydocuments how the agent should use memory tools.
You need Node.js ≥ 20, npm, git, and openclaw on PATH. Gateway compatibility: OpenClaw ≥ 2026.3.24 (see openclaw.compat in package.json).
Installs memok-ai from the default registry ("memok-ai": "^0.2.3" in package.json; plugin imports memok-ai/bridge).
bash <(curl -fsSL https://raw.githubusercontent.com/galaxy8691/memok-ai-openclaw/main/scripts/install-linux-macos.sh)scripts/install-cn-linux-macos.sh prefers cloning the plugin from Gitee and uses npmmirror for npm install. Optional: MEMOK_CORE_GIT_URL to install memok-ai from Git instead of npm.
bash <(curl -fsSL https://gitee.com/wik20/memok-ai-openclaw/raw/main/scripts/install-cn-linux-macos.sh)If registry.npmjs.org is slow, use the China script or set MEMOK_NPM_REGISTRY before the default installer.
Default (GitHub raw; core from npm):
irm https://raw.githubusercontent.com/galaxy8691/memok-ai-openclaw/main/scripts/install-windows.ps1 | iexClone plugin from Gitee (installer uses npmmirror for npm install when the clone URL is Gitee):
$env:MEMOK_REPO_URL = "https://gitee.com/wik20/memok-ai-openclaw.git"
irm https://gitee.com/wik20/memok-ai-openclaw/raw/main/scripts/install-windows.ps1 | iexWhat the installers do: npm install → npm run build → openclaw plugins install → openclaw memok setup → optional gateway restart → remove ~/.openclaw/extensions/memok-ai-openclaw-src unless MEMOK_KEEP_SOURCE=1.
Useful env vars: MEMOK_PLUGINS_INSTALL_TIMEOUT_SECONDS, MEMOK_PLUGINS_INSTALL_NO_PTY=1, MEMOK_SKIP_GATEWAY_RESTART=1, MEMOK_GATEWAY_RESTART_TIMEOUT_SECONDS, MEMOK_KEEP_SOURCE=1, MEMOK_REPO_URL / MEMOK_REPO_URL_CN / MEMOK_REPO_URL_FALLBACK, MEMOK_CORE_GIT_URL, MEMOK_CORE_GIT_REF, MEMOK_NPM_REGISTRY — see script headers; README.zh-CN.md has Chinese-oriented notes.
If plugins.allow blocks the plugin, add "memok" under plugins.allow in ~/.openclaw/openclaw.json, then run openclaw memok setup again.
Use Quick install above, or from a clone:
git clone https://github.com/galaxy8691/memok-ai-openclaw.git
cd memok-ai-openclaw
npm install && npm run build
openclaw plugins install .Gitee clone + npmmirror:
git clone https://gitee.com/wik20/memok-ai-openclaw.git
cd memok-ai-openclaw
npm install --registry https://registry.npmmirror.com && npm run build
openclaw plugins install .If npm cannot reach memok-ai, before npm install:
npm pkg set dependencies.memok-ai=git+https://gitee.com/wik20/memok-ai.git#v0.1.0
Air-gapped: point "memok-ai" at "file:/path/to/memok-ai" in package.json, then npm install.
openclaw memok setupThis writes ~/.openclaw/extensions/memok-ai/config.toml (MemokPipelineConfig) and aligns gateway-side settings. If that file is missing at startup, the plugin logs an error and skips registration until setup succeeds again.
So the extension and skills load cleanly.
Open a new OpenClaw session. Recall behavior depends on memoryRecallMode in plugin config (see openclaw.plugin.json / gateway UI). With recall + report flow, effective use of candidate memories exceeded 95% in our internal runs — your mileage varies by model and settings.
| Repository | Role | |
|---|---|---|
| Core | galaxy8691/memok-ai · Gitee | Pipelines, CLI, tests; npm memok-ai, import memok-ai/bridge. |
| Plugin (this repo) | galaxy8691/memok-ai-openclaw · Gitee | OpenClaw registration, TOML wizard, transcript hooks, skills. |
First npm install runs memok-ai’s prepare → npm run build (includes native better-sqlite3; first build can take minutes on a cold cache).
| Memok (this stack) | Typical hosted vector DB | |
|---|---|---|
| Deployment | Local SQLite | Cloud API + billing |
| Recall | Word graph, weights, sampling | Embedding similarity |
| Explainability | Inspectable rows | Mostly scores |
┌─────────────────────┐ ┌──────────────────────────┐ ┌─────────────┐
│ OpenClaw gateway │─────>│ memok-ai-openclaw │─────>│ memok-ai │
│ (plugin host) │ │ (this plugin / skills) │ │ (npm core) │
└─────────────────────┘ └────────────┬─────────────┘ └──────┬──────┘
│ │
└────────────────────────────>│
┌───────▼───────┐
│ SQLite DB │
│ (memok.sqlite)│
└───────────────┘
| Layer | Stack |
|---|---|
| Gateway | OpenClaw ≥ 2026.3.24 |
| Extension | TypeScript → dist/plugin.js, openclaw.plugin.json, skills/ |
| Memory engine | memok-ai (memok-ai/bridge), SQLite, optional LLM calls |
| Command | Purpose |
|---|---|
openclaw plugins install . |
Install from a cloned plugin directory |
openclaw memok setup |
Wizard: DB path, LLM, config.toml, gateway hints |
Pipelines, dreaming one-shots, and core CLI live in memok-ai README / README.zh-CN.
- Existing environment variables win.
- Plugin / wizard fills gaps only.
- Pipeline + LLM for this plugin:
~/.openclaw/extensions/memok-ai/config.toml(plusopenclaw.jsonfor cron / recall flags as documented in the gateway).
Most users only need openclaw memok setup.
When the dreaming cron runs, each run is stored in SQLite dream_logs: dream_date, ts, status (ok / error), log_json.
Prerequisites: Node.js ≥ 20, npm.
git clone https://github.com/galaxy8691/memok-ai-openclaw.git
cd memok-ai-openclaw
npm install
npm run build
npm run ci # lint + build + testsGit fallback for memok-ai before npm install:
npm pkg set dependencies.memok-ai=git+https://gitee.com/wik20/memok-ai.git#v0.1.0
npm installSee CONTRIBUTING.md for extension-only scope and upgrading memok-ai.
See CONTRIBUTING.md.