@memorilabs/openclaw-memori 0.0.6 → 0.0.7-beta

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.
Files changed (42) hide show
  1. package/README.md +123 -96
  2. package/dist/cli/commands.d.ts +2 -0
  3. package/dist/cli/commands.js +143 -0
  4. package/dist/cli/config-file.d.ts +8 -0
  5. package/dist/cli/config-file.js +64 -0
  6. package/dist/handlers/augmentation.js +12 -5
  7. package/dist/index.js +51 -5
  8. package/dist/sanitizer.d.ts +1 -0
  9. package/dist/sanitizer.js +10 -2
  10. package/dist/tools/index.d.ts +4 -0
  11. package/dist/tools/index.js +16 -0
  12. package/dist/tools/memori-compaction.d.ts +35 -0
  13. package/dist/tools/memori-compaction.js +119 -0
  14. package/dist/tools/memori-feedback.d.ts +25 -0
  15. package/dist/tools/memori-feedback.js +40 -0
  16. package/dist/tools/memori-quota.d.ts +17 -0
  17. package/dist/tools/memori-quota.js +55 -0
  18. package/dist/tools/memori-recall-summary.d.ts +39 -0
  19. package/dist/tools/memori-recall-summary.js +58 -0
  20. package/dist/tools/memori-recall.d.ts +51 -0
  21. package/dist/tools/memori-recall.js +123 -0
  22. package/dist/tools/memori-signup.d.ts +25 -0
  23. package/dist/tools/memori-signup.js +72 -0
  24. package/dist/tools/types.d.ts +8 -0
  25. package/dist/tools/types.js +1 -0
  26. package/dist/types.d.ts +4 -8
  27. package/dist/utils/context.d.ts +4 -2
  28. package/dist/utils/context.js +4 -2
  29. package/dist/utils/index.d.ts +2 -1
  30. package/dist/utils/index.js +2 -1
  31. package/dist/utils/memori-client.d.ts +11 -0
  32. package/dist/utils/memori-client.js +20 -2
  33. package/dist/utils/skills-loader.d.ts +6 -0
  34. package/dist/utils/skills-loader.js +14 -0
  35. package/dist/version.d.ts +1 -1
  36. package/dist/version.js +1 -1
  37. package/openclaw.plugin.json +22 -2
  38. package/package.json +3 -2
  39. package/skills/clawhub/SKILL.md +221 -0
  40. package/skills/memori/SKILL.md +355 -0
  41. package/dist/handlers/recall.d.ts +0 -5
  42. package/dist/handlers/recall.js +0 -34
