memory-mimir 2.5.9 → 2.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +2 -3
- package/dist/cli.js +30 -149
- package/dist/cli.js.map +1 -1
- package/openclaw.plugin.json +1 -0
- package/package.json +2 -1
- package/skills/mimir-memory/SKILL.md +233 -0
package/dist/cli.d.ts
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* memory-mimir CLI — standalone installer for OpenClaw.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* npx memory-mimir
|
|
7
|
-
* npx memory-mimir
|
|
8
|
-
* npx memory-mimir setup --api-key sk-mimir-xxx # use existing API key
|
|
6
|
+
* npx memory-mimir setup --api-key sk-mimir-xxx # install with API key
|
|
7
|
+
* npx memory-mimir install # install plugin files only
|
|
9
8
|
*/
|
|
10
9
|
export {};
|
package/dist/cli.js
CHANGED
|
@@ -3,26 +3,24 @@
|
|
|
3
3
|
* memory-mimir CLI — standalone installer for OpenClaw.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* npx memory-mimir
|
|
7
|
-
* npx memory-mimir
|
|
8
|
-
* npx memory-mimir setup --api-key sk-mimir-xxx # use existing API key
|
|
6
|
+
* npx memory-mimir setup --api-key sk-mimir-xxx # install with API key
|
|
7
|
+
* npx memory-mimir install # install plugin files only
|
|
9
8
|
*/
|
|
10
9
|
import * as fs from "node:fs";
|
|
11
10
|
import * as path from "node:path";
|
|
12
11
|
import * as os from "node:os";
|
|
13
|
-
import * as readline from "node:readline";
|
|
14
12
|
import { fileURLToPath } from "node:url";
|
|
15
13
|
import { MimirClient } from "./mimir-client.js";
|
|
16
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
15
|
const __dirname = path.dirname(__filename);
|
|
18
16
|
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
19
17
|
const DEFAULT_URL = "https://api.allinmimir.com";
|
|
18
|
+
const SIGNUP_URL = "https://www.allinmimir.com";
|
|
20
19
|
function parseArgs(argv) {
|
|
21
20
|
const args = argv.slice(2); // skip node + script
|
|
22
|
-
const command = args[0] ?? "
|
|
21
|
+
const command = args[0] ?? "";
|
|
23
22
|
let url = DEFAULT_URL;
|
|
24
23
|
let apiKey = "";
|
|
25
|
-
let code = "";
|
|
26
24
|
let skipVerify = false;
|
|
27
25
|
for (let i = 1; i < args.length; i++) {
|
|
28
26
|
if (args[i] === "--url" && args[i + 1]) {
|
|
@@ -32,14 +30,11 @@ function parseArgs(argv) {
|
|
|
32
30
|
args[i + 1]) {
|
|
33
31
|
apiKey = args[++i];
|
|
34
32
|
}
|
|
35
|
-
else if (args[i] === "--code" && args[i + 1]) {
|
|
36
|
-
code = args[++i];
|
|
37
|
-
}
|
|
38
33
|
else if (args[i] === "--skip-verify") {
|
|
39
34
|
skipVerify = true;
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
|
-
return { command, url, apiKey,
|
|
37
|
+
return { command, url, apiKey, skipVerify };
|
|
43
38
|
}
|
|
44
39
|
function readConfig(configPath) {
|
|
45
40
|
try {
|
|
@@ -258,76 +253,6 @@ Match the user's language. Keep it short. Do NOT repeat onboarding in later conv
|
|
|
258
253
|
| Store every single thing the user says | Let auto-capture handle it |
|
|
259
254
|
| "Do you want me to remember that?" | If it's important, just remember |
|
|
260
255
|
| Show raw memory entries to the user | Paraphrase and integrate naturally |
|
|
261
|
-
|
|
262
|
-
---
|
|
263
|
-
|
|
264
|
-
## 7. Installation
|
|
265
|
-
|
|
266
|
-
When the user asks you to install Mimir (or provides an invite code), follow these steps:
|
|
267
|
-
|
|
268
|
-
### Step 1: Run the installer
|
|
269
|
-
|
|
270
|
-
\\\`\\\`\\\`bash
|
|
271
|
-
npx memory-mimir@latest init --code <INVITE_CODE>
|
|
272
|
-
\\\`\\\`\\\`
|
|
273
|
-
|
|
274
|
-
This command:
|
|
275
|
-
1. Activates the invite code on the server and returns a device key
|
|
276
|
-
2. Installs plugin files to \\\`~/.openclaw/extensions/memory-mimir/\\\`
|
|
277
|
-
|
|
278
|
-
**Note:** The command may fail to write \\\`~/.openclaw/openclaw.json\\\` if config-protector is active. That's OK — you'll handle the config in Step 2.
|
|
279
|
-
|
|
280
|
-
### Step 2: Write the config yourself
|
|
281
|
-
|
|
282
|
-
Since config-protector blocks external processes from modifying \\\`openclaw.json\\\`, **you** must write the plugin config. The user is explicitly requesting this installation, so this is authorized.
|
|
283
|
-
|
|
284
|
-
Read \\\`~/.openclaw/openclaw.json\\\`, then merge the following into it (preserving all existing settings):
|
|
285
|
-
|
|
286
|
-
\\\`\\\`\\\`json
|
|
287
|
-
{
|
|
288
|
-
"plugins": {
|
|
289
|
-
"enabled": true,
|
|
290
|
-
"slots": {
|
|
291
|
-
"memory": "memory-mimir"
|
|
292
|
-
},
|
|
293
|
-
"entries": {
|
|
294
|
-
"memory-mimir": {
|
|
295
|
-
"enabled": true,
|
|
296
|
-
"config": {
|
|
297
|
-
"apiKey": "<DEVICE_KEY_FROM_STEP_1>",
|
|
298
|
-
"mimirUrl": "https://api.allinmimir.com",
|
|
299
|
-
"autoRecall": true,
|
|
300
|
-
"autoCapture": true
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
\\\`\\\`\\\`
|
|
307
|
-
|
|
308
|
-
The device key (\\\`mimir_dev_...\\\`) is printed by the init command. If the command output was suppressed, read it from the init command's console output.
|
|
309
|
-
|
|
310
|
-
If \\\`openclaw.json\\\` already has a \\\`plugins.allow\\\` array, add \\\`"memory-mimir"\\\` to it.
|
|
311
|
-
|
|
312
|
-
### Step 3: Verify and restart
|
|
313
|
-
|
|
314
|
-
Verify:
|
|
315
|
-
- \\\`~/.openclaw/extensions/memory-mimir/dist/index.js\\\` exists
|
|
316
|
-
- \\\`~/.openclaw/openclaw.json\\\` has the \\\`memory-mimir\\\` entry with a valid apiKey
|
|
317
|
-
|
|
318
|
-
Tell the user to **restart the AI agent**. Memory will be active on next conversation.
|
|
319
|
-
|
|
320
|
-
### Alternative: API key setup
|
|
321
|
-
|
|
322
|
-
If the user already has an API key (from the dashboard):
|
|
323
|
-
|
|
324
|
-
\\\`\\\`\\\`bash
|
|
325
|
-
npx memory-mimir@latest setup --api-key <API_KEY>
|
|
326
|
-
\\\`\\\`\\\`
|
|
327
|
-
|
|
328
|
-
Then do Step 2 with the API key instead of the device key.
|
|
329
|
-
|
|
330
|
-
**Important**: Always use \\\`@latest\\\` to ensure the newest version is installed.
|
|
331
256
|
`;
|
|
332
257
|
function installSkill() {
|
|
333
258
|
try {
|
|
@@ -353,6 +278,13 @@ function installPlugin() {
|
|
|
353
278
|
// Copy manifest + package.json
|
|
354
279
|
fs.copyFileSync(path.join(PACKAGE_ROOT, "openclaw.plugin.json"), path.join(extensionDir, "openclaw.plugin.json"));
|
|
355
280
|
fs.copyFileSync(path.join(PACKAGE_ROOT, "package.json"), path.join(extensionDir, "package.json"));
|
|
281
|
+
// Copy skills/ (plugin-contributed SKILL.md for persistent discovery)
|
|
282
|
+
const skillsSrc = path.join(PACKAGE_ROOT, "skills");
|
|
283
|
+
if (fs.existsSync(skillsSrc)) {
|
|
284
|
+
fs.cpSync(skillsSrc, path.join(extensionDir, "skills"), {
|
|
285
|
+
recursive: true,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
356
288
|
// Copy node_modules/ (runtime dependencies)
|
|
357
289
|
const nmSrc = path.join(PACKAGE_ROOT, "node_modules");
|
|
358
290
|
if (fs.existsSync(nmSrc)) {
|
|
@@ -368,7 +300,7 @@ function installPlugin() {
|
|
|
368
300
|
}
|
|
369
301
|
function printSuccess() {
|
|
370
302
|
console.log(`
|
|
371
|
-
✅ Memory activated! Restart
|
|
303
|
+
✅ Memory activated! Restart your AI agent to start.
|
|
372
304
|
|
|
373
305
|
After restart, try:
|
|
374
306
|
- Introduce yourself (name, job, interests) — I'll remember
|
|
@@ -378,70 +310,24 @@ function printSuccess() {
|
|
|
378
310
|
Chat normally — important details are captured automatically.
|
|
379
311
|
`);
|
|
380
312
|
}
|
|
381
|
-
function
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
const rl = readline.createInterface({
|
|
386
|
-
input: process.stdin,
|
|
387
|
-
output: process.stdout,
|
|
388
|
-
});
|
|
389
|
-
return new Promise((resolve) => {
|
|
390
|
-
rl.question("\x1b[1m Enter invite code (or press Enter to skip): \x1b[0m", (answer) => {
|
|
391
|
-
rl.close();
|
|
392
|
-
resolve(answer.trim());
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
async function cmdInit(url, code) {
|
|
397
|
-
// If no code provided, prompt interactively
|
|
398
|
-
if (!code) {
|
|
399
|
-
code = await promptForCode();
|
|
400
|
-
}
|
|
401
|
-
if (!code) {
|
|
402
|
-
console.log(`
|
|
403
|
-
Mimir is in closed beta. You need an invite code to get started.
|
|
404
|
-
Get one at: https://www.allinmimir.com
|
|
313
|
+
function printUsage() {
|
|
314
|
+
console.log(`
|
|
315
|
+
Mimir — Long-term memory for your AI agent.
|
|
405
316
|
|
|
406
|
-
Usage:
|
|
317
|
+
Usage:
|
|
318
|
+
npx memory-mimir setup --api-key <KEY> Install with API key
|
|
319
|
+
npx memory-mimir install Install plugin files only
|
|
320
|
+
|
|
321
|
+
Get your API key at: ${SIGNUP_URL}
|
|
407
322
|
`);
|
|
408
|
-
process.exit(1);
|
|
409
|
-
}
|
|
410
|
-
code = code.toUpperCase().trim();
|
|
411
|
-
const client = new MimirClient({ url });
|
|
412
|
-
let deviceData;
|
|
413
|
-
try {
|
|
414
|
-
deviceData = await client.deviceInit({ inviteCode: code });
|
|
415
|
-
}
|
|
416
|
-
catch (err) {
|
|
417
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
418
|
-
if (msg.includes("not found")) {
|
|
419
|
-
console.error("\n ✗ Invalid invite code.\n");
|
|
420
|
-
}
|
|
421
|
-
else if (msg.includes("expired")) {
|
|
422
|
-
console.error("\n ✗ Invite code expired.\n");
|
|
423
|
-
}
|
|
424
|
-
else if (msg.includes("already activated")) {
|
|
425
|
-
console.error("\n ✗ This invite code was already used. Add new devices via Dashboard → API key.\n");
|
|
426
|
-
}
|
|
427
|
-
else if (msg.includes("maximum devices")) {
|
|
428
|
-
console.error("\n ✗ Maximum devices reached. Add new devices via Dashboard → API key.\n");
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
console.error(`\n ✗ ${msg}\n`);
|
|
432
|
-
}
|
|
433
|
-
process.exit(1);
|
|
434
|
-
}
|
|
435
|
-
installPlugin();
|
|
436
|
-
installSkill();
|
|
437
|
-
const configPath = path.join(os.homedir(), ".openclaw", "openclaw.json");
|
|
438
|
-
writeConfig(configPath, deviceData.device_key, url);
|
|
439
|
-
printSuccess();
|
|
440
323
|
}
|
|
441
324
|
async function cmdSetup(url, apiKey, skipVerify) {
|
|
442
325
|
if (!apiKey) {
|
|
443
326
|
console.log(`
|
|
444
|
-
|
|
327
|
+
✗ API key required.
|
|
328
|
+
|
|
329
|
+
Get your API key at: ${SIGNUP_URL}
|
|
330
|
+
Then run: npx memory-mimir setup --api-key <YOUR_KEY>
|
|
445
331
|
`);
|
|
446
332
|
process.exit(1);
|
|
447
333
|
}
|
|
@@ -452,7 +338,8 @@ async function cmdSetup(url, apiKey, skipVerify) {
|
|
|
452
338
|
}
|
|
453
339
|
catch (err) {
|
|
454
340
|
const msg = err instanceof Error ? err.message : String(err);
|
|
455
|
-
console.error(`\n ✗ Invalid API key: ${msg}
|
|
341
|
+
console.error(`\n ✗ Invalid API key: ${msg}`);
|
|
342
|
+
console.error(` Get a valid key at: ${SIGNUP_URL}\n`);
|
|
456
343
|
process.exit(1);
|
|
457
344
|
}
|
|
458
345
|
}
|
|
@@ -463,24 +350,18 @@ async function cmdSetup(url, apiKey, skipVerify) {
|
|
|
463
350
|
printSuccess();
|
|
464
351
|
}
|
|
465
352
|
async function main() {
|
|
466
|
-
const { command, url, apiKey,
|
|
353
|
+
const { command, url, apiKey, skipVerify } = parseArgs(process.argv);
|
|
467
354
|
switch (command) {
|
|
468
|
-
case "init":
|
|
469
|
-
await cmdInit(url, code);
|
|
470
|
-
break;
|
|
471
355
|
case "setup":
|
|
472
356
|
await cmdSetup(url, apiKey, skipVerify);
|
|
473
357
|
break;
|
|
474
358
|
case "install":
|
|
475
359
|
installPlugin();
|
|
476
360
|
installSkill();
|
|
361
|
+
console.log("\n ✅ Plugin files installed.\n");
|
|
477
362
|
break;
|
|
478
363
|
default:
|
|
479
|
-
|
|
480
|
-
console.log(" npx memory-mimir init --code CODE # activate with invite code");
|
|
481
|
-
console.log(" npx memory-mimir init # interactive setup");
|
|
482
|
-
console.log(" npx memory-mimir setup --api-key X # use existing API key");
|
|
483
|
-
console.log(" npx memory-mimir install # install plugin + skill only");
|
|
364
|
+
printUsage();
|
|
484
365
|
process.exit(0);
|
|
485
366
|
}
|
|
486
367
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EA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EAAE,eAAe,CAAC,CAAC;IACzE,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAErC,YAAY,EAAE,CAAC;AACjB,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAErE,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,MAAM,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YACxC,MAAM;QACR,KAAK,SAAS;YACZ,aAAa,EAAE,CAAC;YAChB,YAAY,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAC/C,MAAM;QACR;YACE,UAAU,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,oBAAoB,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memory-mimir",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.10",
|
|
4
4
|
"description": "Long-term memory for OpenClaw powered by Mimir (graph + vector + BM25)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
+
"skills",
|
|
15
16
|
"openclaw.plugin.json",
|
|
16
17
|
"README.md"
|
|
17
18
|
],
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mimir-memory
|
|
3
|
+
description: >
|
|
4
|
+
Long-term memory powered by Mimir. You can remember across conversations.
|
|
5
|
+
A <memories> block is automatically injected before each conversation with relevant context.
|
|
6
|
+
You have tools to search deeper and store important facts — use them proactively and silently.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Mimir Memory — Behavioral Guide
|
|
10
|
+
|
|
11
|
+
## Core Principle
|
|
12
|
+
|
|
13
|
+
You have long-term memory. Use it naturally. From the user's perspective, you simply **remember** — never mention tool names, never say "let me search my memory", never expose the mechanics.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. Reading Your Memories
|
|
18
|
+
|
|
19
|
+
Before each conversation, a `<memories>` block may appear with auto-recalled context. Understand its scope:
|
|
20
|
+
|
|
21
|
+
**What auto-recall covers:**
|
|
22
|
+
- Factual records (event_log): things the user did, said, decided
|
|
23
|
+
- Known entities: people, places, projects the user mentioned
|
|
24
|
+
- Relationships: how entities connect to each other
|
|
25
|
+
|
|
26
|
+
**What auto-recall does NOT cover:**
|
|
27
|
+
- Full conversation summaries (episodes) — it never searches these
|
|
28
|
+
- Raw documents — it never searches these
|
|
29
|
+
- Predictions/plans (foresights) — it never searches these
|
|
30
|
+
|
|
31
|
+
**How auto-recall constructs its query:**
|
|
32
|
+
- Short messages (≤100 chars): uses the user's exact words
|
|
33
|
+
- Long messages (>100 chars): extracts up to 8 English keywords, or first 200 chars for Chinese/Japanese/Korean
|
|
34
|
+
- Basic time keywords (昨天, last week, 上个月, etc.) are auto-detected and used as filters
|
|
35
|
+
|
|
36
|
+
**What this means for you:**
|
|
37
|
+
- If the user asks a simple factual question and `<memories>` has the answer → just answer
|
|
38
|
+
- If the user references a past conversation or wants a summary → `<memories>` won't have it, you need to search
|
|
39
|
+
- If the user's message is long/complex → keyword extraction may have missed key terms, consider searching with a focused query
|
|
40
|
+
- If `<memories>` is empty or doesn't match the question → search proactively
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 2. When to Proactively Search
|
|
45
|
+
|
|
46
|
+
Don't wait for the user to ask you to search. Detect these cues and act silently:
|
|
47
|
+
|
|
48
|
+
### Must search (auto-recall can't help)
|
|
49
|
+
|
|
50
|
+
| Pattern | Why | How to search |
|
|
51
|
+
|---------|-----|---------------|
|
|
52
|
+
| "总结一下我们上次讨论的..." / "summarize what we talked about..." | Needs conversation summaries | `memory_types: ["episode"]` |
|
|
53
|
+
| "我之前发给你的那个文档..." / "that document I shared..." | Needs raw documents | `memory_types: ["raw_doc"]` |
|
|
54
|
+
| References a complex relationship chain | Auto-recall uses fast search without graph traversal | Search without type filter for broadest coverage |
|
|
55
|
+
|
|
56
|
+
### Should search (auto-recall likely insufficient)
|
|
57
|
+
|
|
58
|
+
| Pattern | Why | How to search |
|
|
59
|
+
|---------|-----|---------------|
|
|
60
|
+
| `<memories>` present but doesn't answer the question | Query keywords didn't match | Rephrase with more specific terms |
|
|
61
|
+
| "跟我说说关于 X 的所有事" / "tell me everything about X" | Needs multiple types | Omit memory_types for broadest results |
|
|
62
|
+
| "具体是哪天..." / "exactly when did..." | Needs precise time filtering | Use explicit `start_time`/`end_time` in ISO 8601 |
|
|
63
|
+
| User mentions a person + context auto-recall missed | Auto-recall limited to 12 items | Search with `memory_types: ["entity", "relation"]` and the person's name |
|
|
64
|
+
|
|
65
|
+
### Don't search (auto-recall is enough)
|
|
66
|
+
|
|
67
|
+
- `<memories>` already contains the answer
|
|
68
|
+
- User is asking about something new (not past conversations)
|
|
69
|
+
- User is giving you new information, not asking about old
|
|
70
|
+
|
|
71
|
+
### Query construction tips
|
|
72
|
+
|
|
73
|
+
Extract the core topic from the user's message — don't pass their full sentence:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
User: "还记得上次我跟你说我想换工作的事吗"
|
|
77
|
+
→ query: "换工作 职业规划"
|
|
78
|
+
|
|
79
|
+
User: "我跟 Caroline 上周讨论的那个设计方案怎么样了"
|
|
80
|
+
→ query: "Caroline 设计方案"
|
|
81
|
+
|
|
82
|
+
User: "what did we decide about the API rate limiting?"
|
|
83
|
+
→ query: "API rate limiting decision"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Include: names, dates, topic keywords.
|
|
87
|
+
Avoid: filler words, full sentences, vague references like "that thing".
|
|
88
|
+
|
|
89
|
+
### Time filtering
|
|
90
|
+
|
|
91
|
+
Auto-recall already detects basic patterns (yesterday, 上周, last month). But for precise control:
|
|
92
|
+
|
|
93
|
+
| User says | start_time | end_time |
|
|
94
|
+
|-----------|-----------|---------|
|
|
95
|
+
| "三月份的" | 2026-03-01T00:00:00Z | 2026-03-31T23:59:59Z |
|
|
96
|
+
| "去年夏天" | 2025-06-01T00:00:00Z | 2025-09-01T00:00:00Z |
|
|
97
|
+
| "最近三天" | (3 days ago) | (now) |
|
|
98
|
+
|
|
99
|
+
### memory_types reference
|
|
100
|
+
|
|
101
|
+
| Type | Contains | When to use |
|
|
102
|
+
|------|----------|-------------|
|
|
103
|
+
| `event_log` | Atomic facts, decisions, events with timestamps | "What did I eat Tuesday?" |
|
|
104
|
+
| `entity` | People, places, projects, concepts | "Who is Caroline?" |
|
|
105
|
+
| `relation` | How entities connect | "How do Arthur and Caroline know each other?" |
|
|
106
|
+
| `episode` | Full conversation summaries | "Summarize our Chrome extension discussion" |
|
|
107
|
+
| `raw_doc` | Documents the user shared | "That PDF I sent you" |
|
|
108
|
+
| `foresight` | Plans, predictions, future intentions | "What did I plan for next quarter?" |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 3. When to Store
|
|
113
|
+
|
|
114
|
+
**After each conversation, the full dialogue is automatically saved.** You don't need to store what was already said.
|
|
115
|
+
|
|
116
|
+
Use explicit storage ONLY for:
|
|
117
|
+
|
|
118
|
+
- **User explicitly asks**: "记住我不喝咖啡" / "remember I'm allergic to shellfish"
|
|
119
|
+
- **Critical atomic facts** that might get buried in a long conversation: a decision, a deadline, a preference
|
|
120
|
+
|
|
121
|
+
Rules:
|
|
122
|
+
- One fact per store call
|
|
123
|
+
- Include the person's name: "Arthur prefers dark roast coffee" not "prefers dark roast coffee"
|
|
124
|
+
- Don't store things the user just said (auto-capture will save the full conversation)
|
|
125
|
+
- Don't store facts already present in `<memories>`
|
|
126
|
+
- Don't ask "should I remember this?" — if it's clearly important, just store it
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 4. First Conversation (Onboarding)
|
|
131
|
+
|
|
132
|
+
If no `<memories>` block is present, the user just installed Mimir. Welcome them:
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
记忆已就绪!我现在可以跨对话记住你告诉我的事情了。
|
|
136
|
+
|
|
137
|
+
试试看:
|
|
138
|
+
- **介绍自己** — 告诉我你的名字、职业、兴趣,我会记住
|
|
139
|
+
- **让我记住什么** — 比如"记住我喜欢深色模式"
|
|
140
|
+
- **下次对话验证** — 重启后问"你还记得我吗?"
|
|
141
|
+
|
|
142
|
+
你聊天的重要内容我也会自动捕捉,不用每次都说"记住"。
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
Match the user's language. Keep it short. Do NOT repeat onboarding in later conversations where `<memories>` is present.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 5. Using `<memories>` Naturally
|
|
150
|
+
|
|
151
|
+
- Weave memories into your response — don't list them like a database query result
|
|
152
|
+
- If the answer is in `<memories>`, just answer directly — never say "based on my memory records" or "I found in my memory"
|
|
153
|
+
- If `<memories>` conflicts with what the user just said, **trust the user** — they may have changed their mind
|
|
154
|
+
- If `<memories>` is insufficient, search deeper **silently**, then answer
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 6. Anti-patterns
|
|
159
|
+
|
|
160
|
+
| Never do this | Do this instead |
|
|
161
|
+
|---------------|-----------------|
|
|
162
|
+
| "让我搜索一下记忆..." | Silently search, then answer |
|
|
163
|
+
| "根据我的记忆数据库..." | "你之前提过..." or just answer directly |
|
|
164
|
+
| "I'll use mimir_search to find that" | Just find it and answer |
|
|
165
|
+
| "I found 5 results matching your query" | Synthesize the results into a natural answer |
|
|
166
|
+
| Store every single thing the user says | Let auto-capture handle it |
|
|
167
|
+
| "Do you want me to remember that?" | If it's important, just remember |
|
|
168
|
+
| Show raw memory entries to the user | Paraphrase and integrate naturally |
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 7. Installation
|
|
173
|
+
|
|
174
|
+
When the user asks you to install Mimir or provides an API key, follow these steps:
|
|
175
|
+
|
|
176
|
+
### Step 1: Check for API key
|
|
177
|
+
|
|
178
|
+
The user must provide a Mimir API key (`sk-mimir-...`). If they don't have one:
|
|
179
|
+
|
|
180
|
+
> 你需要一个 Mimir API key。请访问 https://www.allinmimir.com 注册账号并获取 API key,然后把 key 发给我,我来帮你完成安装。
|
|
181
|
+
|
|
182
|
+
Match the user's language. Wait for them to provide the key before proceeding.
|
|
183
|
+
|
|
184
|
+
### Step 2: Run the installer
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npx memory-mimir@latest setup --api-key <API_KEY>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
This command:
|
|
191
|
+
1. Verifies the API key against the server
|
|
192
|
+
2. Installs plugin files to `~/.openclaw/extensions/memory-mimir/`
|
|
193
|
+
3. Writes plugin config to `~/.openclaw/openclaw.json`
|
|
194
|
+
|
|
195
|
+
**Note:** If the config write fails (e.g. config-protector is active), proceed to Step 3.
|
|
196
|
+
|
|
197
|
+
### Step 3: Ensure config is written
|
|
198
|
+
|
|
199
|
+
Read `~/.openclaw/openclaw.json` and verify the `memory-mimir` plugin entry exists. If missing, merge the following into it (preserving all existing settings):
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"plugins": {
|
|
204
|
+
"enabled": true,
|
|
205
|
+
"slots": {
|
|
206
|
+
"memory": "memory-mimir"
|
|
207
|
+
},
|
|
208
|
+
"entries": {
|
|
209
|
+
"memory-mimir": {
|
|
210
|
+
"enabled": true,
|
|
211
|
+
"config": {
|
|
212
|
+
"apiKey": "<API_KEY>",
|
|
213
|
+
"mimirUrl": "https://api.allinmimir.com",
|
|
214
|
+
"autoRecall": true,
|
|
215
|
+
"autoCapture": true
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
If `openclaw.json` already has a `plugins.allow` array, add `"memory-mimir"` to it.
|
|
224
|
+
|
|
225
|
+
### Step 4: Verify and restart
|
|
226
|
+
|
|
227
|
+
Verify:
|
|
228
|
+
- `~/.openclaw/extensions/memory-mimir/dist/index.js` exists
|
|
229
|
+
- `~/.openclaw/openclaw.json` has the `memory-mimir` entry with a valid apiKey
|
|
230
|
+
|
|
231
|
+
Tell the user to **restart the AI agent**. Memory will be active on next conversation.
|
|
232
|
+
|
|
233
|
+
**Important**: Always use `@latest` to ensure the newest version is installed.
|