@memorilabs/openclaw-memori 0.0.9 → 0.0.11
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/README.md +99 -147
- package/dist/tools/index.js +4 -0
- package/dist/tools/memori-quota.d.ts +17 -0
- package/dist/tools/memori-quota.js +55 -0
- package/dist/tools/memori-recall-summary.js +1 -1
- package/dist/tools/memori-recall.d.ts +0 -4
- package/dist/tools/memori-recall.js +0 -4
- package/dist/tools/memori-signup.d.ts +25 -0
- package/dist/tools/memori-signup.js +72 -0
- package/dist/utils/skills-loader.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/skills/clawhub/SKILL.md +313 -0
- package/skills/memori/SKILL.md +284 -0
- package/skills/memori/skills.md +0 -65
package/README.md
CHANGED
|
@@ -25,229 +25,181 @@
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
# Memori for OpenClaw
|
|
29
29
|
|
|
30
|
-
OpenClaw
|
|
30
|
+
Memori gives OpenClaw agents a structured, long-term memory system. It automatically captures what happens and lets agents recall it on demand — so context survives across sessions without bloating the prompt.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Instead of relying solely on natural-language memory, Memori structures persistent memory from both conversation and agent trace — the agent's actions, tool results, decisions, and outcomes — so it can recall what actually happened when it matters.
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
---
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
## The problem
|
|
37
37
|
|
|
38
|
-
OpenClaw
|
|
38
|
+
OpenClaw's default memory works for simple use cases, but breaks at scale:
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
- Memory is stored as flat markdown files
|
|
41
|
+
- Context is lost due to compaction
|
|
42
|
+
- Important decisions and constraints disappear
|
|
43
|
+
- No relationships between facts
|
|
44
|
+
- Memory bleeds across users and projects
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
---
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
## What Memori changes
|
|
45
49
|
|
|
46
|
-
Memori
|
|
50
|
+
Memori replaces flat memory with structured, scoped memory built from:
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
- Agent execution (tool calls, results, decisions, outcomes)
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
Instead of replaying history, agents retrieve exactly what they need.
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
---
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
## How it works
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
Memori runs on two parallel systems:
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
### 1. Advanced augmentation
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
After each interaction, Memori converts raw session data into structured, reusable memories asynchronously.
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
- Transforms raw agent sessions into structured memory units
|
|
67
|
+
- Captures the agent's actions, reasoning, tool usage, responses, corrections, and failures
|
|
68
|
+
- Organizes into classes to enable efficient retrieval
|
|
69
|
+
- Generates embeddings for semantic retrieval
|
|
70
|
+
- Updates structured memory and the knowledge graph
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
This is how structured memory is continuously built and updated over time.
|
|
65
73
|
|
|
66
|
-
|
|
74
|
+
It runs **after the agent responds** and does not impact latency.
|
|
67
75
|
|
|
68
|
-
|
|
76
|
+
---
|
|
69
77
|
|
|
70
|
-
|
|
71
|
-
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
-
| **Structured memory storage** | Instead of raw markdown blobs, Memori stores conversations, facts, preferences, and knowledge-graph triples as structured records tied to an entity, process, and session. Facts are extracted as subject-predicate-object relationships, deduplicated over time, and connected into a graph so related memories stay queryable instead of being buried in text files. |
|
|
73
|
-
| **Advanced Augmentation** | After each conversation, Memori processes the user and assistant exchange asynchronously in the background, identifies facts, preferences, skills, and attributes, generates embeddings for semantic search, and updates the knowledge graph without blocking the agent's response path. |
|
|
74
|
-
| **Intelligent Recall** | Before the agent responds, Memori searches the current entity's stored facts and knowledge graph, ranks memories by semantic relevance and importance, and injects the most useful context into the prompt so durable knowledge survives context-window compression. |
|
|
75
|
-
| **Production-ready observability** | Memori Cloud gives you dashboard visibility into memory creation, recalls, cache hit rate, sessions, quota usage, top subjects, per-memory retrieval metrics, and knowledge-graph relationships, so you can inspect what was stored and how recall is behaving in production. |
|
|
78
|
+
### 2. Agent-controlled recall
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
Recall is **explicit and initiated by the agent**.
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
Memori separates memory creation from memory recall:
|
|
83
|
+
|
|
84
|
+
- Creation is automatic (advanced augmentation)
|
|
85
|
+
- Recall is intentional (agent-controlled)
|
|
86
|
+
|
|
87
|
+
Agents decide:
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
- When to recall
|
|
90
|
+
- What scope to recall from
|
|
91
|
+
- How much history to include
|
|
92
|
+
|
|
93
|
+
Memori does not automatically inject memory into the prompt. The agent retrieves only the context it needs, keeping token usage efficient.
|
|
94
|
+
|
|
95
|
+
Available tools:
|
|
96
|
+
|
|
97
|
+
- **`memori_recall`** — query structured memory for facts, constraints, decisions, and patterns
|
|
98
|
+
- **`memori_recall_summary`** — retrieve summaries and the daily brief
|
|
99
|
+
- **`memori_feedback`** — report on memory quality to improve the system
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Quickstart
|
|
82
104
|
|
|
83
105
|
### Prerequisites
|
|
84
106
|
|
|
85
107
|
- [OpenClaw](https://openclaw.ai) `v2026.3.2` or later
|
|
86
108
|
- A Memori API key from [app.memorilabs.ai](https://app.memorilabs.ai)
|
|
87
|
-
- An Entity ID to
|
|
88
|
-
- A Project ID to scope
|
|
109
|
+
- An Entity ID to scope memory to a specific user, agent, or system
|
|
110
|
+
- A Project ID to scope memory to a specific project or workspace
|
|
89
111
|
|
|
90
|
-
### 1. Install
|
|
112
|
+
### 1. Install
|
|
91
113
|
|
|
92
114
|
```bash
|
|
93
|
-
# Install the plugin from npm
|
|
94
115
|
openclaw plugins install @memorilabs/openclaw-memori
|
|
95
|
-
|
|
96
|
-
# Enable it in your workspace
|
|
97
116
|
openclaw plugins enable openclaw-memori
|
|
98
117
|
```
|
|
99
118
|
|
|
100
119
|
### 2. Configure
|
|
101
120
|
|
|
102
|
-
The plugin requires an API key, an Entity ID, and a Project ID. Use the built-in `memori` CLI to configure it in one step.
|
|
103
|
-
|
|
104
|
-
#### Option A: Memori CLI (Recommended)
|
|
105
|
-
|
|
106
121
|
```bash
|
|
107
122
|
openclaw memori init \
|
|
108
123
|
--api-key "YOUR_MEMORI_API_KEY" \
|
|
109
|
-
--entity-id "your-
|
|
110
|
-
--project-id "
|
|
124
|
+
--entity-id "your-app-user-id" \
|
|
125
|
+
--project-id "my-project"
|
|
111
126
|
```
|
|
112
127
|
|
|
113
|
-
|
|
128
|
+
### 3. Verify
|
|
114
129
|
|
|
115
130
|
```bash
|
|
116
131
|
openclaw gateway restart
|
|
132
|
+
openclaw memori status --check
|
|
117
133
|
```
|
|
118
134
|
|
|
119
|
-
|
|
135
|
+
Expected:
|
|
120
136
|
|
|
121
|
-
```bash
|
|
122
|
-
openclaw config set plugins.entries.openclaw-memori.config.apiKey "YOUR_MEMORI_API_KEY"
|
|
123
|
-
openclaw config set plugins.entries.openclaw-memori.config.entityId "your-entity-id"
|
|
124
|
-
openclaw config set plugins.entries.openclaw-memori.config.projectId "your-project-id"
|
|
125
|
-
openclaw gateway restart
|
|
126
137
|
```
|
|
127
|
-
|
|
128
|
-
#### Option C: Direct JSON (`~/.openclaw/openclaw.json`)
|
|
129
|
-
|
|
130
|
-
```json
|
|
131
|
-
{
|
|
132
|
-
"plugins": {
|
|
133
|
-
"entries": {
|
|
134
|
-
"openclaw-memori": {
|
|
135
|
-
"enabled": true,
|
|
136
|
-
"config": {
|
|
137
|
-
"apiKey": "your-memori-api-key",
|
|
138
|
-
"entityId": "your-entity-id",
|
|
139
|
-
"projectId": "your-project-id"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
138
|
+
Status: Ready
|
|
145
139
|
```
|
|
146
140
|
|
|
147
|
-
###
|
|
141
|
+
### 4. Test the memory loop
|
|
148
142
|
|
|
149
|
-
|
|
150
|
-
| ----------- | -------- | -------- | --------------------------------------------------------------------------------------------------- |
|
|
151
|
-
| `apiKey` | `string` | **Yes** | Your Memori API key from [app.memorilabs.ai](https://app.memorilabs.ai). |
|
|
152
|
-
| `entityId` | `string` | **Yes** | The unique identifier for the entity (e.g., user, agent, or tenant) to attribute these memories to. |
|
|
153
|
-
| `projectId` | `string` | **Yes** | Scopes all memories to a specific project or workspace. |
|
|
143
|
+
1. Tell the agent something durable:
|
|
154
144
|
|
|
155
|
-
|
|
145
|
+
> "I always use TypeScript and prefer functional patterns."
|
|
156
146
|
|
|
157
|
-
|
|
147
|
+
2. Start a new session and ask:
|
|
158
148
|
|
|
159
|
-
|
|
160
|
-
openclaw memori status --check
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
You should see:
|
|
149
|
+
> "Write a hello world script in my preferred language."
|
|
164
150
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
Entity ID: your-entity-id
|
|
170
|
-
Project ID: your-project-id
|
|
151
|
+
3. Confirm the agent used `memori_recall` to fetch your preferences:
|
|
152
|
+
```
|
|
153
|
+
[Memori] memori_recall params: {"projectId":"my-project","query":"preferred programming language"}
|
|
154
|
+
```
|
|
171
155
|
|
|
172
|
-
|
|
173
|
-
Status: Ready
|
|
174
|
-
```
|
|
156
|
+
If it works, you now have persistent memory across sessions.
|
|
175
157
|
|
|
176
|
-
|
|
158
|
+
---
|
|
177
159
|
|
|
178
|
-
|
|
179
|
-
openclaw gateway logs --filter "[Memori]"
|
|
180
|
-
```
|
|
160
|
+
## Memory model
|
|
181
161
|
|
|
182
|
-
|
|
183
|
-
[Memori] === INITIALIZING PLUGIN ===
|
|
184
|
-
[Memori] Tracking Entity ID: your-entity-id
|
|
185
|
-
```
|
|
162
|
+
Memory is scoped to prevent noise and ensure relevance:
|
|
186
163
|
|
|
187
|
-
|
|
164
|
+
- `entity_id` → user, agent, or system context
|
|
165
|
+
- `project_id` → project or workspace context
|
|
166
|
+
- `session_id` → specific session (requires `project_id`)
|
|
167
|
+
- `date_start` / `date_end` → time-bounded recall (defaults to all-time if omitted)
|
|
168
|
+
- `source` → type of memory (recall only)
|
|
169
|
+
- `signal` → how the memory was derived (recall only)
|
|
188
170
|
|
|
189
|
-
|
|
190
|
-
`I always use TypeScript and prefer functional patterns.`
|
|
191
|
-
2. Confirm augmentation ran:
|
|
192
|
-
`Augmentation successful!`
|
|
193
|
-
3. Start a new session and ask:
|
|
194
|
-
`Write a hello world script.`
|
|
195
|
-
4. Confirm recall ran:
|
|
196
|
-
`Successfully injected memory context.`
|
|
171
|
+
All timestamps are stored in **UTC**.
|
|
197
172
|
|
|
198
173
|
---
|
|
199
174
|
|
|
200
|
-
##
|
|
201
|
-
|
|
202
|
-
The plugin registers a `memori` command group in the OpenClaw CLI.
|
|
203
|
-
|
|
204
|
-
### `openclaw memori init`
|
|
205
|
-
|
|
206
|
-
Configure the plugin with your credentials. All three flags are required.
|
|
175
|
+
## Agent behavior (read this)
|
|
207
176
|
|
|
208
|
-
|
|
209
|
-
openclaw memori init \
|
|
210
|
-
--api-key <key> \
|
|
211
|
-
--entity-id <id> \
|
|
212
|
-
--project-id <id>
|
|
213
|
-
```
|
|
177
|
+
Agents should:
|
|
214
178
|
|
|
215
|
-
|
|
179
|
+
- Retrieve a summary at the start of meaningful sessions
|
|
180
|
+
- Use targeted recall (not broad queries)
|
|
181
|
+
- Avoid recalling on every turn
|
|
182
|
+
- Use memory only when context is needed
|
|
183
|
+
- Send feedback when memory is missing or incorrect
|
|
216
184
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
openclaw memori status
|
|
221
|
-
openclaw memori status --check
|
|
222
|
-
```
|
|
185
|
+
See SKILL.md for full behavior guidelines.
|
|
223
186
|
|
|
224
|
-
|
|
187
|
+
---
|
|
225
188
|
|
|
226
|
-
|
|
189
|
+
## Typical workflow
|
|
227
190
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
# Get a single value (API key is masked)
|
|
233
|
-
openclaw memori config get api-key
|
|
234
|
-
openclaw memori config get entity-id
|
|
235
|
-
openclaw memori config get project-id
|
|
236
|
-
|
|
237
|
-
# Set a single value
|
|
238
|
-
openclaw memori config set api-key "NEW_KEY"
|
|
239
|
-
openclaw memori config set entity-id "new-entity"
|
|
240
|
-
openclaw memori config set project-id "new-project"
|
|
241
|
-
```
|
|
191
|
+
1. Start session → retrieve summary
|
|
192
|
+
2. During task → targeted recall
|
|
193
|
+
3. Missing context → send feedback
|
|
194
|
+
4. End of session → memory is captured automatically
|
|
242
195
|
|
|
243
|
-
|
|
196
|
+
---
|
|
244
197
|
|
|
245
|
-
##
|
|
198
|
+
## Multi-agent ready
|
|
246
199
|
|
|
247
|
-
|
|
200
|
+
The plugin is fully stateless and thread-safe. You can run it across multiple agents in the same gateway without shared state or concurrency issues.
|
|
248
201
|
|
|
249
|
-
|
|
250
|
-
2. **`agent_end` (Advanced Augmentation):** Once the agent finishes generating its response, the plugin captures the final `user` and `assistant` messages, sanitizes them, and sends them to the Memori integration endpoint for long-term storage and entity mapping.
|
|
202
|
+
---
|
|
251
203
|
|
|
252
204
|
## Contributing
|
|
253
205
|
|
package/dist/tools/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { createMemoriSignupTool } from './memori-signup.js';
|
|
2
|
+
import { createMemoriQuotaTool } from './memori-quota.js';
|
|
1
3
|
import { createMemoriRecallTool } from './memori-recall.js';
|
|
2
4
|
import { createMemoriRecallSummaryTool } from './memori-recall-summary.js';
|
|
3
5
|
import { createMemoriFeedbackTool } from './memori-feedback.js';
|
|
4
6
|
export function registerAllTools(deps) {
|
|
7
|
+
deps.api.registerTool(createMemoriSignupTool(deps));
|
|
8
|
+
deps.api.registerTool(createMemoriQuotaTool(deps));
|
|
5
9
|
deps.api.registerTool(createMemoriRecallTool(deps));
|
|
6
10
|
deps.api.registerTool(createMemoriRecallSummaryTool(deps));
|
|
7
11
|
deps.api.registerTool(createMemoriFeedbackTool(deps));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolDeps } from './types.js';
|
|
2
|
+
export declare function createMemoriQuotaTool(deps: ToolDeps): {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {};
|
|
9
|
+
};
|
|
10
|
+
execute(_toolCallId: string): Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
details: null;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
export function createMemoriQuotaTool(deps) {
|
|
7
|
+
const { logger } = deps;
|
|
8
|
+
return {
|
|
9
|
+
name: 'memori_quota',
|
|
10
|
+
label: 'Memori Quota',
|
|
11
|
+
description: 'Retrieves the current memory usage and maximum allowed quota for the user. Use this when the user asks about their limits, storage, or how many memories they have left — or when you encounter errors suggesting memory limits have been reached and want to confirm before degrading behavior.',
|
|
12
|
+
parameters: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {},
|
|
15
|
+
},
|
|
16
|
+
async execute(_toolCallId) {
|
|
17
|
+
try {
|
|
18
|
+
logger.info('memori_quota checking usage...');
|
|
19
|
+
const tmpDir = os.tmpdir();
|
|
20
|
+
await execAsync(`npm install --prefix ${tmpDir} --no-save @memorilabs/memori@0.1.12-beta`);
|
|
21
|
+
const binPath = path.join(tmpDir, 'node_modules', '.bin', 'memori');
|
|
22
|
+
const { stdout } = await execAsync(`${binPath} quota`);
|
|
23
|
+
const result = {
|
|
24
|
+
success: true,
|
|
25
|
+
message: stdout.trim(),
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
29
|
+
details: null,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
logger.warn(`memori_quota CLI failed: ${String(e)}`);
|
|
34
|
+
let output = 'An unexpected error occurred while trying to fetch quota via the CLI.';
|
|
35
|
+
if (typeof e === 'object' && e !== null) {
|
|
36
|
+
const errObj = e;
|
|
37
|
+
const stdout = typeof errObj.stdout === 'string' ? errObj.stdout.trim() : '';
|
|
38
|
+
const stderr = typeof errObj.stderr === 'string' ? errObj.stderr.trim() : '';
|
|
39
|
+
const msg = typeof errObj.message === 'string' ? errObj.message : '';
|
|
40
|
+
output = stdout || stderr || msg || output;
|
|
41
|
+
}
|
|
42
|
+
else if (typeof e === 'string') {
|
|
43
|
+
output = e;
|
|
44
|
+
}
|
|
45
|
+
const errorResult = {
|
|
46
|
+
error: output,
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
content: [{ type: 'text', text: JSON.stringify(errorResult) }],
|
|
50
|
+
details: null,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -4,7 +4,7 @@ export function createMemoriRecallSummaryTool(deps) {
|
|
|
4
4
|
return {
|
|
5
5
|
name: 'memori_recall_summary',
|
|
6
6
|
label: 'Recall Memory Summary',
|
|
7
|
-
description: 'CRITICAL: You MUST use this tool BEFORE answering any requests for a summary, status update, daily brief, or high-level overview of a project or past sessions. Fetch summarized views of stored memories from Memori within a specific date range.',
|
|
7
|
+
description: 'CRITICAL: You MUST use this tool BEFORE answering any requests for a summary, status update, daily brief, or high-level overview of a project or past sessions. Fetch summarized views of stored memories from Memori within a specific date range. If no date range is provided, the result defaults to the last 24 hours.',
|
|
8
8
|
parameters: {
|
|
9
9
|
type: 'object',
|
|
10
10
|
properties: {
|
|
@@ -12,10 +12,6 @@ export function createMemoriRecallTool(deps) {
|
|
|
12
12
|
type: 'string',
|
|
13
13
|
description: 'REQUIRED: The natural language search query to find specific facts (e.g., "What database did we decide to use?", "Ryan\'s dogs"). DO NOT use wildcards like "*" or regex. This is a semantic search, so use real words.',
|
|
14
14
|
},
|
|
15
|
-
limit: {
|
|
16
|
-
type: 'number',
|
|
17
|
-
description: 'Maximum number of memories to return (default: 10)',
|
|
18
|
-
},
|
|
19
15
|
dateStart: {
|
|
20
16
|
type: 'string',
|
|
21
17
|
description: 'ISO 8601 (MUST be UTC) date string to filter memories created on or after this time',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ToolDeps } from './types.js';
|
|
2
|
+
export declare function createMemoriSignupTool(deps: ToolDeps): {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
email: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
required: string[];
|
|
15
|
+
};
|
|
16
|
+
execute(_toolCallId: string, params: {
|
|
17
|
+
email: string;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
content: {
|
|
20
|
+
type: "text";
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
details: null;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
export function createMemoriSignupTool(deps) {
|
|
7
|
+
const { logger } = deps;
|
|
8
|
+
return {
|
|
9
|
+
name: 'memori_signup',
|
|
10
|
+
label: 'Memori Sign Up',
|
|
11
|
+
description: 'CRITICAL: You MUST use this tool when the user asks to sign up, create an account, or get an API key for Memori — or when you encounter a missing MEMORI_API_KEY error and the user provides their email. If the user has not provided an email address, ask for it first. Do not guess or hallucinate an email.',
|
|
12
|
+
parameters: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
email: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'The email address to send the Memori API key to.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ['email'],
|
|
21
|
+
},
|
|
22
|
+
async execute(_toolCallId, params) {
|
|
23
|
+
try {
|
|
24
|
+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
25
|
+
if (!emailRegex.test(params.email)) {
|
|
26
|
+
const errorResult = {
|
|
27
|
+
error: `The email you provided "${params.email}" is not valid. Please provide a standard email address.`,
|
|
28
|
+
};
|
|
29
|
+
logger.warn(`memori_signup rejected email format: ${params.email}`);
|
|
30
|
+
return {
|
|
31
|
+
content: [{ type: 'text', text: JSON.stringify(errorResult) }],
|
|
32
|
+
details: null,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
logger.info(`memori_signup attempting to sign up: ${params.email}`);
|
|
36
|
+
const tmpDir = os.tmpdir();
|
|
37
|
+
await execAsync(`npm install --prefix ${tmpDir} --no-save @memorilabs/memori@0.1.12-beta`);
|
|
38
|
+
const binPath = path.join(tmpDir, 'node_modules', '.bin', 'memori');
|
|
39
|
+
const { stdout } = await execAsync(`${binPath} sign-up ${params.email}`);
|
|
40
|
+
const result = {
|
|
41
|
+
success: true,
|
|
42
|
+
message: stdout.trim(),
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: 'text', text: JSON.stringify(result) }],
|
|
46
|
+
details: null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
logger.warn(`memori_signup CLI failed: ${String(e)}`);
|
|
51
|
+
let output = 'An unexpected error occurred while trying to sign up via the CLI.';
|
|
52
|
+
if (typeof e === 'object' && e !== null) {
|
|
53
|
+
const errObj = e;
|
|
54
|
+
const stdout = typeof errObj.stdout === 'string' ? errObj.stdout.trim() : '';
|
|
55
|
+
const stderr = typeof errObj.stderr === 'string' ? errObj.stderr.trim() : '';
|
|
56
|
+
const msg = typeof errObj.message === 'string' ? errObj.message : '';
|
|
57
|
+
output = stdout || stderr || msg || output;
|
|
58
|
+
}
|
|
59
|
+
else if (typeof e === 'string') {
|
|
60
|
+
output = e;
|
|
61
|
+
}
|
|
62
|
+
const errorResult = {
|
|
63
|
+
error: output,
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: 'text', text: JSON.stringify(errorResult) }],
|
|
67
|
+
details: null,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -6,7 +6,7 @@ import { readFileSync } from 'fs';
|
|
|
6
6
|
*/
|
|
7
7
|
export function loadSkillsContent(resolvePath) {
|
|
8
8
|
try {
|
|
9
|
-
return readFileSync(resolvePath('skills/memori/
|
|
9
|
+
return readFileSync(resolvePath('skills/memori/SKILL.md'), 'utf-8');
|
|
10
10
|
}
|
|
11
11
|
catch {
|
|
12
12
|
return '';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.11";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '0.0.
|
|
1
|
+
export const SDK_VERSION = '0.0.11';
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memorilabs/openclaw-memori",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Official MemoriLabs.ai long-term memory plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -67,6 +67,6 @@
|
|
|
67
67
|
"@hono/node-server": "^1.19.10"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@memorilabs/memori": "0.1.
|
|
70
|
+
"@memorilabs/memori": "0.1.12-beta"
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memori
|
|
3
|
+
id: '@memorilabs/openclaw-memori'
|
|
4
|
+
description: Long-term memory for OpenClaw agents using the Memori SDK. Automatically captures conversations and execution trace, and equips the agent with explicit tools to recall context, manage its account, and monitor usage across sessions.
|
|
5
|
+
license: MIT
|
|
6
|
+
compatibility:
|
|
7
|
+
- openclaw
|
|
8
|
+
metadata:
|
|
9
|
+
openclaw:
|
|
10
|
+
requires:
|
|
11
|
+
env:
|
|
12
|
+
- MEMORI_API_KEY
|
|
13
|
+
- ENTITY_ID
|
|
14
|
+
- PROJECT_ID
|
|
15
|
+
bins:
|
|
16
|
+
- memori
|
|
17
|
+
primaryEnv: MEMORI_API_KEY
|
|
18
|
+
externalServices:
|
|
19
|
+
- https://api.memorilabs.ai
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Memori skills file
|
|
23
|
+
|
|
24
|
+
You have access to Memori, agent-native memory infrastructure: an LLM-agnostic layer that structures memory from not just natural language, but also from agent trace that comes from execution.
|
|
25
|
+
|
|
26
|
+
Memori automatically captures and structures memory from conversation and execution trace — including the agent's actions, tool results, decisions, and outcomes — and allows you to retrieve it on demand. Use it to maintain continuity across sessions, preserve decisions and constraints, and help the agent understand what it actually did so the next time it completes a task, it is more accurate and efficient.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Core instruction
|
|
31
|
+
|
|
32
|
+
At the start of a session, you should check the `SKILL.md` file
|
|
33
|
+
|
|
34
|
+
Use it to understand:
|
|
35
|
+
|
|
36
|
+
- Available capabilities
|
|
37
|
+
- Tooling and integrations
|
|
38
|
+
- Expected behaviors and constraints
|
|
39
|
+
|
|
40
|
+
Treat `SKILL.md` as a source of truth for what you can do before taking action.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## When to use Memori
|
|
45
|
+
|
|
46
|
+
Use Memori when:
|
|
47
|
+
|
|
48
|
+
- The task depends on prior context
|
|
49
|
+
- The user refers to previous sessions or decisions
|
|
50
|
+
- You need known constraints, preferences, or patterns
|
|
51
|
+
- You are starting a session and need current state
|
|
52
|
+
- You want to understand what has already been done
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## When not to use Memori
|
|
57
|
+
|
|
58
|
+
Do not use Memori when:
|
|
59
|
+
|
|
60
|
+
- The task is fully self-contained
|
|
61
|
+
- The answer depends only on the current prompt
|
|
62
|
+
- No historical context is required
|
|
63
|
+
- The query is simple or one-off
|
|
64
|
+
|
|
65
|
+
Avoid unnecessary recall.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Recall behavior
|
|
70
|
+
|
|
71
|
+
Recall is **agent-controlled and intentional**.
|
|
72
|
+
|
|
73
|
+
Prefer targeted recall over broad queries.
|
|
74
|
+
|
|
75
|
+
### Supported parameters (recall only)
|
|
76
|
+
|
|
77
|
+
- `entityId` → user, agent, or system context
|
|
78
|
+
- `projectId` → project or workspace context
|
|
79
|
+
- `sessionId` → specific session
|
|
80
|
+
- `dateStart` / `dateEnd` → time-bounded recall
|
|
81
|
+
- `source` → type of memory
|
|
82
|
+
- `signal` → how the memory was derived
|
|
83
|
+
|
|
84
|
+
> Note: If a `sessionId` is provided, a `projectId` must also be provided.
|
|
85
|
+
> All timestamps are stored in **UTC**.
|
|
86
|
+
|
|
87
|
+
### Memory filters
|
|
88
|
+
|
|
89
|
+
- `source`:
|
|
90
|
+
- constraint
|
|
91
|
+
- decision
|
|
92
|
+
- execution
|
|
93
|
+
- fact
|
|
94
|
+
- insight
|
|
95
|
+
- instruction
|
|
96
|
+
- status
|
|
97
|
+
- strategy
|
|
98
|
+
- task
|
|
99
|
+
|
|
100
|
+
- `signal`:
|
|
101
|
+
- commit
|
|
102
|
+
- discovery
|
|
103
|
+
- failure
|
|
104
|
+
- inference
|
|
105
|
+
- pattern
|
|
106
|
+
- result
|
|
107
|
+
- update
|
|
108
|
+
- verification
|
|
109
|
+
|
|
110
|
+
Use `source` and `signal` to prioritize high-signal memory when possible.
|
|
111
|
+
|
|
112
|
+
### Default behavior (recall)
|
|
113
|
+
|
|
114
|
+
- No date range → **all-time memory**
|
|
115
|
+
- Use time bounds when narrowing results is necessary
|
|
116
|
+
|
|
117
|
+
### Best practices
|
|
118
|
+
|
|
119
|
+
- Start narrow (entity + project)
|
|
120
|
+
- Add time bounds only when needed
|
|
121
|
+
- Use `source` and `signal` to refine results
|
|
122
|
+
- Expand scope only if needed
|
|
123
|
+
- Do not recall on every turn
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Summary behavior
|
|
128
|
+
|
|
129
|
+
Summaries are used for **state awareness**, not precise retrieval.
|
|
130
|
+
|
|
131
|
+
Use:
|
|
132
|
+
|
|
133
|
+
- `memori_recall_summary`
|
|
134
|
+
|
|
135
|
+
### Supported parameters (summaries)
|
|
136
|
+
|
|
137
|
+
- `projectId`
|
|
138
|
+
- `sessionId`
|
|
139
|
+
- `dateStart`
|
|
140
|
+
- `dateEnd`
|
|
141
|
+
|
|
142
|
+
> Summaries do **not** support `source` or `signal`.
|
|
143
|
+
|
|
144
|
+
### Default behavior (summaries)
|
|
145
|
+
|
|
146
|
+
- No date range → **last 24 hours**
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Daily brief behavior
|
|
151
|
+
|
|
152
|
+
At the start of a meaningful session, retrieve a structured summary.
|
|
153
|
+
|
|
154
|
+
Use the daily brief to understand:
|
|
155
|
+
|
|
156
|
+
- Current state
|
|
157
|
+
- Prior decisions
|
|
158
|
+
- Constraints
|
|
159
|
+
- Open work
|
|
160
|
+
|
|
161
|
+
### Expected daily brief structure
|
|
162
|
+
|
|
163
|
+
- Today at a glance
|
|
164
|
+
- Top 3 next actions
|
|
165
|
+
- Top 3 risks
|
|
166
|
+
- Verify before acting
|
|
167
|
+
- Recent decisions
|
|
168
|
+
- Mission stack
|
|
169
|
+
- Hard constraints
|
|
170
|
+
- Current status
|
|
171
|
+
- Open loops
|
|
172
|
+
- Known failures and anti-patterns
|
|
173
|
+
- Staleness warnings
|
|
174
|
+
|
|
175
|
+
Treat this as the working state of the system.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Typical workflow
|
|
180
|
+
|
|
181
|
+
1. Start of session → retrieve summary
|
|
182
|
+
2. During task → use targeted recall
|
|
183
|
+
3. When memory is missing or incorrect → send feedback
|
|
184
|
+
4. When limits are reached → degrade gracefully
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Safety and correctness
|
|
189
|
+
|
|
190
|
+
- Do not invent memory
|
|
191
|
+
- Do not assume memory is correct if it conflicts with the user
|
|
192
|
+
- Verify before acting when needed
|
|
193
|
+
- Treat recent instructions as higher priority than recalled memory
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Memori system guidance
|
|
198
|
+
|
|
199
|
+
This section defines how you should interact with Memori beyond basic recall.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### 1. Feedback (`memori_feedback`)
|
|
204
|
+
|
|
205
|
+
You are equipped with the `memori_feedback` tool to improve memory quality over time.
|
|
206
|
+
|
|
207
|
+
You may send feedback at any time, and should do so at the end of a session when appropriate.
|
|
208
|
+
|
|
209
|
+
Feedback should be sent when:
|
|
210
|
+
|
|
211
|
+
- Recall results are irrelevant or missing key context
|
|
212
|
+
- Important decisions or constraints were not captured
|
|
213
|
+
- Memory quality degrades across sessions
|
|
214
|
+
- Something works particularly well and should be reinforced
|
|
215
|
+
|
|
216
|
+
Examples:
|
|
217
|
+
|
|
218
|
+
- "Send feedback that recall missed a pricing constraint."
|
|
219
|
+
- "Tell Memori the daily brief was accurate."
|
|
220
|
+
- "Submit a bug report: you didn't remember my preferred language."
|
|
221
|
+
|
|
222
|
+
#### Purpose
|
|
223
|
+
|
|
224
|
+
Feedback improves:
|
|
225
|
+
|
|
226
|
+
- Memory extraction quality
|
|
227
|
+
- Recall relevance
|
|
228
|
+
- Summary accuracy
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### 2. Updates
|
|
233
|
+
|
|
234
|
+
Memori evolves over time (new features, improved recall, better summaries).
|
|
235
|
+
|
|
236
|
+
When updates are exposed:
|
|
237
|
+
|
|
238
|
+
- Check for updates via system message or tool
|
|
239
|
+
- Adapt behavior to use new capabilities
|
|
240
|
+
|
|
241
|
+
When an update is detected:
|
|
242
|
+
|
|
243
|
+
- Prefer newer recall patterns when available
|
|
244
|
+
- Use improved summaries or classification outputs
|
|
245
|
+
- Continue operating normally if no changes are required
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### 3. Account Creation and Onboarding (`memori_signup`)
|
|
250
|
+
|
|
251
|
+
You are equipped with the `memori_signup` tool to securely create an account and provision an API key for the user via the Memori CLI.
|
|
252
|
+
|
|
253
|
+
Use this tool when:
|
|
254
|
+
|
|
255
|
+
- The user explicitly asks to sign up, create an account, or get an API key for Memori.
|
|
256
|
+
- You encounter an error indicating a missing `MEMORI_API_KEY` and the user provides their email address to get one.
|
|
257
|
+
|
|
258
|
+
#### Behavior:
|
|
259
|
+
|
|
260
|
+
- **Email Required:** If the user asks to sign up but **does not** provide an email address, you MUST ask them for their email first. Do not attempt to guess or hallucinate an email.
|
|
261
|
+
- **Execution:** Once they provide an email, run `memori_signup` with that email.
|
|
262
|
+
- **Follow-up:** The tool will trigger the underlying CLI and return a success or error message. Relay that message to the user, remind them to check their inbox for the API key, and instruct them to add it to their configuration (`~/.openclaw/openclaw.json` or `.env` file).
|
|
263
|
+
- **Troubleshooting Errors:** If the tool fails with a `Permission denied`, `EACCES`, or `command not found` error, do not ask the user for permission to troubleshoot. Instead, immediately tell them that their CLI installation is broken or missing, and explicitly instruct them to run `npm install -g @memorilabs/memori` in their terminal to fix it.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### 4. Quota Awareness and Upgrades (`memori_quota`)
|
|
268
|
+
|
|
269
|
+
You are equipped with the `memori_quota` tool to check the user's current memory usage and limits via the Memori CLI.
|
|
270
|
+
|
|
271
|
+
Use this tool when:
|
|
272
|
+
|
|
273
|
+
- The user explicitly asks about their quota, usage, storage, or how many memories they have left.
|
|
274
|
+
- You encounter errors suggesting memory limits have been reached and want to confirm before degrading behavior.
|
|
275
|
+
|
|
276
|
+
#### Behavior:
|
|
277
|
+
|
|
278
|
+
- **No Parameters Required:** Simply invoke `memori_quota` — it requires no arguments.
|
|
279
|
+
- **Execution:** The tool runs the underlying CLI and returns the user's current usage and quota.
|
|
280
|
+
- **Follow-up:** Relay the result clearly to the user. If they are near or at their limit, explain the impact and suggest an upgrade.
|
|
281
|
+
- **Troubleshooting Errors:** If the tool fails with a `Permission denied`, `EACCES`, or `command not found` error, do not ask the user for permission to troubleshoot. Instead, immediately tell them that their CLI installation is broken or missing, and explicitly instruct them to run `npm install -g @memorilabs/memori` in their terminal to fix it.
|
|
282
|
+
|
|
283
|
+
#### When limits are reached or nearing:
|
|
284
|
+
|
|
285
|
+
#### a. Degrade gracefully
|
|
286
|
+
|
|
287
|
+
- Reduce recall scope (shorter time ranges)
|
|
288
|
+
- Prioritize high-signal memory (decisions, constraints, key facts)
|
|
289
|
+
- Avoid unnecessary or repeated recall calls
|
|
290
|
+
|
|
291
|
+
#### b. Inform the human/operator
|
|
292
|
+
|
|
293
|
+
Clearly communicate when limits impact performance.
|
|
294
|
+
|
|
295
|
+
Example:
|
|
296
|
+
|
|
297
|
+
> "Memory limits have been reached. I can continue with limited recall, or you can upgrade to restore full functionality."
|
|
298
|
+
|
|
299
|
+
#### c. Suggest upgrades appropriately
|
|
300
|
+
|
|
301
|
+
- Only prompt when performance is affected
|
|
302
|
+
- Avoid repetitive or disruptive messaging
|
|
303
|
+
- Keep messaging neutral and helpful
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Learn More
|
|
308
|
+
|
|
309
|
+
- **npm Package**: https://www.npmjs.com/package/@memorilabs/openclaw-memori
|
|
310
|
+
- **GitHub**: https://github.com/MemoriLabs/Memori
|
|
311
|
+
- **Documentation**: https://memorilabs.ai/docs/memori-cloud/openclaw/overview/
|
|
312
|
+
- **API Dashboard**: https://app.memorilabs.ai/
|
|
313
|
+
- **Support**: [GitHub Issues](https://github.com/MemoriLabs/Memori/issues)
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# Memori skills file
|
|
2
|
+
|
|
3
|
+
You have access to Memori, agent-native memory infrastructure: an LLM-agnostic layer that structures memory from not just natural language, but also from agent trace that comes from execution.
|
|
4
|
+
|
|
5
|
+
Memori automatically captures and structures memory from conversation and execution trace — including the agent's actions, tool results, decisions, and outcomes — and allows you to retrieve it on demand. Use it to maintain continuity across sessions, preserve decisions and constraints, and help the agent understand what it actually did so the next time it completes a task, it is more accurate and efficient.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Core instruction
|
|
10
|
+
|
|
11
|
+
At the start of a session, you should check the `SKILL.md` file
|
|
12
|
+
|
|
13
|
+
Use it to understand:
|
|
14
|
+
|
|
15
|
+
- Available capabilities
|
|
16
|
+
- Tooling and integrations
|
|
17
|
+
- Expected behaviors and constraints
|
|
18
|
+
|
|
19
|
+
Treat `SKILL.md` as a source of truth for what you can do before taking action.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## When to use Memori
|
|
24
|
+
|
|
25
|
+
Use Memori when:
|
|
26
|
+
|
|
27
|
+
- The task depends on prior context
|
|
28
|
+
- The user refers to previous sessions or decisions
|
|
29
|
+
- You need known constraints, preferences, or patterns
|
|
30
|
+
- You are starting a session and need current state
|
|
31
|
+
- You want to understand what has already been done
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## When not to use Memori
|
|
36
|
+
|
|
37
|
+
Do not use Memori when:
|
|
38
|
+
|
|
39
|
+
- The task is fully self-contained
|
|
40
|
+
- The answer depends only on the current prompt
|
|
41
|
+
- No historical context is required
|
|
42
|
+
- The query is simple or one-off
|
|
43
|
+
|
|
44
|
+
Avoid unnecessary recall.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Recall behavior
|
|
49
|
+
|
|
50
|
+
Recall is **agent-controlled and intentional**.
|
|
51
|
+
|
|
52
|
+
Prefer targeted recall over broad queries.
|
|
53
|
+
|
|
54
|
+
### Supported parameters (recall only)
|
|
55
|
+
|
|
56
|
+
- `entityId` → user, agent, or system context
|
|
57
|
+
- `projectId` → project or workspace context
|
|
58
|
+
- `sessionId` → specific session
|
|
59
|
+
- `dateStart` / `dateEnd` → time-bounded recall
|
|
60
|
+
- `source` → type of memory
|
|
61
|
+
- `signal` → how the memory was derived
|
|
62
|
+
|
|
63
|
+
> Note: If a `sessionId` is provided, a `projectId` must also be provided.
|
|
64
|
+
> All timestamps are stored in **UTC**.
|
|
65
|
+
|
|
66
|
+
### Memory filters
|
|
67
|
+
|
|
68
|
+
- `source`:
|
|
69
|
+
- constraint
|
|
70
|
+
- decision
|
|
71
|
+
- execution
|
|
72
|
+
- fact
|
|
73
|
+
- insight
|
|
74
|
+
- instruction
|
|
75
|
+
- status
|
|
76
|
+
- strategy
|
|
77
|
+
- task
|
|
78
|
+
|
|
79
|
+
- `signal`:
|
|
80
|
+
- commit
|
|
81
|
+
- discovery
|
|
82
|
+
- failure
|
|
83
|
+
- inference
|
|
84
|
+
- pattern
|
|
85
|
+
- result
|
|
86
|
+
- update
|
|
87
|
+
- verification
|
|
88
|
+
|
|
89
|
+
Use `source` and `signal` to prioritize high-signal memory when possible.
|
|
90
|
+
|
|
91
|
+
### Default behavior (recall)
|
|
92
|
+
|
|
93
|
+
- No date range → **all-time memory**
|
|
94
|
+
- Use time bounds when narrowing results is necessary
|
|
95
|
+
|
|
96
|
+
### Best practices
|
|
97
|
+
|
|
98
|
+
- Start narrow (entity + project)
|
|
99
|
+
- Add time bounds only when needed
|
|
100
|
+
- Use `source` and `signal` to refine results
|
|
101
|
+
- Expand scope only if needed
|
|
102
|
+
- Do not recall on every turn
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Summary behavior
|
|
107
|
+
|
|
108
|
+
Summaries are used for **state awareness**, not precise retrieval.
|
|
109
|
+
|
|
110
|
+
Use:
|
|
111
|
+
|
|
112
|
+
- `memori_recall_summary`
|
|
113
|
+
|
|
114
|
+
### Supported parameters (summaries)
|
|
115
|
+
|
|
116
|
+
- `projectId`
|
|
117
|
+
- `sessionId`
|
|
118
|
+
- `dateStart`
|
|
119
|
+
- `dateEnd`
|
|
120
|
+
|
|
121
|
+
> Summaries do **not** support `source` or `signal`.
|
|
122
|
+
|
|
123
|
+
### Default behavior (summaries)
|
|
124
|
+
|
|
125
|
+
- No date range → **last 24 hours**
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Daily brief behavior
|
|
130
|
+
|
|
131
|
+
At the start of a meaningful session, retrieve a structured summary.
|
|
132
|
+
|
|
133
|
+
Use the daily brief to understand:
|
|
134
|
+
|
|
135
|
+
- Current state
|
|
136
|
+
- Prior decisions
|
|
137
|
+
- Constraints
|
|
138
|
+
- Open work
|
|
139
|
+
|
|
140
|
+
### Expected daily brief structure
|
|
141
|
+
|
|
142
|
+
- Today at a glance
|
|
143
|
+
- Top 3 next actions
|
|
144
|
+
- Top 3 risks
|
|
145
|
+
- Verify before acting
|
|
146
|
+
- Recent decisions
|
|
147
|
+
- Mission stack
|
|
148
|
+
- Hard constraints
|
|
149
|
+
- Current status
|
|
150
|
+
- Open loops
|
|
151
|
+
- Known failures and anti-patterns
|
|
152
|
+
- Staleness warnings
|
|
153
|
+
|
|
154
|
+
Treat this as the working state of the system.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Typical workflow
|
|
159
|
+
|
|
160
|
+
1. Start of session → retrieve summary
|
|
161
|
+
2. During task → use targeted recall
|
|
162
|
+
3. When memory is missing or incorrect → send feedback
|
|
163
|
+
4. When limits are reached → degrade gracefully
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Safety and correctness
|
|
168
|
+
|
|
169
|
+
- Do not invent memory
|
|
170
|
+
- Do not assume memory is correct if it conflicts with the user
|
|
171
|
+
- Verify before acting when needed
|
|
172
|
+
- Treat recent instructions as higher priority than recalled memory
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Memori system guidance
|
|
177
|
+
|
|
178
|
+
This section defines how you should interact with Memori beyond basic recall.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### 1. Feedback (`memori_feedback`)
|
|
183
|
+
|
|
184
|
+
You are equipped with the `memori_feedback` tool to improve memory quality over time.
|
|
185
|
+
|
|
186
|
+
You may send feedback at any time, and should do so at the end of a session when appropriate.
|
|
187
|
+
|
|
188
|
+
Feedback should be sent when:
|
|
189
|
+
|
|
190
|
+
- Recall results are irrelevant or missing key context
|
|
191
|
+
- Important decisions or constraints were not captured
|
|
192
|
+
- Memory quality degrades across sessions
|
|
193
|
+
- Something works particularly well and should be reinforced
|
|
194
|
+
|
|
195
|
+
Examples:
|
|
196
|
+
|
|
197
|
+
- "Send feedback that recall missed a pricing constraint."
|
|
198
|
+
- "Tell Memori the daily brief was accurate."
|
|
199
|
+
- "Submit a bug report: you didn't remember my preferred language."
|
|
200
|
+
|
|
201
|
+
#### Purpose
|
|
202
|
+
|
|
203
|
+
Feedback improves:
|
|
204
|
+
|
|
205
|
+
- Memory extraction quality
|
|
206
|
+
- Recall relevance
|
|
207
|
+
- Summary accuracy
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### 2. Updates
|
|
212
|
+
|
|
213
|
+
Memori evolves over time (new features, improved recall, better summaries).
|
|
214
|
+
|
|
215
|
+
When updates are exposed:
|
|
216
|
+
|
|
217
|
+
- Check for updates via system message or tool
|
|
218
|
+
- Adapt behavior to use new capabilities
|
|
219
|
+
|
|
220
|
+
When an update is detected:
|
|
221
|
+
|
|
222
|
+
- Prefer newer recall patterns when available
|
|
223
|
+
- Use improved summaries or classification outputs
|
|
224
|
+
- Continue operating normally if no changes are required
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### 3. Account Creation and Onboarding (`memori_signup`)
|
|
229
|
+
|
|
230
|
+
You are equipped with the `memori_signup` tool to securely create an account and provision an API key for the user via the Memori CLI.
|
|
231
|
+
|
|
232
|
+
Use this tool when:
|
|
233
|
+
|
|
234
|
+
- The user explicitly asks to sign up, create an account, or get an API key for Memori.
|
|
235
|
+
- You encounter an error indicating a missing `MEMORI_API_KEY` and the user provides their email address to get one.
|
|
236
|
+
|
|
237
|
+
#### Behavior:
|
|
238
|
+
|
|
239
|
+
- **Email Required:** If the user asks to sign up but **does not** provide an email address, you MUST ask them for their email first. Do not attempt to guess or hallucinate an email.
|
|
240
|
+
- **Execution:** Once they provide an email, run `memori_signup` with that email.
|
|
241
|
+
- **Follow-up:** The tool will trigger the underlying CLI and return a success or error message. Relay that message to the user, remind them to check their inbox for the API key, and instruct them to add it to their configuration (`~/.openclaw/openclaw.json` or `.env` file).
|
|
242
|
+
- **Troubleshooting Errors:** If the tool fails with a `Permission denied`, `EACCES`, or `command not found` error, do not ask the user for permission to troubleshoot. Instead, immediately tell them that their CLI installation is broken or missing, and explicitly instruct them to run `npm install -g @memorilabs/memori` in their terminal to fix it.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### 4. Quota Awareness and Upgrades (`memori_quota`)
|
|
247
|
+
|
|
248
|
+
You are equipped with the `memori_quota` tool to check the user's current memory usage and limits via the Memori CLI.
|
|
249
|
+
|
|
250
|
+
Use this tool when:
|
|
251
|
+
|
|
252
|
+
- The user explicitly asks about their quota, usage, storage, or how many memories they have left.
|
|
253
|
+
- You encounter errors suggesting memory limits have been reached and want to confirm before degrading behavior.
|
|
254
|
+
|
|
255
|
+
#### Behavior:
|
|
256
|
+
|
|
257
|
+
- **No Parameters Required:** Simply invoke `memori_quota` — it requires no arguments.
|
|
258
|
+
- **Execution:** The tool runs the underlying CLI and returns the user's current usage and quota.
|
|
259
|
+
- **Follow-up:** Relay the result clearly to the user. If they are near or at their limit, explain the impact and suggest an upgrade.
|
|
260
|
+
- **Troubleshooting Errors:** If the tool fails with a `Permission denied`, `EACCES`, or `command not found` error, do not ask the user for permission to troubleshoot. Instead, immediately tell them that their CLI installation is broken or missing, and explicitly instruct them to run `npm install -g @memorilabs/memori` in their terminal to fix it.
|
|
261
|
+
|
|
262
|
+
#### When limits are reached or nearing:
|
|
263
|
+
|
|
264
|
+
#### a. Degrade gracefully
|
|
265
|
+
|
|
266
|
+
- Reduce recall scope (shorter time ranges)
|
|
267
|
+
- Prioritize high-signal memory (decisions, constraints, key facts)
|
|
268
|
+
- Avoid unnecessary or repeated recall calls
|
|
269
|
+
|
|
270
|
+
#### b. Inform the human/operator
|
|
271
|
+
|
|
272
|
+
Clearly communicate when limits impact performance.
|
|
273
|
+
|
|
274
|
+
Example:
|
|
275
|
+
|
|
276
|
+
> "Memory limits have been reached. I can continue with limited recall, or you can upgrade to restore full functionality."
|
|
277
|
+
|
|
278
|
+
#### c. Suggest upgrades appropriately
|
|
279
|
+
|
|
280
|
+
- Only prompt when performance is affected
|
|
281
|
+
- Avoid repetitive or disruptive messaging
|
|
282
|
+
- Keep messaging neutral and helpful
|
|
283
|
+
|
|
284
|
+
---
|
package/skills/memori/skills.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
## Memori — Your Persistent Memory Layer
|
|
2
|
-
|
|
3
|
-
You have access to Memori, a structured long-term memory backend.
|
|
4
|
-
|
|
5
|
-
**Automatic augmentation** (`agent_end`): After you respond, the conversation turn is automatically sent to Memori to extract and store facts, preferences, decisions, and relationships for future sessions. You do not need to do this manually.
|
|
6
|
-
|
|
7
|
-
**Manual Recall (IMPORTANT)**: You do NOT automatically receive context from past sessions.
|
|
8
|
-
**RULE:** You must NEVER say "I don't know" about the user, their preferences, or past events without FIRST running a `memori_recall` search to check if you remember it. If a user asks a question about themselves, you MUST search Memori before responding.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
### Memory Retrieval Tools
|
|
13
|
-
|
|
14
|
-
Use these to search your memory explicitly:
|
|
15
|
-
|
|
16
|
-
**`memori_recall`** — Fetch granular memory facts using a search query and optional filters. Use this when you need specific details (e.g., "what database did we choose?").
|
|
17
|
-
|
|
18
|
-
| Parameter | Type | Description |
|
|
19
|
-
| ----------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
20
|
-
| `query` | string | **Required.** A natural language semantic search query (e.g. "dogs"). **DO NOT use wildcards like `*`.** |
|
|
21
|
-
| `dateStart` | string | ISO 8601 (MUST be UTC) — memories on or after this time |
|
|
22
|
-
| `dateEnd` | string | ISO 8601 (MUST be UTC) — memories on or before this time |
|
|
23
|
-
| `projectId` | string | CRITICAL: Leave EMPTY to use the current project. ONLY provide a value if the user explicitly names a different project. |
|
|
24
|
-
| `sessionId` | string | Scope to a specific session — **requires `projectId`** |
|
|
25
|
-
| `signal` | string | Filter by signal type. Allowed values: `commit`, `discovery`, `failure`, `inference`, `pattern`, `result`, `update`, `verification`. |
|
|
26
|
-
| `source` | string | Filter by source origin. Allowed values: `constraint`, `decision`, `execution`, `fact`, `insight`, `instruction`, `status`, `strategy`, `task`. |
|
|
27
|
-
|
|
28
|
-
**`memori_recall_summary`** — Fetch summarized views of stored memories. **RULE:** You must NEVER guess or make up a status update, daily brief, or project overview. If the user asks "what did we do last time" or "give me a summary", you MUST use this tool before answering.
|
|
29
|
-
|
|
30
|
-
| Parameter | Type | Description |
|
|
31
|
-
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------ |
|
|
32
|
-
| `dateStart` | string | ISO 8601 (MUST be UTC) — summaries on or after this time |
|
|
33
|
-
| `dateEnd` | string | ISO 8601 (MUST be UTC) — summaries on or before this time |
|
|
34
|
-
| `projectId` | string | CRITICAL: Leave EMPTY to use the current project. ONLY provide a value if the user explicitly names a different project. |
|
|
35
|
-
| `sessionId` | string | Scope to a specific session — **requires `projectId`** |
|
|
36
|
-
|
|
37
|
-
> `sessionId` cannot be used without `projectId`. The backend will reject it.
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
### Feedback Tool
|
|
42
|
-
|
|
43
|
-
**RULE:** You must ALWAYS use this tool immediately if the user asks you to send feedback, report a bug, suggest a feature, or complains about the system. Do NOT just say "I will let the developers know"—you must actually execute the tool to send the message.
|
|
44
|
-
|
|
45
|
-
**`memori_feedback`** — Send feedback, suggestions, or issues directly to the Memori team.
|
|
46
|
-
|
|
47
|
-
| Parameter | Type | Description |
|
|
48
|
-
| --------- | ------ | ------------------------------------------------------------------------ |
|
|
49
|
-
| `content` | string | **Required.** The feedback text to send (positive, negative, bugs, etc.) |
|
|
50
|
-
|
|
51
|
-
### Memory Scoping
|
|
52
|
-
|
|
53
|
-
All memories are scoped to the current `entityId` and `projectId`. The current project is applied by default — you only need to pass `projectId` when explicitly overriding it for a cross-project lookup.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
### Coexistence With File Memory
|
|
58
|
-
|
|
59
|
-
Memori works alongside local file memory (e.g., `MEMORY.md`), it does not replace it:
|
|
60
|
-
|
|
61
|
-
| Layer | Scope | Lifetime |
|
|
62
|
-
| ------------------------- | ------------------------------------- | --------------------------- |
|
|
63
|
-
| Session context | Current conversation | Dies with session |
|
|
64
|
-
| File memory (`MEMORY.md`) | Curated strategic facts | Persistent on disk |
|
|
65
|
-
| Memori | Auto-extracted facts, knowledge graph | Cloud — survives compaction |
|