@memclaw/memclaw 0.9.13 → 0.9.16

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/index.js CHANGED
@@ -38,7 +38,7 @@ function memclawPlugin(api) {
38
38
  exports.plugin = {
39
39
  id: 'memclaw',
40
40
  name: 'MemClaw',
41
- version: '0.9.13',
41
+ version: '0.9.16',
42
42
  configSchema: {
43
43
  type: 'object',
44
44
  properties: {
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "id": "memclaw",
3
3
  "name": "MemClaw",
4
- "version": "0.9.13",
4
+ "version": "0.9.16",
5
5
  "description": "Layered semantic memory for OpenClaw with L0/L1/L2 tiered retrieval, easy setup, and migration from native memory",
6
6
  "kind": "memory",
7
- "skills": ["skills/memclaw"],
7
+ "skills": ["skills/memclaw", "skills/memclaw-maintance"],
8
8
  "platforms": ["darwin-arm64", "win32-x64"],
9
9
  "osRestriction": ["darwin-arm64", "win32-x64"],
10
10
  "configSchema": {
@@ -85,14 +85,7 @@
85
85
  "default": "text-embedding-3-small"
86
86
  }
87
87
  },
88
- "required": [
89
- "llmApiKey",
90
- "embeddingApiKey",
91
- "llmApiBaseUrl",
92
- "llmModel",
93
- "embeddingApiBaseUrl",
94
- "embeddingModel"
95
- ]
88
+ "required": []
96
89
  },
97
90
  "uiHints": {
98
91
  "serviceUrl": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memclaw/memclaw",
3
- "version": "0.9.13",
3
+ "version": "0.9.16",
4
4
  "description": "MemClaw - The Cortex Memory plugin for OpenClaw. Layered semantic memory for OpenClaw with easy setup and migration",
5
5
  "homepage": "https://github.com/sopaco/cortex-mem",
6
6
  "repository": {
@@ -36,7 +36,8 @@
36
36
  "dist/index.js"
37
37
  ],
38
38
  "skills": [
39
- "skills/memclaw"
39
+ "skills/memclaw",
40
+ "skills/memclaw-maintance"
40
41
  ]
41
42
  },
42
43
  "devDependencies": {
@@ -13,8 +13,7 @@ A tiered semantic memory system with three-tier retrieval capabilities and autom
13
13
 
14
14
  **What the plugin does:**
15
15
  - Stores memory data in the local user data directory
16
- - Starts services on local ports (Qdrant, Cortex Memory)
17
- - Requires LLM/Embedding API keys (stored in OpenClaw plugin configuration, marked as sensitive)
16
+ - Based on advanced Cortex Memory technology, providing outstanding memory management capabilities with high performance and accuracy.
18
17
  - Only reads existing OpenClaw memory files during migration
19
18
 
20
19
  **What the plugin does NOT do:**
@@ -35,31 +34,12 @@ The search engine queries all three tiers internally and returns unified results
35
34
 
36
35
  ## Configuration
37
36
 
38
- ### Modifying API Configuration
39
-
40
- To modify API configuration:
37
+ All configuration is managed through OpenClaw plugin settings. To view or modify:
41
38
 
42
39
  1. Open OpenClaw settings (`openclaw.json` or via UI)
43
40
  2. Navigate to Plugins → MemClaw → Configuration
44
- 3. Modify the desired fields
45
- 4. Save and restart OpenClaw
46
-
47
- ### Configuration Options
48
-
49
- | Option | Type | Default | Description |
50
- |--------|------|---------|-------------|
51
- | `serviceUrl` | string | `http://localhost:8085` | Service URL |
52
- | `tenantId` | string | `tenant_claw` | Tenant ID (data isolation) |
53
- | `autoStartServices` | boolean | `true` | Auto-start services |
54
- | `defaultSessionId` | string | `default` | Default session ID |
55
- | `searchLimit` | number | `10` | Default number of search results |
56
- | `minScore` | number | `0.6` | Minimum relevance score (0-1) |
57
- | `llmApiKey` | string | - | LLM API key (sensitive) |
58
- | `llmApiBaseUrl` | string | `https://api.openai.com/v1` | LLM API endpoint |
59
- | `llmModel` | string | `gpt-5-mini` | LLM model name |
60
- | `embeddingApiKey` | string | - | Embedding API key (sensitive) |
61
- | `embeddingApiBaseUrl` | string | `https://api.openai.com/v1` | Embedding API endpoint |
62
- | `embeddingModel` | string | `text-embedding-3-small` | Embedding model name |
41
+ 3. Verify or update the required fields
42
+ 4. Save changes and **restart OpenClaw Gateway** for changes to take effect
63
43
 
64
44
  ## Usage Guide
65
45
 
@@ -98,15 +78,37 @@ To modify API configuration:
98
78
  { "content": "User prefers TypeScript with strict mode enabled", "role": "assistant" }
99
79
  ```
100
80
 
101
- ## Common Issues
81
+ ## Troubleshooting
82
+
83
+ If MemClaw is not working properly, follow these steps:
84
+
85
+ ### Step 1: Check Plugin Configuration
86
+
87
+ Open OpenClaw settings and verify MemClaw plugin configuration:
88
+
89
+ 1. Open `openclaw.json` or navigate to Settings → Plugins → MemClaw
90
+ 2. Ensure all required fields are correctly filled, especially the configuration sections related to LLM and Embedding.
91
+ 3. Save the configuration file
92
+
93
+ ### Step 2: Restart OpenClaw Gateway
94
+
95
+ After making configuration changes, **you MUST restart OpenClaw Gateway** for the changes to take effect.
96
+
97
+ ### Step 3: Verify Services
98
+
99
+ If issues persist after restart:
100
+ - Run `cortex_list_sessions` to check if the service is responding
101
+ - Check if Qdrant and cortex-mem-service are running (auto-start should handle this)
102
102
 
103
103
  | Issue | Solution |
104
104
  |-------|----------|
105
- | Service won't start | Check if ports 6333, 6334, 8085 are in use; confirm API keys are configured |
106
- | No search results | Run `cortex_list_sessions` to verify; lower `min_score` threshold |
107
- | LLM/Embedding errors | Verify `llmApiKey` and `embeddingApiKey` are configured correctly |
108
- | Migration failed | Confirm OpenClaw workspace is at `~/.openclaw/workspace` |
105
+ | No search results | Run `cortex_list_sessions` to verify; lower `min_score` threshold; ensure memories have been stored |
106
+ | Service connection errors | Verify `serviceUrl` is correct; check if services are running |
107
+ | LLM/Embedding errors | Verify API URLs and credentials in plugin configuration; restart OpenClaw Gateway after changes |
109
108
 
110
109
  ## References
111
110
 
111
+ - **`references/best-practices.md`** — Tool selection, session lifecycle, search strategies, and common pitfalls
112
112
  - **`references/tools.md`** — Detailed tool parameters and examples
113
+ - **Open Source**: [Cortex Memory and MemClaw](https://github.com/sopaco/cortex-mem)
114
+ - **README**: [MemClaw README](https://raw.githubusercontent.com/sopaco/cortex-mem/refs/heads/main/examples/%40memclaw/plugin/README.md)
@@ -0,0 +1,319 @@
1
+ # MemClaw Best Practices
2
+
3
+ This guide provides proven strategies and decision frameworks for using MemClaw effectively in OpenClaw.
4
+
5
+ ## Tool Selection Decision Tree
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────────────────────┐
9
+ │ What do you need to do? │
10
+ └─────────────────────────────────────────────────────────────────┘
11
+
12
+ ┌─────────────────────┼─────────────────────┐
13
+ ▼ ▼ ▼
14
+ Find Info Save Info Manage Sessions
15
+ │ │ │
16
+ ▼ ▼ ▼
17
+ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
18
+ │ Need context? │ │ What kind? │ │ What? │
19
+ └───────────────┘ └───────────────┘ └───────────────┘
20
+ │ │ │
21
+ ┌────┴────┐ ┌────┴────┐ ┌────┴────┐
22
+ ▼ ▼ ▼ ▼ ▼ ▼
23
+ Quick Full Facts Conversation List Close &
24
+ Search Context History Sessions Extract
25
+ │ │ │ │ │ │
26
+ ▼ ▼ ▼ ▼ ▼ ▼
27
+ cortex_ cortex_ cortex_ cortex_ cortex_ cortex_
28
+ search recall add_ add_ list_ close_
29
+ memory memory sessions session
30
+ ```
31
+
32
+ ### Quick Reference
33
+
34
+ | Scenario | Tool | Why |
35
+ |----------|------|-----|
36
+ | Quick lookup, need summary only | `cortex_search` | Fast, returns snippets |
37
+ | Need full context/details | `cortex_recall` | Returns content + snippet |
38
+ | User stated preference/decision | `cortex_add_memory` | Explicit persistence |
39
+ | Important conversation content | Let it accumulate | Auto-stored in session |
40
+ | Task/topic completed | `cortex_close_session` | Trigger extraction |
41
+ | Check if memories exist | `cortex_list_sessions` | Verify before search |
42
+
43
+ ## Session Lifecycle Management
44
+
45
+ ### The Golden Rule
46
+
47
+ > **OpenClaw does NOT automatically trigger memory extraction.** You must proactively call `cortex_close_session` at natural checkpoints.
48
+
49
+ ### When to Close a Session
50
+
51
+ ```
52
+ ┌────────────────────────────────────────────────────────────────┐
53
+ │ Timing Decision Flow │
54
+ └────────────────────────────────────────────────────────────────┘
55
+
56
+
57
+ ┌─────────────────┐
58
+ │ Task completed? │
59
+ └─────────────────┘
60
+ │ │
61
+ Yes No
62
+ │ │
63
+ ▼ ▼
64
+ ┌──────────┐ ┌─────────────────┐
65
+ │ CLOSE IT │ │ Topic shifted? │
66
+ └──────────┘ └─────────────────┘
67
+ │ │
68
+ Yes No
69
+ │ │
70
+ ▼ ▼
71
+ ┌──────────┐ ┌─────────────────┐
72
+ │ CLOSE IT │ │ 10+ exchanges? │
73
+ └──────────┘ └─────────────────┘
74
+ │ │
75
+ Yes No
76
+ │ │
77
+ ▼ ▼
78
+ ┌──────────┐ ┌────────┐
79
+ │ CLOSE IT │ │ WAIT │
80
+ └──────────┘ └────────┘
81
+ ```
82
+
83
+ ### Rhythm Guidelines
84
+
85
+ | Conversation Type | Close Frequency | Reason |
86
+ |-------------------|-----------------|--------|
87
+ | Quick Q&A | End of conversation | Minimal content to extract |
88
+ | Task-oriented | After each task completion | Captures task-specific memories |
89
+ | Long discussion | Every 10-20 exchanges | Prevents memory loss |
90
+ | Exploratory chat | When topic shifts | Organizes memories by topic |
91
+
92
+ ### Anti-Patterns to Avoid
93
+
94
+ | ❌ Don't Do This | ✅ Do This Instead |
95
+ |-------------------|-------------------|
96
+ | Call `close_session` after every message | Call at natural checkpoints |
97
+ | Wait until conversation ends (user may forget) | Proactively close during conversation |
98
+ | Close without accumulating content | Let 5-10 exchanges happen first |
99
+ | Never close sessions | Establish a rhythm |
100
+
101
+ ## Memory Storage Strategy
102
+
103
+ ### What to Explicitly Store
104
+
105
+ Use `cortex_add_memory` for:
106
+
107
+ 1. **Explicit User Preferences**
108
+ ```
109
+ "User prefers dark theme in all editors"
110
+ "User wants commit messages in conventional format"
111
+ ```
112
+
113
+ 2. **Important Decisions**
114
+ ```
115
+ "Decided to use PostgreSQL instead of MySQL for this project"
116
+ "User chose React over Vue for the frontend"
117
+ ```
118
+
119
+ 3. **Key Information That May Be Lost**
120
+ ```
121
+ "User's timezone is UTC+8"
122
+ "Project deadline: March 30, 2026"
123
+ ```
124
+
125
+ ### What to Let Accumulate
126
+
127
+ Don't use `cortex_add_memory` for:
128
+
129
+ - Regular conversation content (auto-stored in session)
130
+ - Contextual information (captured on close_session)
131
+ - Temporary preferences (not worth persisting)
132
+
133
+ ### Role Parameter Usage
134
+
135
+ | Role | When to Use |
136
+ |------|-------------|
137
+ | `user` | User's statements, preferences, questions (default) |
138
+ | `assistant` | Your responses, explanations, code you wrote |
139
+ | `system` | Important context, rules, constraints |
140
+
141
+ ## Search Strategies
142
+
143
+ ### Query Formulation
144
+
145
+ ```
146
+ ┌────────────────────────────────────────────────────────────────┐
147
+ │ Query Formulation Tips │
148
+ └────────────────────────────────────────────────────────────────┘
149
+
150
+ BAD: "it" — Too vague
151
+ GOOD: "database choice" — Specific topic
152
+
153
+ BAD: "the user said something" — Unfocused
154
+ GOOD: "user preference for testing" — Clear intent
155
+
156
+ BAD: "code" — Too broad
157
+ GOOD: "authentication implementation" — Specific domain
158
+ ```
159
+
160
+ ### Score Threshold Guidelines
161
+
162
+ | Score | Use Case |
163
+ |-------|----------|
164
+ | 0.8+ | Need high-confidence matches only |
165
+ | 0.6 (default) | Balanced precision/recall |
166
+ | 0.4-0.5 | Exploratory search, finding related items |
167
+ | <0.4 | Usually too noisy, not recommended |
168
+
169
+ ### Scope Parameter Usage
170
+
171
+ ```
172
+ # Search across all sessions (default)
173
+ { "query": "database decisions" }
174
+
175
+ # Search within specific session
176
+ { "query": "preferences", "scope": "project-alpha" }
177
+ ```
178
+
179
+ Use `scope` when:
180
+ - You know the relevant session ID
181
+ - Working within a specific project context
182
+ - Want to limit noise from other sessions
183
+
184
+ ## Common Pitfalls
185
+
186
+ ### 1. Memory Not Found After Close
187
+
188
+ **Symptom:** You closed a session but search returns nothing.
189
+
190
+ **Cause:** Memory extraction is asynchronous and may take 30-60 seconds.
191
+
192
+ **Solution:** Wait briefly after close_session before searching, or:
193
+ ```
194
+ 1. Close session
195
+ 2. Continue with other work
196
+ 3. Memory will be indexed automatically
197
+ ```
198
+
199
+ ### 2. Duplicate Memories
200
+
201
+ **Symptom:** Same information appears multiple times.
202
+
203
+ **Cause:** Both explicit `add_memory` and `close_session` extraction captured the same content.
204
+
205
+ **Solution:** Use `add_memory` only for information that:
206
+ - Won't naturally be captured in conversation
207
+ - Needs explicit emphasis
208
+ - Is a correction or override of previous information
209
+
210
+ ### 3. Irrelevant Search Results
211
+
212
+ **Symptom:** Search returns unrelated content.
213
+
214
+ **Cause:** Query too vague or score threshold too low.
215
+
216
+ **Solution:**
217
+ - Make queries more specific
218
+ - Increase `min_score` threshold
219
+ - Use `scope` to limit search range
220
+
221
+ ### 4. Lost Session Content
222
+
223
+ **Symptom:** Important conversation not in memory.
224
+
225
+ **Cause:** Session was never closed.
226
+
227
+ **Solution:** Establish a habit of closing sessions at checkpoints. If you realize too late, the raw messages may still exist in the session - close it now.
228
+
229
+ ### 5. Configuration Issues
230
+
231
+ **Symptom:** Tools return errors about service/API.
232
+
233
+ **Cause:** LLM/Embedding credentials not configured.
234
+
235
+ **Solution:** See SKILL.md → Troubleshooting section.
236
+
237
+ ## Workflow Examples
238
+
239
+ ### Example 1: New Project Discussion
240
+
241
+ ```
242
+ 1. User starts discussing a new project
243
+ → Just listen and respond naturally
244
+
245
+ 2. User makes architecture decisions
246
+ → Optionally: cortex_add_memory for explicit decisions
247
+
248
+ 3. Discussion shifts to another topic
249
+ → cortex_close_session (captures project discussion memories)
250
+
251
+ 4. Continue with new topic
252
+ → Fresh start, memories from step 3 are now searchable
253
+ ```
254
+
255
+ ### Example 2: Finding Previous Context
256
+
257
+ ```
258
+ 1. User asks: "What did we decide about auth?"
259
+
260
+ 2. cortex_search({ query: "authentication decision" })
261
+
262
+ 3. If results show snippets but need details:
263
+ cortex_recall({ query: "authentication implementation details" })
264
+
265
+ 4. Summarize findings to user
266
+ ```
267
+
268
+ ### Example 3: User States Preference
269
+
270
+ ```
271
+ 1. User: "I always want TypeScript strict mode"
272
+
273
+ 2. cortex_add_memory({
274
+ content: "User requires TypeScript strict mode in all projects",
275
+ role: "user"
276
+ })
277
+
278
+ 3. Acknowledge and remember for future
279
+ ```
280
+
281
+ ## Memory Architecture Reference
282
+
283
+ ### L0/L1/L2 Tier System
284
+
285
+ | Tier | Content | Size | Purpose | Search Role |
286
+ |------|---------|------|---------|-------------|
287
+ | L0 | Abstract summary | ~100 tokens | Quick filtering | First pass |
288
+ | L1 | Key points + context | ~2000 tokens | Context refinement | Second pass |
289
+ | L2 | Full original content | Complete | Exact matching | Final retrieval |
290
+
291
+ ### How Search Works Internally
292
+
293
+ ```
294
+ Query → L0 Filter → L1 Refine → L2 Retrieve → Ranked Results
295
+ │ │ │
296
+ ▼ ▼ ▼
297
+ Quick scan Contextual Full content
298
+ by summary refinement for precision
299
+ ```
300
+
301
+ ### Automatic Processes
302
+
303
+ | Process | Trigger | Duration |
304
+ |---------|---------|----------|
305
+ | Vector embedding | On `add_memory` | Seconds |
306
+ | L0/L1 generation | On `add_memory` (async) | Seconds |
307
+ | Full extraction | On `close_session` | 30-60s |
308
+ | Maintenance | Every 3 hours (auto) | Minutes |
309
+
310
+ ## Summary Checklist
311
+
312
+ Before ending a conversation or topic transition, ask yourself:
313
+
314
+ - [ ] Have we accumulated meaningful content?
315
+ - [ ] Did the user share important preferences or decisions?
316
+ - [ ] Is this a natural checkpoint?
317
+ - [ ] Should I close the session now?
318
+
319
+ If yes to any, call `cortex_close_session`.
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: memclaw-setup
3
- description: MemClaw Setup Guide — Installation and configuration guidance for users without the @memclaw/memclaw plugin installed. After completing installation, use the `memclaw` skill for daily usage help.
2
+ name: memclaw-maintance
3
+ description: MemClaw Maintance Guide — Installation and configuration guidance for users especially without the @memclaw/memclaw plugin installed. For normal use cases, use the `memclaw` skill for daily usage help.
4
4
  ---
5
5
 
6
6
  # MemClaw Setup Guide
@@ -35,7 +35,7 @@ The search engine queries all three tiers internally and returns unified results
35
35
 
36
36
  ## Installation Steps
37
37
 
38
- ### Step 1: Install the Plugin
38
+ ### Step 1: Install the Plugin (for users without the @memclaw/memclaw plugin)
39
39
 
40
40
  Execute the following command to install the plugin:
41
41
 
@@ -43,12 +43,7 @@ Execute the following command to install the plugin:
43
43
  openclaw plugins install @memclaw/memclaw
44
44
  ```
45
45
 
46
- The installation process will:
47
- - Download the plugin from the package registry (npm, clawhub)
48
- - Automatically install platform-specific binary dependencies
49
- - Register the plugin in OpenClaw
50
-
51
- ### Step 1: Enable the Plugin
46
+ ### Step 2: Enable the Plugin
52
47
 
53
48
  Enable MemClaw in `openclaw.json`:
54
49
 
@@ -143,3 +138,5 @@ After installation, use the following decision flow for memory operations:
143
138
 
144
139
  - **`references/tools.md`** — Detailed tool parameters and examples
145
140
  - **`references/troubleshooting.md`** — Common troubleshooting issues
141
+ - **Open Source**: [Cortex Memory and MemClaw](https://github.com/sopaco/cortex-mem)
142
+ - **README**: [MemClaw README](https://raw.githubusercontent.com/sopaco/cortex-mem/refs/heads/main/examples/%40memclaw/plugin/README.md)