@memclaw/memclaw 0.9.9

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.
@@ -0,0 +1,255 @@
1
+ # Setup Guide
2
+
3
+ Installation and configuration guide for MemClaw.
4
+
5
+ ## Supported Platforms
6
+
7
+ | Platform | npm Package |
8
+ |----------|-------------|
9
+ | macOS Apple Silicon | `@memclaw/bin-darwin-arm64` |
10
+ | Windows x64 | `@memclaw/bin-win-x64` |
11
+
12
+ > **Note**: MemClaw is only supported on the platforms listed above.
13
+
14
+ ## Requirements
15
+
16
+ | Requirement | Details |
17
+ |-------------|---------|
18
+ | **Node.js** | ≥ 20.0.0 |
19
+ | **OpenClaw** | Installed and configured |
20
+ | **Qdrant** | Vector database (port 6333/6334) |
21
+ | **cortex-mem-service** | Memory service (port 8085) |
22
+
23
+ ## Binary Installation
24
+
25
+ MemClaw binaries (Qdrant, cortex-mem-service, cortex-mem-cli) are distributed via platform-specific npm packages:
26
+
27
+ - `@memclaw/bin-darwin-arm64` — macOS Apple Silicon
28
+ - `@memclaw/bin-win-x64` — Windows x64
29
+
30
+ These packages are installed automatically as optional dependencies when installing `@memclaw/memclaw`.
31
+
32
+ ### Manual Binary Installation
33
+
34
+ If binaries are not installed, run:
35
+
36
+ ```
37
+ npm install @memclaw/bin-darwin-arm64
38
+ or
39
+ bun install @memclaw/bin-darwin-arm64
40
+ ```
41
+
42
+ or (for Windows):
43
+
44
+ ```
45
+ npm install @memclaw/bin-win-x64
46
+ or
47
+ bun install @memclaw/bin-win-x64
48
+ ```
49
+
50
+ ## First-Time Setup Checklist
51
+
52
+ **Before using MemClaw, complete these steps:**
53
+
54
+ ### Step 1: Verify Platform Support
55
+
56
+ Ensure you are on a supported platform (macOS Apple Silicon or Windows x86/x64).
57
+
58
+ ### Step 2: Create Data Directory
59
+
60
+ Create the data directory if it does not exist:
61
+
62
+ | Platform | Command |
63
+ |----------|---------|
64
+ | macOS | `mkdir -p ~/Library/Application\ Support/memclaw` |
65
+ | Windows | `mkdir %LOCALAPPDATA%\memclaw` |
66
+ | Linux | `mkdir -p ~/.local/share/memclaw` |
67
+
68
+ ### Step 3: Ask User for Configuration
69
+
70
+ **Agent MUST ask the user for the following information:**
71
+
72
+ 1. **LLM Configuration**:
73
+ - API endpoint URL (OpenAI-compatible)
74
+ - API key
75
+
76
+ 2. **Embedding Configuration**:
77
+ - API endpoint URL (OpenAI-compatible)
78
+ - API key
79
+ - Model name (default: `text-embedding-3-small`)
80
+
81
+ ### Step 4: Write Configuration File
82
+
83
+ Write `config.toml` to the data directory with all required sections:
84
+
85
+ | Platform | config.toml Path |
86
+ |----------|------------------|
87
+ | macOS | `~/Library/Application Support/memclaw/config.toml` |
88
+ | Windows | `%LOCALAPPDATA%\memclaw\config.toml` |
89
+ | Linux | `~/.local/share/memclaw/config.toml` |
90
+
91
+ **Full configuration template:**
92
+
93
+ ```toml
94
+ # Qdrant Vector Database Configuration
95
+ [qdrant]
96
+ url = "http://localhost:6334"
97
+ collection_name = "memclaw"
98
+ timeout_secs = 30
99
+
100
+ # LLM Configuration [REQUIRED]
101
+ [llm]
102
+ api_base_url = "https://your-llm-provider.com/v1"
103
+ api_key = "your-api-key-here"
104
+ model_efficient = "gpt-5-mini"
105
+ temperature = 0.1
106
+ max_tokens = 4096
107
+
108
+ # Embedding Configuration [REQUIRED]
109
+ [embedding]
110
+ api_base_url = "https://your-embedding-provider.com/v1"
111
+ api_key = "your-api-key-here"
112
+ model_name = "text-embedding-3-small"
113
+ batch_size = 10
114
+ timeout_secs = 30
115
+
116
+ # Service Configuration
117
+ [server]
118
+ host = "localhost"
119
+ port = 8085
120
+
121
+ # Logging Configuration
122
+ [logging]
123
+ enabled = false
124
+ log_directory = "logs"
125
+ level = "info"
126
+
127
+ # Cortex Memory Settings
128
+ [cortex]
129
+ enable_intent_analysis = false
130
+ ```
131
+
132
+ > **CRITICAL**: All sections are required. If any section is missing, cortex-mem-service will silently fall back to environment variables and the configuration will be ignored.
133
+
134
+ ### Step 5: Verify Services
135
+
136
+ Check that Qdrant and cortex-mem-service are accessible:
137
+
138
+ | Service | Port | Health Check |
139
+ |---------|------|--------------|
140
+ | Qdrant | 6333 (HTTP), 6334 (gRPC) | HTTP GET to `http://localhost:6333` should return Qdrant version info |
141
+ | cortex-mem-service | 8085 | HTTP GET to `http://localhost:8085/health` should return `{"status":"ok"}` |
142
+
143
+ ### Step 6: Start Services (if not running)
144
+
145
+ **Starting Qdrant:**
146
+
147
+ If `autoStartServices` is `true` in plugin config, MemClaw will start Qdrant automatically.
148
+
149
+ To start manually, run the Qdrant binary from the platform package with:
150
+ - `--storage-path` pointing to a storage directory
151
+ - `--http-port 6333`
152
+ - `--grpc-port 6334`
153
+
154
+ **Starting cortex-mem-service:**
155
+
156
+ **CRITICAL**: cortex-mem-service MUST be started with `--data-dir` flag pointing to the directory containing `config.toml`.
157
+
158
+ Arguments:
159
+ - `--data-dir <path>` — Path to data directory containing `config.toml` (**REQUIRED**)
160
+
161
+ Example:
162
+ ```
163
+ cortex-mem-service --data-dir ~/Library/Application\ Support/memclaw
164
+ ```
165
+
166
+ Or on Windows:
167
+ ```
168
+ cortex-mem-service --data-dir %LOCALAPPDATA%\memclaw
169
+ ```
170
+
171
+ ## Plugin Configuration
172
+
173
+ Edit your `openclaw.json`:
174
+
175
+ ```json
176
+ {
177
+ "plugins": {
178
+ "entries": {
179
+ "memclaw": {
180
+ "enabled": true,
181
+ "config": {
182
+ "serviceUrl": "http://localhost:8085",
183
+ "tenantId": "tenant_claw",
184
+ "autoStartServices": true
185
+ }
186
+ }
187
+ }
188
+ },
189
+ "agents": {
190
+ "defaults": {
191
+ "memorySearch": { "enabled": false }
192
+ }
193
+ }
194
+ }
195
+ ```
196
+
197
+ > **Important**: Set `memorySearch.enabled: false` to disable OpenClaw's built-in memory search and use MemClaw instead.
198
+
199
+ ### Configuration Options
200
+
201
+ | Option | Type | Default | Description |
202
+ |--------|------|---------|-------------|
203
+ | `serviceUrl` | string | `http://localhost:8085` | Cortex Memory service URL |
204
+ | `tenantId` | string | `tenant_claw` | Tenant ID for data isolation |
205
+ | `autoStartServices` | boolean | `true` | Auto-start Qdrant and cortex-mem-service |
206
+ | `defaultSessionId` | string | `default` | Default session for memory operations |
207
+ | `searchLimit` | number | `10` | Default number of search results |
208
+ | `minScore` | number | `0.6` | Minimum relevance score (0-1) |
209
+
210
+ ## Troubleshooting
211
+
212
+ ### Platform Not Supported
213
+
214
+ If you see "Platform not supported" error:
215
+ - Verify you are on macOS Apple Silicon or Windows x64
216
+ - Check that the correct `@memclaw/bin-*` package is installed
217
+
218
+ ### Binaries Not Found
219
+
220
+ If binaries are missing:
221
+ 1. Verify `@memclaw/bin-*` package is in `node_modules`
222
+ 2. Try npm/bun reinstalling: `npm install @memclaw/bin-darwin-arm64` (or `bin-win-x64`)
223
+
224
+ ### cortex-mem-service Won't Start
225
+
226
+ 1. Verify `--data-dir` flag is provided
227
+ 2. Verify `config.toml` exists in the data directory
228
+ 3. Verify required fields in `config.toml`:
229
+ - `llm.api_key` is non-empty
230
+ - `embedding.api_key` is non-empty
231
+
232
+ Default data directories:
233
+ | Platform | Path |
234
+ |----------|------|
235
+ | macOS | `~/Library/Application Support/memclaw` |
236
+ | Windows | `%LOCALAPPDATA%\memclaw` |
237
+ | Linux | `~/.local/share/memclaw` |
238
+
239
+ ### Services Not Accessible
240
+
241
+ 1. Verify ports 6333, 6334, 8085 are not in use by other applications
242
+ 2. Verify firewall allows connections on these ports
243
+ 3. Check service logs for error messages
244
+
245
+ ### Configuration File Issues
246
+
247
+ 1. Ensure `config.toml` uses valid TOML syntax
248
+ 2. Verify file encoding is UTF-8
249
+ 3. On Windows, use double backslashes in paths: `C:\\Users\\...`
250
+
251
+ ### API Key Issues
252
+
253
+ 1. Verify API key is valid and has sufficient credits
254
+ 2. Verify `api_base_url` is correct for your provider
255
+ 3. Verify network connectivity to the API endpoint
@@ -0,0 +1,170 @@
1
+ # Tools Reference
2
+
3
+ Detailed documentation for MemClaw tools.
4
+
5
+ ## cortex_search
6
+
7
+ Semantic search across all memories using L0/L1/L2 tiered retrieval.
8
+
9
+ **Parameters:**
10
+
11
+ | Parameter | Type | Required | Default | Description |
12
+ |-----------|------|----------|---------|-------------|
13
+ | `query` | string | Yes | - | The search query - natural language or keywords |
14
+ | `scope` | string | No | - | Session/thread ID to limit search scope |
15
+ | `limit` | integer | No | 10 | Maximum number of results |
16
+ | `min_score` | number | No | 0.6 | Minimum relevance score (0-1) |
17
+
18
+ **When to use:**
19
+ - Find past conversations or decisions
20
+ - Search for specific information across all sessions
21
+ - Discover related memories by semantic similarity
22
+
23
+ **Example:**
24
+ ```json
25
+ {
26
+ "query": "database architecture decisions",
27
+ "limit": 5,
28
+ "min_score": 0.6
29
+ }
30
+ ```
31
+
32
+ **Response format:**
33
+ - Returns ranked results with relevance scores
34
+ - Each result includes `uri`, `score`, and `snippet`
35
+
36
+ ---
37
+
38
+ ## cortex_recall
39
+
40
+ Recall memories with more context (snippet + full content).
41
+
42
+ **Parameters:**
43
+
44
+ | Parameter | Type | Required | Default | Description |
45
+ |-----------|------|----------|---------|-------------|
46
+ | `query` | string | Yes | - | The search query |
47
+ | `scope` | string | No | - | Session/thread ID to limit search scope |
48
+ | `limit` | integer | No | 10 | Maximum number of results |
49
+
50
+ **When to use:**
51
+ - Need memories with full context, not just summaries
52
+ - Want to see the original content, not just snippets
53
+ - Conducting detailed memory analysis
54
+
55
+ **Example:**
56
+ ```json
57
+ {
58
+ "query": "user preferences for code style",
59
+ "limit": 10
60
+ }
61
+ ```
62
+
63
+ **Response format:**
64
+ - Returns results with both `snippet` (summary) and `content` (full text)
65
+ - Content is truncated if very long (>300 chars preview)
66
+
67
+ ---
68
+
69
+ ## cortex_add_memory
70
+
71
+ Store a message for future retrieval.
72
+
73
+ **Parameters:**
74
+
75
+ | Parameter | Type | Required | Default | Description |
76
+ |-----------|------|----------|---------|-------------|
77
+ | `content` | string | Yes | - | The content to store in memory |
78
+ | `role` | string | No | `user` | Role of the message sender: `user`, `assistant`, or `system` |
79
+ | `session_id` | string | No | `default` | Session/thread ID for the memory |
80
+
81
+ **When to use:**
82
+ - Persist important information for future retrieval
83
+ - Store user preferences or decisions
84
+ - Save context that should be searchable later
85
+
86
+ **Example:**
87
+ ```json
88
+ {
89
+ "content": "User prefers TypeScript with strict mode enabled and explicit return types",
90
+ "role": "assistant",
91
+ "session_id": "default"
92
+ }
93
+ ```
94
+
95
+ **What happens:**
96
+ - Message is stored with timestamp
97
+ - Vector embedding is generated automatically
98
+ - L0/L1 layers are generated asynchronously
99
+
100
+ ---
101
+
102
+ ## cortex_list_sessions
103
+
104
+ List all memory sessions with their status.
105
+
106
+ **Parameters:** None
107
+
108
+ **When to use:**
109
+ - Verify sessions exist before searching
110
+ - Check which sessions are active or closed
111
+ - Audit memory usage
112
+
113
+ **Response format:**
114
+ - Session IDs, status, message counts
115
+ - Creation and update timestamps
116
+
117
+ ---
118
+
119
+ ## cortex_close_session
120
+
121
+ Close a session and trigger memory extraction pipeline.
122
+
123
+ **Parameters:**
124
+
125
+ | Parameter | Type | Required | Default | Description |
126
+ |-----------|------|----------|---------|-------------|
127
+ | `session_id` | string | No | `default` | Session/thread ID to close |
128
+
129
+ **When to use:**
130
+ - Conversation is complete
131
+ - Ready to extract structured memories
132
+ - Want to finalize the session's memory content
133
+
134
+ **What happens:**
135
+ 1. Extracts structured memories (user preferences, entities, decisions)
136
+ 2. Generates complete L0/L1 layer summaries
137
+ 3. Indexes all extracted memories into the vector database
138
+
139
+ **Note:** This is a potentially long-running operation (30-60 seconds).
140
+
141
+ **Example:**
142
+ ```json
143
+ {
144
+ "session_id": "default"
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ ## cortex_migrate
151
+
152
+ Migrate memories from OpenClaw's native memory system to MemClaw.
153
+
154
+ **Parameters:** None
155
+
156
+ **When to use:**
157
+ - First time setup with existing OpenClaw memory
158
+ - Want to preserve previous conversation history
159
+ - Switching from built-in memory to MemClaw
160
+
161
+ **What happens:**
162
+ 1. Finds OpenClaw memory files (`memory/*.md` and `MEMORY.md`)
163
+ 2. Converts them to MemClaw's L2 format
164
+ 3. Generates L0/L1 layers and vector index
165
+
166
+ **Prerequisites:**
167
+ - OpenClaw workspace exists at `~/.openclaw/workspace`
168
+ - Memory files exist in `~/.openclaw/workspace/memory/`
169
+
170
+ **Run only once during initial setup.**