@@ -0,0 +1,355 @@
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 (must be paired with `signal` from the allowed combinations below)
61
+ - `signal` → how the memory was derived (must be paired with `source` from the allowed combinations below)
62
+
63
+ > Note: If a `sessionId` is provided, a `projectId` must also be provided.
64
+ > All timestamps are stored in **UTC**.
65
+
66
+ ### Allowed source + signal combinations
67
+
68
+ `source` and `signal` are not independent. They must be set together (or both omitted). Only the following `(source, signal)` pairs are valid:
69
+
70
+ - `source=constraint`, `signal=discovery`
71
+ - `source=decision`, `signal=commit`
72
+ - `source=fact`, `signal=verification`
73
+ - `source=execution`, `signal=failure`
74
+ - `source=instruction`, `signal=discovery`
75
+ - `source=insight`, `signal=inference`
76
+ - `source=status`, `signal=update`
77
+ - `source=strategy`, `signal=pattern`
78
+ - `source=task`, `signal=result`
79
+
80
+ Any combination of `source` and `signal` not in this list is invalid and must not be sent to `memori_recall`.
81
+
82
+ Use one of the allowed `(source, signal)` pairs to prioritize high-signal memory when possible; never set `source` or `signal` independently.
83
+
84
+ ### Default behavior (recall)
85
+
86
+ - No date range → **all-time memory**
87
+ - Use time bounds when narrowing results is necessary
88
+
89
+ ### Best practices
90
+
91
+ - Start narrow (entity + project)
92
+ - Add time bounds only when needed
93
+ - Use an allowed `(source, signal)` pair to refine results (never set them independently)
94
+ - Expand scope only if needed
95
+ - Do not recall on every turn
96
+
97
+ ---
98
+
99
+ ## Summary behavior
100
+
101
+ Summaries are used for **state awareness**, not precise retrieval.
102
+
103
+ Use:
104
+
105
+ - `memori_recall_summary`
106
+
107
+ ### Supported parameters (summaries)
108
+
109
+ - `projectId`
110
+ - `sessionId`
111
+ - `dateStart`
112
+ - `dateEnd`
113
+
114
+ > Summaries do **not** support `source` or `signal`.
115
+
116
+ ### Default behavior (summaries)
117
+
118
+ - No date range → **last 24 hours**
119
+
120
+ ---
121
+
122
+ ## Daily brief behavior
123
+
124
+ At the start of a meaningful session, retrieve a structured summary.
125
+
126
+ Use the daily brief to understand:
127
+
128
+ - Current state
129
+ - Prior decisions
130
+ - Constraints
131
+ - Open work
132
+
133
+ ### Expected daily brief structure
134
+
135
+ - Today at a glance
136
+ - Top 3 next actions
137
+ - Top 3 risks
138
+ - Verify before acting
139
+ - Recent decisions
140
+ - Mission stack
141
+ - Hard constraints
142
+ - Current status
143
+ - Open loops
144
+ - Known failures and anti-patterns
145
+ - Staleness warnings
146
+
147
+ Treat this as the working state of the system.
148
+
149
+ ---
150
+
151
+ ## Typical workflow
152
+
153
+ 1. Start of session → retrieve summary
154
+ 2. During task → use targeted recall
155
+ 3. When memory is missing or incorrect → send feedback
156
+ 4. When limits are reached → degrade gracefully
157
+
158
+ ---
159
+
160
+ ## Post-compaction brief behavior
161
+
162
+ Post-compaction briefs are used to restore working state after context compaction.
163
+
164
+ Use them when:
165
+
166
+ - The agent resumes after compaction
167
+ - A long-running workflow has lost conversational detail
168
+ - The agent needs to continue operational work without replaying the full prior session
169
+ - The agent needs durable state, standing instructions, environment details, open loops, or the next expected action
170
+
171
+ Post-compaction briefs are not a replacement for precise memory retrieval.
172
+
173
+ ### Use:
174
+
175
+ memori_compaction
176
+
177
+ Supported parameters (post-compaction briefs)
178
+
179
+ projectId (required)
180
+ sessionId (optional)
181
+
182
+ Post-compaction briefs do not support source or signal.
183
+
184
+ ### Default behavior (post-compaction briefs)
185
+
186
+ Retrieve the most recent relevant post-compaction brief for the project or session.
187
+
188
+ Expected post-compaction brief structure
189
+
190
+ - Meta
191
+ - Environment
192
+ - Standing orders
193
+ - State
194
+ - Active tasks
195
+ - Open loops
196
+ - Pending results
197
+ - Timeline
198
+ - Workspace changes
199
+ - Continuation
200
+ - Last action
201
+ - Next expected action
202
+
203
+ ### How to use a post-compaction brief
204
+
205
+ Treat the post-compaction brief as the agent's resume state.
206
+
207
+ Use it to understand:
208
+
209
+ - What environment the agent was operating in
210
+ - Which standing orders must continue to be followed
211
+ - Which tasks are active
212
+ - Which issues remain unresolved
213
+ - What happened across the prior session window
214
+ - What files, workspace state, or external systems may have changed
215
+ - What the agent did last
216
+ - What the agent should do next
217
+
218
+ ### Important behavior
219
+
220
+ The post-compaction brief should guide continuation, not override explicit user instructions.
221
+
222
+ Before acting on operational details, verify any state that may have changed since compaction.
223
+
224
+ Pay special attention to:
225
+
226
+ - Standing orders
227
+ - Hard constraints
228
+ - Alerting rules
229
+ - Expected response formats
230
+ - Open loops
231
+ - Staleness warnings
232
+ - Next expected action
233
+
234
+ If the post-compaction brief contains a required output format, follow it exactly unless the user gives a newer instruction.
235
+
236
+ ---
237
+
238
+ ## Safety and correctness
239
+
240
+ - Do not invent memory
241
+ - Do not assume memory is correct if it conflicts with the user
242
+ - Verify before acting when needed
243
+ - Treat recent instructions as higher priority than recalled memory
244
+
245
+ ---
246
+
247
+ ## Memori system guidance
248
+
249
+ This section defines how you should interact with Memori beyond basic recall.
250
+
251
+ ---
252
+
253
+ ### 1. Feedback (`memori_feedback`)
254
+
255
+ You are equipped with the `memori_feedback` tool to improve memory quality over time.
256
+
257
+ You may send feedback at any time, and should do so at the end of a session when appropriate.
258
+
259
+ Feedback should be sent when:
260
+
261
+ - Recall results are irrelevant or missing key context
262
+ - Important decisions or constraints were not captured
263
+ - Memory quality degrades across sessions
264
+ - Something works particularly well and should be reinforced
265
+
266
+ Examples:
267
+
268
+ - "Send feedback that recall missed a pricing constraint."
269
+ - "Tell Memori the daily brief was accurate."
270
+ - "Submit a bug report: you didn't remember my preferred language."
271
+
272
+ #### Purpose
273
+
274
+ Feedback improves:
275
+
276
+ - Memory extraction quality
277
+ - Recall relevance
278
+ - Summary accuracy
279
+
280
+ ---
281
+
282
+ ### 2. Updates
283
+
284
+ Memori evolves over time (new features, improved recall, better summaries).
285
+
286
+ When updates are exposed:
287
+
288
+ - Check for updates via system message or tool
289
+ - Adapt behavior to use new capabilities
290
+
291
+ When an update is detected:
292
+
293
+ - Prefer newer recall patterns when available
294
+ - Use improved summaries or classification outputs
295
+ - Continue operating normally if no changes are required
296
+
297
+ ---
298
+
299
+ ### 3. Account Creation and Onboarding (`memori_signup`)
300
+
301
+ 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.
302
+
303
+ Use this tool when:
304
+
305
+ - The user explicitly asks to sign up, create an account, or get an API key for Memori.
306
+ - You encounter an error indicating a missing `MEMORI_API_KEY` and the user provides their email address to get one.
307
+
308
+ #### Behavior:
309
+
310
+ - **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.
311
+ - **Execution:** Once they provide an email, run `memori_signup` with that email.
312
+ - **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).
313
+ - **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.
314
+
315
+ ---
316
+
317
+ ### 4. Quota Awareness and Upgrades (`memori_quota`)
318
+
319
+ You are equipped with the `memori_quota` tool to check the user's current memory usage and limits via the Memori CLI.
320
+
321
+ Use this tool when:
322
+
323
+ - The user explicitly asks about their quota, usage, storage, or how many memories they have left.
324
+ - You encounter errors suggesting memory limits have been reached and want to confirm before degrading behavior.
325
+
326
+ #### Behavior:
327
+
328
+ - **No Parameters Required:** Simply invoke `memori_quota` — it requires no arguments.
329
+ - **Execution:** The tool runs the underlying CLI and returns the user's current usage and quota.
330
+ - **Follow-up:** Relay the result clearly to the user. If they are near or at their limit, explain the impact and suggest an upgrade.
331
+ - **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.
332
+
333
+ #### When limits are reached or nearing:
334
+
335
+ #### a. Degrade gracefully
336
+
337
+ - Reduce recall scope (shorter time ranges)
338
+ - Prioritize high-signal memory (decisions, constraints, key facts)
339
+ - Avoid unnecessary or repeated recall calls
340
+
341
+ #### b. Inform the human/operator
342
+
343
+ Clearly communicate when limits impact performance.
344
+
345
+ Example:
346
+
347
+ > "Memory limits have been reached. I can continue with limited recall, or you can upgrade to restore full functionality."
348
+
349
+ #### c. Suggest upgrades appropriately
350
+
351
+ - Only prompt when performance is affected
352
+ - Avoid repetitive or disruptive messaging
353
+ - Keep messaging neutral and helpful
354
+
355
+ ---
@@ -1,5 +0,0 @@
1
- import { OpenClawEvent, OpenClawContext, MemoriPluginConfig } from '../types.js';
2
- import { MemoriLogger } from '../utils/index.js';
3
- export declare function handleRecall(event: OpenClawEvent, ctx: OpenClawContext, config: MemoriPluginConfig, logger: MemoriLogger): Promise<{
4
- prependContext: string;
5
- } | undefined>;
@@ -1,34 +0,0 @@
1
- import { cleanText, isSystemMessage } from '../sanitizer.js';
2
- import { RECALL_CONFIG } from '../constants.js';
3
- import { extractContext, initializeMemoriClient } from '../utils/index.js';
4
- export async function handleRecall(event, ctx, config, logger) {
5
- logger.section('RECALL HOOK START');
6
- try {
7
- const context = extractContext(event, ctx, config.entityId);
8
- const promptText = cleanText(event.prompt);
9
- if (!promptText ||
10
- promptText.length < RECALL_CONFIG.MIN_PROMPT_LENGTH ||
11
- isSystemMessage(promptText)) {
12
- logger.info('Prompt too short or is a system message. Aborting recall.');
13
- return undefined;
14
- }
15
- const memoriClient = initializeMemoriClient(config.apiKey, context);
16
- logger.info('Executing SDK Recall...');
17
- const recallText = await memoriClient.recall(promptText);
18
- const hookReturn = recallText ? { prependContext: recallText } : undefined;
19
- if (hookReturn) {
20
- logger.info('Successfully injected memory context.');
21
- }
22
- else {
23
- logger.info('No relevant memories found.');
24
- }
25
- return hookReturn;
26
- }
27
- catch (err) {
28
- logger.error(`Recall failed: ${err instanceof Error ? err.message : String(err)}`);
29
- return undefined;
30
- }
31
- finally {
32
- logger.endSection('RECALL HOOK END');
33
- }
34
- }