@memorilabs/openclaw-memori 0.0.5-beta → 0.0.5

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  </p>
6
6
 
7
7
  <p align="center">
8
- <i>By default, OpenClaw agents forget everything between sessions. This plugin fixes that. It watches conversations, extracts what matters, and brings it back when relevant—automatically.</i>
8
+ <i>Give OpenClaw persistent, structured memory with Memori. Capture what matters, recall it when relevant, and move from lightweight experimentation to production-ready memory infrastructure.</i>
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -25,14 +25,69 @@
25
25
 
26
26
  ---
27
27
 
28
- ## Key Features
28
+ ## Why Memori for OpenClaw?
29
29
 
30
- - **Auto-Recall:** Before the agent responds, the plugin searches Memori for memories that match the current context and injects them directly into the prompt.
31
- - **Auto-Capture:** After the agent responds, the plugin securely sends the exchange to Memori to extract new facts, update stale ones, and merge duplicates.
32
- - **Bulletproof Sanitization:** Automatically strips OpenClaw system metadata, internal timestamps, and thinking blocks to prevent context pollution and feedback loops.
33
- - **Stateless & Thread-Safe:** A completely stateless architecture ensures zero memory leaks and 100% thread safety for multi-agent OpenClaw gateways.
30
+ OpenClaw ships with a simple file-first memory system designed for lightweight experimentation. As deployments scale into production environments, teams often run into memory problems that need more structured, deterministic infrastructure.
34
31
 
35
- ## Getting Started
32
+ Memori provides a drop-in memory layer purpose-built for agentic systems running OpenClaw in production. It works through OpenClaw's plugin lifecycle, so you get persistent, structured memory without changing your agent logic.
33
+
34
+ ## Common Challenges with Default OpenClaw Memory
35
+
36
+ ### 1. Fact conflicts in long-running agents
37
+
38
+ OpenClaw stores memory as plain markdown files. When facts change or contradict over time, there is no deterministic conflict resolution or lifecycle management.
39
+
40
+ Memori introduces structured memory with update logic, decay policies, and deterministic fact handling.
41
+
42
+ ### 2. Context loss from token limits
43
+
44
+ As sessions grow, context must be compacted to fit within model token limits. Important details can be dropped during compression.
45
+
46
+ Memori stores memory outside the prompt and retrieves the right facts at query time, eliminating compaction loss.
47
+
48
+ ### 3. No relationship reasoning
49
+
50
+ OpenClaw retrieves semantically similar text but does not model relationships between entities.
51
+
52
+ Memori builds structured memory graphs that let agents reason across linked facts, not just retrieve similar chunks.
53
+
54
+ ### 4. Cross-project noise
55
+
56
+ When multiple projects share memory storage, irrelevant context can bleed across workflows.
57
+
58
+ Memori supports scoped memory namespaces to isolate projects and workflows.
59
+
60
+ ### 5. No user-level isolation
61
+
62
+ Default memory systems do not provide deterministic isolation across users.
63
+
64
+ Memori enforces user-scoped memory boundaries for secure multi-user deployments.
65
+
66
+ ## What Changes When You Add Memori?
67
+
68
+ The Memori plugin replaces OpenClaw's flat-file memory workflow with managed, structured memory that is scoped by `entity_id`, `process_id`, and `session_id` and enriched automatically through OpenClaw's existing hooks.
69
+
70
+ | Capability | What changes |
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. |
76
+
77
+ The plugin still remains drop-in: OpenClaw handles the agent loop, while Memori adds recall, augmentation, sanitization, and observability around it.
78
+
79
+
80
+ ## Quickstart
81
+
82
+ Get persistent memory running in your OpenClaw gateway in three steps.
83
+
84
+ ### Prerequisites
85
+
86
+ - [OpenClaw](https://openclaw.ai) `v2026.3.2` or later
87
+ - A Memori API key from [app.memorilabs.ai](https://app.memorilabs.ai)
88
+ - An Entity ID to attribute memories to, such as a user ID, tenant ID, or agent name
89
+
90
+ ### 1. Install and Enable
36
91
 
37
92
  Run the following commands in your terminal to install and enable the plugin:
38
93
 
@@ -47,9 +102,9 @@ openclaw plugins enable openclaw-memori
47
102
  openclaw gateway restart
48
103
  ```
49
104
 
50
- ## Configuration
105
+ ### 2. Configure
51
106
 
52
- The plugin needs your Memori API key and an Entity ID to function. You can configure this via the OpenClaw CLI, your `openclaw.json` file, or environment variables.
107
+ The plugin needs your Memori API key and an Entity ID to function. You can configure this via the OpenClaw CLI or your `openclaw.json` file.
53
108
 
54
109
  ### Option A: Via OpenClaw CLI (Recommended)
55
110
 
@@ -85,12 +140,39 @@ Add the following to your `~/.openclaw/openclaw.json` file:
85
140
  | `apiKey` | `string` | **Yes** | Your Memori API key. |
86
141
  | `entityId` | `string` | **Yes** | The unique identifier for the entity (e.g., user, agent, or tenant) to attribute these memories to. |
87
142
 
88
- ## How It Works (The Hook Lifecycle)
143
+ ### 3. Verify
144
+
145
+ Restart the gateway and inspect the logs:
146
+
147
+ ```bash
148
+ openclaw gateway restart
149
+ openclaw gateway logs --filter "[Memori]"
150
+ ```
151
+
152
+ You should see:
153
+
154
+ ```text
155
+ [Memori] === INITIALIZING PLUGIN ===
156
+ [Memori] Tracking Entity ID: your-app-user-id
157
+ ```
158
+
159
+ To test the full memory loop:
160
+
161
+ 1. Send a message with a durable preference:
162
+ `I always use TypeScript and prefer functional patterns.`
163
+ 2. Confirm augmentation ran:
164
+ `Augmentation successful!`
165
+ 3. Start a new session and ask:
166
+ `Write a hello world script.`
167
+ 4. Confirm recall ran:
168
+ `Successfully injected memory context.`
169
+
170
+ ## How It Works
89
171
 
90
- This plugin integrates deeply with OpenClaw's event lifecycle to provide seamless memory without interfering with your agent's core logic:
172
+ This plugin integrates with OpenClaw's event lifecycle to provide persistent memory without interfering with the agent's core logic:
91
173
 
92
- 1. **`before_prompt_build` (Recall):** When a user sends a message, the plugin intercepts the event, queries the Memori API, and safely prepends relevant memories to the agent's system context.
93
- 2. **`agent_end` (Capture):** 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.
174
+ 1. **`before_prompt_build` (Intelligent Recall):** When a user sends a message, the plugin intercepts the event, queries the Memori API, and safely prepends relevant memories to the agent's system context.
175
+ 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.
94
176
 
95
177
  ## Contributing
96
178
 
@@ -1,6 +1,7 @@
1
1
  import { extractContext, initializeMemoriClient } from '../utils/index.js';
2
2
  import { cleanText, isSystemMessage } from '../sanitizer.js';
3
3
  import { AUGMENTATION_CONFIG } from '../constants.js';
4
+ import { SDK_VERSION } from '../version.js';
4
5
  function extractLLMMetadata(event) {
5
6
  const messages = event.messages || [];
6
7
  const lastAssistant = messages.findLast((m) => m.role === 'assistant');
@@ -8,8 +9,7 @@ function extractLLMMetadata(event) {
8
9
  provider: lastAssistant?.provider || null,
9
10
  model: lastAssistant?.model || null,
10
11
  sdkVersion: null,
11
- // integrationSdkVersion: SDK_VERSION,
12
- integrationSdkVersion: '0.0.1', // TODO: move me back with first releases
12
+ integrationSdkVersion: SDK_VERSION,
13
13
  platform: 'openclaw',
14
14
  };
15
15
  }
@@ -64,15 +64,11 @@ export async function handleAugmentation(event, ctx, config, logger) {
64
64
  }
65
65
  const context = extractContext(event, ctx, config.entityId);
66
66
  const memoriClient = initializeMemoriClient(config.apiKey, context);
67
- logger.info('Capturing conversation turn...');
68
67
  const payload = {
69
68
  userMessage: lastUserMsg.content,
70
69
  agentResponse: lastAiMsg.content,
71
70
  metadata: extractLLMMetadata(event),
72
71
  };
73
- logger.info(`Sending User: ${payload.userMessage}`);
74
- logger.info(`Sending Agent: ${payload.agentResponse}`);
75
- logger.info(`Sending Meta: ${JSON.stringify(payload.metadata)}`);
76
72
  await memoriClient.augmentation(payload);
77
73
  logger.info('Augmentation successful!');
78
74
  }
@@ -5,7 +5,6 @@ export async function handleRecall(event, ctx, config, logger) {
5
5
  logger.section('RECALL HOOK START');
6
6
  try {
7
7
  const context = extractContext(event, ctx, config.entityId);
8
- logger.info(`EntityID: ${context.entityId} | SessionID: ${context.sessionId} | Provider: ${context.provider}`);
9
8
  const promptText = cleanText(event.prompt);
10
9
  if (!promptText ||
11
10
  promptText.length < RECALL_CONFIG.MIN_PROMPT_LENGTH ||
@@ -23,7 +22,6 @@ export async function handleRecall(event, ctx, config, logger) {
23
22
  else {
24
23
  logger.info('No relevant memories found.');
25
24
  }
26
- logger.info(`Recall Prompt: ${hookReturn?.prependContext}`);
27
25
  return hookReturn;
28
26
  }
29
27
  catch (err) {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.5-beta";
1
+ export declare const SDK_VERSION = "0.0.5";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const SDK_VERSION = '0.0.5-beta';
1
+ export const SDK_VERSION = '0.0.5';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-memori",
3
3
  "name": "Memori System",
4
- "version": "0.0.1-beta",
4
+ "version": "0.0.2",
5
5
  "description": "Hosted memory backend",
6
6
  "kind": "memory",
7
7
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memorilabs/openclaw-memori",
3
- "version": "0.0.5-beta",
3
+ "version": "0.0.5",
4
4
  "description": "Official MemoriLabs.ai long-term memory plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -62,7 +62,10 @@
62
62
  "engines": {
63
63
  "node": ">=22.0.0"
64
64
  },
65
+ "overrides": {
66
+ "@hono/node-server": "^1.19.10"
67
+ },
65
68
  "dependencies": {
66
- "@memorilabs/memori": "^0.0.4"
69
+ "@memorilabs/memori": "^0.0.6"
67
70
  }
68
71
  }