@totalreclaw/totalreclaw 1.6.0 → 3.0.6
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/CLAWHUB.md +134 -0
- package/README.md +407 -64
- package/SKILL.md +1032 -0
- package/api-client.ts +5 -5
- package/claims-helper.ts +686 -0
- package/config.ts +211 -0
- package/consolidation.ts +141 -33
- package/contradiction-sync.ts +1389 -0
- package/crypto.ts +63 -261
- package/digest-sync.ts +516 -0
- package/embedding.ts +69 -46
- package/extractor.ts +1307 -84
- package/hot-cache-wrapper.ts +1 -1
- package/import-adapters/gemini-adapter.ts +243 -0
- package/import-adapters/index.ts +3 -0
- package/import-adapters/types.ts +1 -1
- package/index.ts +1887 -323
- package/llm-client.ts +106 -53
- package/lsh.ts +21 -210
- package/package.json +20 -7
- package/pin.ts +502 -0
- package/reranker.ts +96 -124
- package/skill.json +213 -0
- package/subgraph-search.ts +112 -5
- package/subgraph-store.ts +559 -275
- package/consolidation.test.ts +0 -356
- package/extractor-dedup.test.ts +0 -168
- package/import-adapters/import-adapters.test.ts +0 -1123
- package/lsh.test.ts +0 -463
- package/pocv2-e2e-test.ts +0 -917
- package/porter-stemmer.d.ts +0 -4
- package/reranker.test.ts +0 -594
- package/semantic-dedup.test.ts +0 -392
- package/setup.sh +0 -19
- package/store-dedup-wiring.test.ts +0 -186
package/SKILL.md
ADDED
|
@@ -0,0 +1,1032 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: totalreclaw
|
|
3
|
+
description: "End-to-end encrypted memory for AI agents — portable, yours forever. XChaCha20-Poly1305 E2EE: server never sees plaintext."
|
|
4
|
+
version: 1.6.0
|
|
5
|
+
author: TotalReclaw Team
|
|
6
|
+
license: MIT
|
|
7
|
+
homepage: https://totalreclaw.xyz
|
|
8
|
+
metadata:
|
|
9
|
+
openclaw:
|
|
10
|
+
requires:
|
|
11
|
+
env: []
|
|
12
|
+
bins: []
|
|
13
|
+
emoji: "🧠"
|
|
14
|
+
os: ["macos", "linux", "windows"]
|
|
15
|
+
keywords:
|
|
16
|
+
- memory
|
|
17
|
+
- e2ee
|
|
18
|
+
- e2e-encryption
|
|
19
|
+
- encryption
|
|
20
|
+
- privacy
|
|
21
|
+
- agent-memory
|
|
22
|
+
- persistent-context
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# TotalReclaw Skill
|
|
26
|
+
|
|
27
|
+
## Recovery Phrase -- READ THIS FIRST
|
|
28
|
+
|
|
29
|
+
**CRITICAL SAFETY WARNING:** TotalReclaw generates a NEW recovery phrase for the user. NEVER let the user enter a recovery phrase from an existing crypto wallet they own. TotalReclaw uses BIP-39 mnemonics (the same format as crypto wallets), but TotalReclaw recovery phrases must be SEPARATE from any funded wallet. If a user tries to import a phrase they already use for a crypto wallet, STOP and warn them: "Do NOT use a recovery phrase from an existing crypto wallet. TotalReclaw should have its own dedicated phrase to keep your funds safe."
|
|
30
|
+
|
|
31
|
+
The recovery phrase is the user's ONLY identity in TotalReclaw. It derives all encryption keys. There is NO password reset, NO recovery mechanism, and NO support channel that can help if it is lost.
|
|
32
|
+
|
|
33
|
+
**When showing the recovery phrase to the user, ALWAYS include this warning:**
|
|
34
|
+
|
|
35
|
+
> Your recovery phrase is the ONLY way to access your encrypted memories. If you lose it, your memories are gone forever -- there is no password reset, no recovery, and no support that can help. Write it down and store it somewhere safe. Never share it with anyone.
|
|
36
|
+
>
|
|
37
|
+
> IMPORTANT: This phrase is for TotalReclaw ONLY. Never use a recovery phrase from an existing crypto wallet -- keep your TotalReclaw phrase separate from any wallet that holds funds.
|
|
38
|
+
|
|
39
|
+
If the user asks to see their recovery phrase, remind them to store it securely. If they mention losing it, be clear that recovery is impossible and they will need to start fresh with a new phrase.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Tools
|
|
44
|
+
|
|
45
|
+
### totalreclaw_remember
|
|
46
|
+
|
|
47
|
+
Store a new fact or preference in long-term memory.
|
|
48
|
+
|
|
49
|
+
**Parameters:**
|
|
50
|
+
|
|
51
|
+
| Name | Type | Required | Description |
|
|
52
|
+
|------|------|----------|-------------|
|
|
53
|
+
| text | string | Yes | The fact or information to remember |
|
|
54
|
+
| type | string | No | Type of memory: `fact`, `preference`, `decision`, `episodic`, `goal`, `context`, or `summary`. Default: `fact` |
|
|
55
|
+
| importance | integer | No | Importance score 1-10. Default: auto-detected by LLM |
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"text": "User prefers TypeScript over JavaScript for new projects",
|
|
61
|
+
"type": "preference",
|
|
62
|
+
"importance": 7
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Returns:**
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"factId": "01234567-89ab-cdef-0123-456789abcdef",
|
|
70
|
+
"status": "stored",
|
|
71
|
+
"importance": 7,
|
|
72
|
+
"encrypted": true
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### totalreclaw_recall
|
|
79
|
+
|
|
80
|
+
Search and retrieve relevant memories from long-term storage.
|
|
81
|
+
|
|
82
|
+
**Parameters:**
|
|
83
|
+
|
|
84
|
+
| Name | Type | Required | Description |
|
|
85
|
+
|------|------|----------|-------------|
|
|
86
|
+
| query | string | Yes | Natural language query to search memories |
|
|
87
|
+
| k | integer | No | Number of results to return. Default: 8, Max: 20 |
|
|
88
|
+
|
|
89
|
+
**Example:**
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"query": "What programming languages does the user prefer?",
|
|
93
|
+
"k": 5
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Returns:**
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"memories": [
|
|
101
|
+
{
|
|
102
|
+
"factId": "01234567-89ab-cdef-0123-456789abcdef",
|
|
103
|
+
"factText": "User prefers TypeScript over JavaScript for new projects",
|
|
104
|
+
"type": "preference",
|
|
105
|
+
"importance": 7,
|
|
106
|
+
"timestamp": "2026-02-22T10:30:00Z",
|
|
107
|
+
"relevanceScore": 0.95
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"totalCandidates": 47,
|
|
111
|
+
"searchLatencyMs": 42
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### totalreclaw_forget
|
|
118
|
+
|
|
119
|
+
Delete a specific fact from memory.
|
|
120
|
+
|
|
121
|
+
**Parameters:**
|
|
122
|
+
|
|
123
|
+
| Name | Type | Required | Description |
|
|
124
|
+
|------|------|----------|-------------|
|
|
125
|
+
| factId | string | Yes | UUID of the fact to delete |
|
|
126
|
+
|
|
127
|
+
**Example:**
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"factId": "01234567-89ab-cdef-0123-456789abcdef"
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Returns:**
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"status": "deleted",
|
|
138
|
+
"factId": "01234567-89ab-cdef-0123-456789abcdef",
|
|
139
|
+
"tombstoneExpiry": "2026-03-24T00:00:00Z"
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### totalreclaw_export
|
|
146
|
+
|
|
147
|
+
Export all stored memories in plaintext format.
|
|
148
|
+
|
|
149
|
+
**Parameters:**
|
|
150
|
+
|
|
151
|
+
| Name | Type | Required | Description |
|
|
152
|
+
|------|------|----------|-------------|
|
|
153
|
+
| format | string | No | Export format: `json` or `markdown`. Default: `json` |
|
|
154
|
+
|
|
155
|
+
**Example:**
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"format": "json"
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Returns (JSON format):**
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"exportVersion": "0.3",
|
|
166
|
+
"exportedAt": "2026-02-22T10:30:00Z",
|
|
167
|
+
"totalFacts": 127,
|
|
168
|
+
"facts": [
|
|
169
|
+
{
|
|
170
|
+
"id": "...",
|
|
171
|
+
"factText": "...",
|
|
172
|
+
"type": "preference",
|
|
173
|
+
"importance": 7,
|
|
174
|
+
"timestamp": "...",
|
|
175
|
+
"entities": [...],
|
|
176
|
+
"relations": [...]
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"graph": {
|
|
180
|
+
"entities": {...},
|
|
181
|
+
"relations": [...]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Returns (Markdown format):**
|
|
187
|
+
```markdown
|
|
188
|
+
# TotalReclaw Export
|
|
189
|
+
Exported: 2026-02-22T10:30:00Z
|
|
190
|
+
Total Facts: 127
|
|
191
|
+
|
|
192
|
+
## Preferences
|
|
193
|
+
- User prefers TypeScript over JavaScript for new projects (importance: 7)
|
|
194
|
+
|
|
195
|
+
## Decisions
|
|
196
|
+
- User decided to use PostgreSQL for the main database (importance: 8)
|
|
197
|
+
|
|
198
|
+
...
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### totalreclaw_status
|
|
204
|
+
|
|
205
|
+
Check subscription status and usage quota.
|
|
206
|
+
|
|
207
|
+
**Parameters:** None
|
|
208
|
+
|
|
209
|
+
**Example:**
|
|
210
|
+
```json
|
|
211
|
+
{}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Returns:**
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"tier": "Free",
|
|
218
|
+
"writesUsed": 42,
|
|
219
|
+
"writesLimit": 250,
|
|
220
|
+
"resetsAt": "2026-04-01",
|
|
221
|
+
"pricingUrl": "https://totalreclaw.xyz/pricing"
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### totalreclaw_consolidate
|
|
228
|
+
|
|
229
|
+
Scan all stored memories and merge near-duplicates. Keeps the most important/recent version and removes redundant copies.
|
|
230
|
+
|
|
231
|
+
**Parameters:**
|
|
232
|
+
|
|
233
|
+
| Name | Type | Required | Description |
|
|
234
|
+
|------|------|----------|-------------|
|
|
235
|
+
| dry_run | boolean | No | Preview consolidation without deleting. Default: `false` |
|
|
236
|
+
|
|
237
|
+
**Example:**
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"dry_run": true
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Returns:**
|
|
245
|
+
```
|
|
246
|
+
Scanned 247 memories.
|
|
247
|
+
Found 12 cluster(s) with 18 duplicate(s).
|
|
248
|
+
|
|
249
|
+
Cluster 1: KEEP "User prefers TypeScript over JavaScript for new projects..."
|
|
250
|
+
- REMOVE "User likes TypeScript more than JavaScript..." (ID: abc123)
|
|
251
|
+
Cluster 2: KEEP "Project uses PostgreSQL as the main database..."
|
|
252
|
+
- REMOVE "The main database is PostgreSQL..." (ID: def456)
|
|
253
|
+
...
|
|
254
|
+
|
|
255
|
+
DRY RUN -- no memories were deleted. Run without dry_run to apply.
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Note:** Currently only available in centralized mode (not subgraph mode).
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### totalreclaw_upgrade
|
|
263
|
+
|
|
264
|
+
Upgrade to TotalReclaw Pro for unlimited encrypted memories on Gnosis mainnet.
|
|
265
|
+
|
|
266
|
+
**Parameters:**
|
|
267
|
+
|
|
268
|
+
| Name | Type | Required | Description |
|
|
269
|
+
|------|------|----------|-------------|
|
|
270
|
+
| *(none)* | | | The tool automatically uses the current wallet address |
|
|
271
|
+
|
|
272
|
+
**Example:**
|
|
273
|
+
```json
|
|
274
|
+
{}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Returns:**
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"checkout_url": "https://checkout.stripe.com/c/pay/...",
|
|
281
|
+
"message": "Open this URL to upgrade to Pro: https://checkout.stripe.com/c/pay/..."
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
### totalreclaw_migrate
|
|
288
|
+
|
|
289
|
+
Migrate memories from testnet (Base Sepolia) to mainnet (Gnosis) after upgrading to Pro.
|
|
290
|
+
|
|
291
|
+
**When to use:** After a user successfully upgrades to Pro. Their memories are on the free-tier testnet and need to be copied to permanent mainnet storage.
|
|
292
|
+
|
|
293
|
+
**Parameters:**
|
|
294
|
+
|
|
295
|
+
| Name | Type | Required | Description |
|
|
296
|
+
|------|------|----------|-------------|
|
|
297
|
+
| confirm | boolean | No | Set to `true` to execute the migration. Without it, returns a dry-run preview. Default: `false` |
|
|
298
|
+
|
|
299
|
+
**Example (dry-run):**
|
|
300
|
+
```json
|
|
301
|
+
{}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Example (execute):**
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"confirm": true
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Returns (dry-run):**
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"mode": "dry_run",
|
|
315
|
+
"testnet_facts": 47,
|
|
316
|
+
"already_on_mainnet": 0,
|
|
317
|
+
"to_migrate": 47,
|
|
318
|
+
"message": "Found 47 facts to migrate from testnet to Gnosis mainnet. Call with confirm=true to proceed."
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Returns (executed):**
|
|
323
|
+
```json
|
|
324
|
+
{
|
|
325
|
+
"mode": "executed",
|
|
326
|
+
"testnet_facts": 47,
|
|
327
|
+
"migrated": 47,
|
|
328
|
+
"failed_batches": 0,
|
|
329
|
+
"message": "Successfully migrated 47 memories from testnet to Gnosis mainnet."
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Safety:**
|
|
334
|
+
- Dry-run by default: call without `confirm=true` to preview what will be migrated
|
|
335
|
+
- Idempotent: re-running skips facts that already exist on mainnet (by content fingerprint)
|
|
336
|
+
- Testnet facts are never deleted (they remain as a backup)
|
|
337
|
+
- Handles partial failures: if a batch fails, re-run to retry (only unmigrated facts are sent)
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### totalreclaw_setup
|
|
342
|
+
|
|
343
|
+
Initialize TotalReclaw with a recovery phrase. No gateway restart needed.
|
|
344
|
+
|
|
345
|
+
**Parameters:**
|
|
346
|
+
|
|
347
|
+
| Name | Type | Required | Description |
|
|
348
|
+
|------|------|----------|-------------|
|
|
349
|
+
| recovery_phrase | string | Yes | A 12-word BIP-39 mnemonic. Generate with `npx @totalreclaw/mcp-server setup` or provide an existing one. |
|
|
350
|
+
|
|
351
|
+
**Example:**
|
|
352
|
+
```json
|
|
353
|
+
{
|
|
354
|
+
"recovery_phrase": "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12"
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Returns:**
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"content": [{ "type": "text", "text": "TotalReclaw setup complete! Encryption keys derived, server registration confirmed..." }]
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**Important:** This tool derives encryption keys and registers with the server immediately. The user can start using all TotalReclaw tools right away without restarting the gateway.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
### totalreclaw_import_from
|
|
370
|
+
|
|
371
|
+
Import memories from other AI memory tools into TotalReclaw.
|
|
372
|
+
|
|
373
|
+
**When to use:** User mentions migrating from Mem0, MCP Memory Server, ChatGPT, Claude, or wants to import memories from another tool.
|
|
374
|
+
|
|
375
|
+
**Parameters:**
|
|
376
|
+
|
|
377
|
+
| Name | Type | Required | Description |
|
|
378
|
+
|------|------|----------|-------------|
|
|
379
|
+
| source | string | Yes | Source system: `mem0`, `mcp-memory`, `chatgpt`, `claude`. Post-MVP: `memoclaw`, `generic-json`, `generic-csv` |
|
|
380
|
+
| api_key | string | No | API key for the source (Mem0). Used once, never stored. |
|
|
381
|
+
| source_user_id | string | No | User or agent ID in the source system |
|
|
382
|
+
| content | string | No | File content (JSON, JSONL, or CSV) -- for file-based sources |
|
|
383
|
+
| file_path | string | No | Path to a file on disk -- for file-based sources |
|
|
384
|
+
| namespace | string | No | Target namespace in TotalReclaw. Default: `imported` |
|
|
385
|
+
| dry_run | boolean | No | Preview without importing. Default: `false` |
|
|
386
|
+
|
|
387
|
+
**Best practice:** Always use `dry_run=true` first to preview, then confirm with the user before importing.
|
|
388
|
+
|
|
389
|
+
**Example -- import from Mem0 (API):**
|
|
390
|
+
```json
|
|
391
|
+
{
|
|
392
|
+
"source": "mem0",
|
|
393
|
+
"api_key": "m0-xxx",
|
|
394
|
+
"source_user_id": "user-123",
|
|
395
|
+
"dry_run": true
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Example -- import from MCP Memory Server (file):**
|
|
400
|
+
```json
|
|
401
|
+
{
|
|
402
|
+
"source": "mcp-memory",
|
|
403
|
+
"file_path": "~/.mcp-memory/memory.jsonl",
|
|
404
|
+
"dry_run": true
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**Example -- import from ChatGPT (memories text):**
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"source": "chatgpt",
|
|
412
|
+
"content": "User prefers dark mode\nUser works at Google\nUser lives in SF",
|
|
413
|
+
"dry_run": true
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**Example -- import from ChatGPT (conversations.json):**
|
|
418
|
+
```json
|
|
419
|
+
{
|
|
420
|
+
"source": "chatgpt",
|
|
421
|
+
"file_path": "~/Downloads/chatgpt-export/conversations.json",
|
|
422
|
+
"dry_run": true
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Example -- import from Claude (memories text):**
|
|
427
|
+
```json
|
|
428
|
+
{
|
|
429
|
+
"source": "claude",
|
|
430
|
+
"content": "[2026-03-15] - User prefers TypeScript\nUser works at a startup in Berlin",
|
|
431
|
+
"dry_run": true
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**Returns (dry run):**
|
|
436
|
+
```json
|
|
437
|
+
{
|
|
438
|
+
"success": true,
|
|
439
|
+
"source": "mem0",
|
|
440
|
+
"total_found": 47,
|
|
441
|
+
"imported": 0,
|
|
442
|
+
"skipped_duplicate": 0,
|
|
443
|
+
"warnings": ["DRY RUN — no facts were imported."],
|
|
444
|
+
"import_id": "import-1710000000000-abc1234"
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
**Returns (actual import):**
|
|
449
|
+
```json
|
|
450
|
+
{
|
|
451
|
+
"success": true,
|
|
452
|
+
"source": "mem0",
|
|
453
|
+
"total_found": 47,
|
|
454
|
+
"imported": 45,
|
|
455
|
+
"skipped_duplicate": 2,
|
|
456
|
+
"skipped_invalid": 0,
|
|
457
|
+
"errors": [],
|
|
458
|
+
"import_id": "import-1710000000000-abc1234",
|
|
459
|
+
"duration_ms": 3200
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Imported facts are tagged with `import_source:{source}` for easy filtering. The import is idempotent -- running it twice will not create duplicates (content fingerprint dedup).
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
## Post-Install Setup
|
|
468
|
+
|
|
469
|
+
> **Important:** After `openclaw skills install totalreclaw`, you also need to run
|
|
470
|
+
> `openclaw plugins install ~/.openclaw/workspace/skills/totalreclaw` to register
|
|
471
|
+
> the executable plugin. The skill alone only provides instructions; the plugin
|
|
472
|
+
> provides the actual memory tools.
|
|
473
|
+
|
|
474
|
+
After installing TotalReclaw, the agent MUST complete setup automatically. **Do NOT ask the user to set environment variables manually.**
|
|
475
|
+
|
|
476
|
+
### Step 1: Recovery phrase
|
|
477
|
+
|
|
478
|
+
The recovery phrase is a **12-word BIP-39 mnemonic**. It derives all encryption keys. The server never sees it.
|
|
479
|
+
|
|
480
|
+
Ask the user:
|
|
481
|
+
> "Do you have an existing TotalReclaw recovery phrase you'd like to restore, or should I generate a new one?"
|
|
482
|
+
|
|
483
|
+
- **New user:** Run `npx @totalreclaw/mcp-server setup` to generate a cryptographically valid recovery phrase. Do NOT generate the phrase yourself — LLMs cannot compute BIP-39 checksums correctly. The setup wizard will output the phrase and save credentials automatically.
|
|
484
|
+
Display it prominently with a warning:
|
|
485
|
+
> "SAVE YOUR RECOVERY PHRASE — it's the only way to recover your memories if you switch devices: `[phrase]`"
|
|
486
|
+
- **Returning user:** Ask them to provide their existing 12-word phrase.
|
|
487
|
+
|
|
488
|
+
### Step 2: Call totalreclaw_setup
|
|
489
|
+
|
|
490
|
+
Once you have the recovery phrase, call the `totalreclaw_setup` tool with it:
|
|
491
|
+
```json
|
|
492
|
+
{ "recovery_phrase": "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12" }
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
This derives encryption keys and registers with the server immediately. **No gateway restart needed.** The user can continue chatting and all TotalReclaw tools will work right away.
|
|
496
|
+
|
|
497
|
+
### Step 3: Storage mode (optional)
|
|
498
|
+
|
|
499
|
+
The managed service is the default -- no extra configuration needed. If you want to self-host instead, set `TOTALRECLAW_SELF_HOSTED=true` and `TOTALRECLAW_SERVER_URL` to your server URL.
|
|
500
|
+
|
|
501
|
+
### Step 4: Set memory slot
|
|
502
|
+
|
|
503
|
+
Register TotalReclaw as the memory plugin:
|
|
504
|
+
```json
|
|
505
|
+
{ "plugins": { "slots": { "memory": "totalreclaw" } } }
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Step 5: Explain the free tier
|
|
509
|
+
|
|
510
|
+
After setup completes, inform the user about the free tier:
|
|
511
|
+
> "You're on TotalReclaw's free tier — 500 memories per month, unlimited reads and searches.
|
|
512
|
+
> I'll let you know if you're approaching the limit. For unlimited memories, visit
|
|
513
|
+
> https://totalreclaw.xyz/pricing"
|
|
514
|
+
|
|
515
|
+
The agent proactively warns when quota usage exceeds 80%. If the limit is reached, new writes are rejected but all existing memories remain searchable.
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## Description
|
|
520
|
+
|
|
521
|
+
TotalReclaw is an end-to-end encrypted memory vault for AI agents. Think of it as a "password manager for AI memory" that provides:
|
|
522
|
+
|
|
523
|
+
1. **End-to-End Encryption** - All memories are encrypted client-side using XChaCha20-Poly1305. The server never sees plaintext data.
|
|
524
|
+
|
|
525
|
+
2. **Portable Memory** - Export all data as plaintext with one command. No vendor lock-in.
|
|
526
|
+
|
|
527
|
+
3. **Universal Compatibility** - Works across any MCP-compatible AI agent, not just OpenClaw.
|
|
528
|
+
|
|
529
|
+
4. **Intelligent Extraction** - Automatically extracts facts, preferences, decisions with reasoning, project context, conversation summaries, and goals from conversations.
|
|
530
|
+
|
|
531
|
+
5. **Smart Decay** - Important memories persist; trivial ones fade over time using a decay algorithm.
|
|
532
|
+
|
|
533
|
+
6. **Graph-Based** - Maintains entity relationships for multi-hop reasoning.
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## Memory Types
|
|
538
|
+
|
|
539
|
+
TotalReclaw extracts and stores seven types of memories:
|
|
540
|
+
|
|
541
|
+
| Type | Description | Example |
|
|
542
|
+
|------|-------------|---------|
|
|
543
|
+
| Fact | Objective information about you | "Lives in Lisbon, Portugal" |
|
|
544
|
+
| Preference | Your likes, dislikes, choices | "Prefers dark mode in all applications" |
|
|
545
|
+
| Decision | Choices you made WITH reasoning | "Chose PostgreSQL because data is relational and needs ACID" |
|
|
546
|
+
| Episodic | Notable events or experiences | "Deployed v1.0 to production on March 15" |
|
|
547
|
+
| Goal | Your objectives or plans | "Wants to launch public beta by end of Q1" |
|
|
548
|
+
| Context | Active project/task context | "Working on TotalReclaw v1.2, staging on Base Sepolia" |
|
|
549
|
+
| Summary | Key outcomes from discussions | "Agreed to use phased rollout for mainnet migration" |
|
|
550
|
+
|
|
551
|
+
Decisions and context are treated as high-value memories (importance >= 7) because they provide the most useful information for future conversations.
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
## Instructions for the LLM
|
|
556
|
+
|
|
557
|
+
### IMPORTANT: Do Not Write Cleartext Memory Files
|
|
558
|
+
|
|
559
|
+
TotalReclaw handles all memory storage with end-to-end encryption. **Do NOT write facts, preferences, or decisions to MEMORY.md or memory/*.md files.** All memories are stored encrypted on-chain and recalled automatically — writing cleartext files defeats the E2EE guarantee.
|
|
560
|
+
|
|
561
|
+
If you need to store a memory, use the `totalreclaw_remember` tool. If you need to recall memories, use `totalreclaw_recall`.
|
|
562
|
+
|
|
563
|
+
### Billing Awareness
|
|
564
|
+
|
|
565
|
+
TotalReclaw has a free tier (500 memories/month, unlimited reads). The plugin monitors quota usage automatically:
|
|
566
|
+
- If usage exceeds 80%, a warning is injected into your context at conversation start
|
|
567
|
+
- If a write fails with quota exceeded (403), inform the user and suggest visiting https://totalreclaw.xyz/pricing
|
|
568
|
+
- Use `totalreclaw_status` when the user asks about their subscription, quota, or billing
|
|
569
|
+
- After upgrading, the new tier features may take up to 2 hours to fully activate on your client due to billing cache. If you experience issues, restart your agent.
|
|
570
|
+
|
|
571
|
+
### When to Use Each Tool
|
|
572
|
+
|
|
573
|
+
#### totalreclaw_setup
|
|
574
|
+
|
|
575
|
+
Use when:
|
|
576
|
+
- TotalReclaw prompts for first-time setup (recovery phrase needed)
|
|
577
|
+
- The user provides a recovery phrase for initialization
|
|
578
|
+
- You have generated a recovery phrase via `npx @totalreclaw/mcp-server setup`
|
|
579
|
+
|
|
580
|
+
This tool initializes encryption keys immediately without requiring a gateway restart.
|
|
581
|
+
|
|
582
|
+
#### totalreclaw_remember
|
|
583
|
+
|
|
584
|
+
Use when:
|
|
585
|
+
- The user explicitly asks you to remember something ("remember that...", "note that...", "don't forget...")
|
|
586
|
+
- You detect a significant preference, decision, or fact that will be useful in future conversations
|
|
587
|
+
- The user corrects or updates previous information about themselves
|
|
588
|
+
- You observe important context about the user's work, projects, or preferences
|
|
589
|
+
|
|
590
|
+
Do NOT use for:
|
|
591
|
+
- Temporary information relevant only to the current conversation
|
|
592
|
+
- Information the user explicitly says is temporary
|
|
593
|
+
- Generic knowledge that isn't user-specific
|
|
594
|
+
|
|
595
|
+
#### totalreclaw_recall
|
|
596
|
+
|
|
597
|
+
Use when:
|
|
598
|
+
- The user asks about their past preferences, decisions, or history
|
|
599
|
+
- You need context about the user's projects, tools, or working style
|
|
600
|
+
- The user asks "do you remember..." or "what did I tell you about..."
|
|
601
|
+
- You're unsure about a user preference and want to check before making assumptions
|
|
602
|
+
- Starting a new conversation to load relevant context
|
|
603
|
+
|
|
604
|
+
Do NOT use for:
|
|
605
|
+
- Every single message (use sparingly, max once per conversation start or when explicitly relevant)
|
|
606
|
+
- General knowledge questions unrelated to the user
|
|
607
|
+
|
|
608
|
+
#### totalreclaw_forget
|
|
609
|
+
|
|
610
|
+
Use when:
|
|
611
|
+
- The user explicitly asks you to forget something ("forget that...", "delete that memory...")
|
|
612
|
+
- The user indicates information is outdated or incorrect and should be removed
|
|
613
|
+
- The user requests a clean slate for a specific topic
|
|
614
|
+
|
|
615
|
+
#### totalreclaw_upgrade
|
|
616
|
+
|
|
617
|
+
Use when:
|
|
618
|
+
- The user hits their free tier memory limit (403 quota exceeded)
|
|
619
|
+
- The user asks about upgrading, pricing, or getting Pro
|
|
620
|
+
- After a `totalreclaw_status` call shows the user is on the free tier and they want more
|
|
621
|
+
|
|
622
|
+
#### totalreclaw_migrate
|
|
623
|
+
|
|
624
|
+
Use when:
|
|
625
|
+
- The user has just upgraded to Pro and their memories are still on testnet
|
|
626
|
+
- The user asks about migrating testnet memories to mainnet
|
|
627
|
+
- After a successful `totalreclaw_upgrade`, proactively offer migration
|
|
628
|
+
|
|
629
|
+
Always do a dry-run first (call without `confirm=true`), show the preview, then ask the user to confirm before executing.
|
|
630
|
+
|
|
631
|
+
#### totalreclaw_export
|
|
632
|
+
|
|
633
|
+
Use when:
|
|
634
|
+
- The user asks to export, backup, or download their memory data
|
|
635
|
+
- The user wants to see everything you know about them
|
|
636
|
+
- The user is migrating to another system
|
|
637
|
+
|
|
638
|
+
#### totalreclaw_import_from
|
|
639
|
+
|
|
640
|
+
Use when:
|
|
641
|
+
- The user mentions migrating from Mem0, MCP Memory Server, ChatGPT, Claude, or another AI memory tool
|
|
642
|
+
- The user wants to import memories from a file or API
|
|
643
|
+
- The user asks to consolidate memories from multiple tools
|
|
644
|
+
- The user mentions ChatGPT memories, conversations export, or Claude memory
|
|
645
|
+
|
|
646
|
+
Always run with `dry_run=true` first and show the preview before importing. API keys are used in-memory only and never stored.
|
|
647
|
+
|
|
648
|
+
#### totalreclaw_consolidate
|
|
649
|
+
|
|
650
|
+
Use when:
|
|
651
|
+
- The user asks to clean up or deduplicate their memories
|
|
652
|
+
- The user mentions having too many similar memories
|
|
653
|
+
- After a large import to merge near-duplicates
|
|
654
|
+
|
|
655
|
+
Always run with `dry_run=true` first to preview which memories will be merged, then confirm with the user before running without dry_run.
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
### Best Practices
|
|
660
|
+
|
|
661
|
+
1. **Atomic Facts Only**: Each memory should be a single, atomic piece of information.
|
|
662
|
+
- Good: "User prefers dark mode in all editors"
|
|
663
|
+
- Bad: "User likes dark mode, uses VS Code, and works at Google"
|
|
664
|
+
|
|
665
|
+
2. **Importance Scoring**:
|
|
666
|
+
- 1-3: Trivial, unlikely to matter (small talk, pleasantries)
|
|
667
|
+
- 4-6: Useful context (tool preferences, working style)
|
|
668
|
+
- 7-8: Important (key decisions with reasoning, project context, major preferences)
|
|
669
|
+
- 9-10: Critical (core values, non-negotiables, safety info)
|
|
670
|
+
|
|
671
|
+
3. **Search Before Storing**: Always recall similar memories before storing new ones to avoid duplicates.
|
|
672
|
+
|
|
673
|
+
4. **Respect User Privacy**: Never store sensitive information (passwords, API keys, personal secrets) even if requested.
|
|
674
|
+
|
|
675
|
+
5. **Prefer NOOP**: When in doubt about whether to store something, prefer not storing it. Memory pollution is worse than missing a minor fact.
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
679
|
+
## Extraction Prompts (Mem0-Style)
|
|
680
|
+
|
|
681
|
+
TotalReclaw uses a Mem0-style extraction pattern with four possible actions:
|
|
682
|
+
|
|
683
|
+
### Actions
|
|
684
|
+
|
|
685
|
+
| Action | Description | When to Use |
|
|
686
|
+
|--------|-------------|-------------|
|
|
687
|
+
| ADD | Store as new memory | No similar memory exists |
|
|
688
|
+
| UPDATE | Modify existing memory | New info refines/clarifies existing |
|
|
689
|
+
| DELETE | Remove existing memory | New info contradicts existing |
|
|
690
|
+
| NOOP | Do nothing | Already captured or not worth storing |
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
### Pre-Compaction Extraction
|
|
695
|
+
|
|
696
|
+
Triggered before OpenClaw's context compaction (typically every few hours in long sessions).
|
|
697
|
+
|
|
698
|
+
**System Prompt:**
|
|
699
|
+
|
|
700
|
+
```
|
|
701
|
+
You are a memory extraction engine for an AI assistant. Your job is to analyze conversations and extract structured, atomic facts that should be remembered long-term.
|
|
702
|
+
|
|
703
|
+
## Extraction Guidelines
|
|
704
|
+
|
|
705
|
+
1. **Atomicity**: Each fact should be a single, self-contained piece of information
|
|
706
|
+
- GOOD: "User chose PostgreSQL because the data model is relational and needs ACID"
|
|
707
|
+
- BAD: "User likes TypeScript, uses VS Code, and works at Google"
|
|
708
|
+
|
|
709
|
+
2. **Types**:
|
|
710
|
+
- **fact**: Objective information about the user/world
|
|
711
|
+
- **preference**: User's likes, dislikes, or preferences
|
|
712
|
+
- **decision**: Choices WITH reasoning ("chose X because Y")
|
|
713
|
+
- **episodic**: Event-based memories (what happened when)
|
|
714
|
+
- **goal**: User's objectives or targets
|
|
715
|
+
- **context**: Active project/task context (what the user is working on, versions, environments)
|
|
716
|
+
- **summary**: Key outcome or conclusion from a discussion
|
|
717
|
+
|
|
718
|
+
3. **Importance Scoring (1-10)**:
|
|
719
|
+
- 1-3: Trivial, unlikely to matter (small talk, pleasantries)
|
|
720
|
+
- 4-6: Useful context (tool preferences, working style)
|
|
721
|
+
- 7-8: Important (key decisions with reasoning, project context, major preferences)
|
|
722
|
+
- 9-10: Critical (core values, non-negotiables, safety info)
|
|
723
|
+
|
|
724
|
+
4. **Confidence (0-1)**:
|
|
725
|
+
- How certain are you that this is accurate and worth storing?
|
|
726
|
+
|
|
727
|
+
5. **Extraction quality cues**:
|
|
728
|
+
- Decisions: ALWAYS include reasoning. "Chose X" alone is low value.
|
|
729
|
+
- Context: Include version numbers, environments, status ("v1.2", "staging", "private beta")
|
|
730
|
+
- Summaries: Only when a conversation reaches a clear conclusion or agreement
|
|
731
|
+
- Facts: Prefer specific over vague
|
|
732
|
+
|
|
733
|
+
6. **Entities**: Extract named entities (people, projects, tools, concepts)
|
|
734
|
+
- Use stable IDs: hash of name+type (e.g., "typescript-tool")
|
|
735
|
+
- Types: person, project, tool, preference, concept, location, etc.
|
|
736
|
+
|
|
737
|
+
7. **Relations**: Extract relationships between entities
|
|
738
|
+
- Common predicates: prefers, uses, works_on, decided_to_use, dislikes, etc.
|
|
739
|
+
|
|
740
|
+
8. **Actions (Mem0 pattern)**:
|
|
741
|
+
- **ADD**: New fact, no conflict with existing memories
|
|
742
|
+
- **UPDATE**: Modifies or refines an existing fact (provide existingFactId)
|
|
743
|
+
- **DELETE**: Contradicts and replaces an existing fact
|
|
744
|
+
- **NOOP**: Not worth storing or already captured
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
**User Prompt Template:**
|
|
748
|
+
|
|
749
|
+
```
|
|
750
|
+
## Task: Pre-Compaction Memory Extraction
|
|
751
|
+
|
|
752
|
+
You are reviewing the last 20 turns of conversation before they are compacted. Extract ALL valuable long-term memories.
|
|
753
|
+
|
|
754
|
+
## Conversation History (last 20 turns):
|
|
755
|
+
{{CONVERSATION_HISTORY}}
|
|
756
|
+
|
|
757
|
+
## Existing Memories (for deduplication):
|
|
758
|
+
{{EXISTING_MEMORIES}}
|
|
759
|
+
|
|
760
|
+
## Instructions:
|
|
761
|
+
1. Review each turn carefully for extractable information
|
|
762
|
+
2. Extract facts, preferences, decisions (with reasoning), episodic memories, goals, project context, and conversation summaries
|
|
763
|
+
3. For each fact, determine if it's NEW (ADD), modifies existing (UPDATE), contradicts existing (DELETE), or is redundant (NOOP)
|
|
764
|
+
4. Score importance based on long-term relevance
|
|
765
|
+
5. Extract entities and relations
|
|
766
|
+
|
|
767
|
+
## Output Format:
|
|
768
|
+
Return a JSON object with:
|
|
769
|
+
{
|
|
770
|
+
"facts": [
|
|
771
|
+
{
|
|
772
|
+
"factText": "string (max 512 chars)",
|
|
773
|
+
"type": "fact|preference|decision|episodic|goal|context|summary",
|
|
774
|
+
"importance": 1-10,
|
|
775
|
+
"confidence": 0-1,
|
|
776
|
+
"action": "ADD|UPDATE|DELETE|NOOP",
|
|
777
|
+
"existingFactId": "string (if UPDATE/DELETE)",
|
|
778
|
+
"entities": [{"id": "...", "name": "...", "type": "..."}],
|
|
779
|
+
"relations": [{"subjectId": "...", "predicate": "...", "objectId": "...", "confidence": 0-1}]
|
|
780
|
+
}
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
Focus on quality over quantity. Better to have 5 highly accurate facts than 20 noisy ones.
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
789
|
+
### Post-Turn Extraction
|
|
790
|
+
|
|
791
|
+
Triggered every N turns (configurable, default: 5) for lightweight extraction.
|
|
792
|
+
|
|
793
|
+
**User Prompt Template:**
|
|
794
|
+
|
|
795
|
+
```
|
|
796
|
+
## Task: Quick Turn Extraction
|
|
797
|
+
|
|
798
|
+
You are doing a lightweight extraction after a few turns. Focus ONLY on high-importance items.
|
|
799
|
+
|
|
800
|
+
## Recent Turns (last 3):
|
|
801
|
+
{{CONVERSATION_HISTORY}}
|
|
802
|
+
|
|
803
|
+
## Existing Memories (top matches):
|
|
804
|
+
{{EXISTING_MEMORIES}}
|
|
805
|
+
|
|
806
|
+
## Instructions:
|
|
807
|
+
1. Extract ONLY items with importance >= 7 (critical preferences, key decisions)
|
|
808
|
+
2. Skip trivial information - this is a quick pass
|
|
809
|
+
3. Use ADD/UPDATE/DELETE/NOOP appropriately
|
|
810
|
+
4. Be aggressive about NOOP for low-value content
|
|
811
|
+
|
|
812
|
+
## Output Format:
|
|
813
|
+
Return a JSON object matching the extraction schema.
|
|
814
|
+
|
|
815
|
+
Remember: Less is more. Only extract what truly matters.
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
---
|
|
819
|
+
|
|
820
|
+
### Explicit Command Detection
|
|
821
|
+
|
|
822
|
+
Detect when the user explicitly requests memory storage.
|
|
823
|
+
|
|
824
|
+
**Trigger Patterns (regex + LLM classification):**
|
|
825
|
+
|
|
826
|
+
```
|
|
827
|
+
# Explicit memory commands
|
|
828
|
+
"remember that..."
|
|
829
|
+
"don't forget..."
|
|
830
|
+
"note that..."
|
|
831
|
+
"I prefer..."
|
|
832
|
+
"for future reference..."
|
|
833
|
+
"make a note..."
|
|
834
|
+
"store this..."
|
|
835
|
+
"keep in mind..."
|
|
836
|
+
|
|
837
|
+
# Explicit forget commands
|
|
838
|
+
"forget about..."
|
|
839
|
+
"delete that memory..."
|
|
840
|
+
"remove that from memory..."
|
|
841
|
+
"stop remembering..."
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
**User Prompt Template:**
|
|
845
|
+
|
|
846
|
+
```
|
|
847
|
+
## Task: Explicit Memory Storage
|
|
848
|
+
|
|
849
|
+
The user has explicitly requested to remember something. This is a HIGH PRIORITY extraction.
|
|
850
|
+
|
|
851
|
+
## User's Explicit Request:
|
|
852
|
+
{{USER_REQUEST}}
|
|
853
|
+
|
|
854
|
+
## Conversation Context:
|
|
855
|
+
{{CONVERSATION_CONTEXT}}
|
|
856
|
+
|
|
857
|
+
## Instructions:
|
|
858
|
+
1. Parse what the user wants remembered
|
|
859
|
+
2. Boost importance by +1 (explicit requests matter more)
|
|
860
|
+
3. Extract as atomic fact(s) with appropriate type
|
|
861
|
+
4. Check against existing memories for UPDATE/DELETE
|
|
862
|
+
5. Set confidence HIGH (user explicitly wants this stored)
|
|
863
|
+
|
|
864
|
+
## Output Format:
|
|
865
|
+
Return a JSON object matching the extraction schema.
|
|
866
|
+
|
|
867
|
+
This is user-initiated storage - ensure accuracy and capture their intent precisely.
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
---
|
|
871
|
+
|
|
872
|
+
### Deduplication Judge
|
|
873
|
+
|
|
874
|
+
Used to determine ADD vs UPDATE vs DELETE vs NOOP for each extracted fact.
|
|
875
|
+
|
|
876
|
+
**System Prompt:**
|
|
877
|
+
|
|
878
|
+
```
|
|
879
|
+
You are a memory deduplication judge. Your job is to determine if a new fact should be added as new, update an existing fact, delete/replace an existing fact, or be ignored as redundant.
|
|
880
|
+
|
|
881
|
+
## Decision Rules:
|
|
882
|
+
|
|
883
|
+
1. **ADD**: The fact is genuinely new information not covered by existing memories
|
|
884
|
+
2. **UPDATE**: The fact refines, clarifies, or partially modifies an existing fact
|
|
885
|
+
3. **DELETE**: The fact directly contradicts an existing fact and should replace it
|
|
886
|
+
4. **NOOP**: The fact is already fully captured by existing memories
|
|
887
|
+
|
|
888
|
+
Be strict about NOOP - if the information is essentially the same, mark it as NOOP.
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
**User Prompt Template:**
|
|
892
|
+
|
|
893
|
+
```
|
|
894
|
+
## New Fact to Evaluate:
|
|
895
|
+
{{NEW_FACT}}
|
|
896
|
+
|
|
897
|
+
## Similar Existing Facts:
|
|
898
|
+
{{EXISTING_FACTS}}
|
|
899
|
+
|
|
900
|
+
## Instructions:
|
|
901
|
+
1. Compare the new fact against each existing fact
|
|
902
|
+
2. Determine the appropriate action (ADD/UPDATE/DELETE/NOOP)
|
|
903
|
+
3. If UPDATE or DELETE, identify which existing fact to modify
|
|
904
|
+
4. Provide your confidence (0-1) and reasoning
|
|
905
|
+
|
|
906
|
+
## Output Format:
|
|
907
|
+
{
|
|
908
|
+
"decision": "ADD|UPDATE|DELETE|NOOP",
|
|
909
|
+
"existingFactId": "string (if UPDATE/DELETE)",
|
|
910
|
+
"confidence": 0-1,
|
|
911
|
+
"reasoning": "string"
|
|
912
|
+
}
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
---
|
|
916
|
+
|
|
917
|
+
## Configuration
|
|
918
|
+
|
|
919
|
+
Default configuration values:
|
|
920
|
+
|
|
921
|
+
| Key | Default | Description |
|
|
922
|
+
|-----|---------|-------------|
|
|
923
|
+
| `serverUrl` | `https://api.totalreclaw.xyz` | TotalReclaw server URL (do not change unless self-hosting) |
|
|
924
|
+
| `autoExtractEveryTurns` | `3` | Turns between automatic extractions |
|
|
925
|
+
| `minImportanceForAutoStore` | `6` | Minimum importance to auto-store |
|
|
926
|
+
| `maxMemoriesInContext` | `8` | Maximum memories to inject into context |
|
|
927
|
+
| `forgetThreshold` | `0.3` | Decay score threshold for eviction |
|
|
928
|
+
| `decayHalfLifeDays` | `30` | Memory decay half-life in days |
|
|
929
|
+
|
|
930
|
+
### Memory Consolidation Configuration
|
|
931
|
+
|
|
932
|
+
Store-time near-duplicate detection is always on — the `TOTALRECLAW_STORE_DEDUP`
|
|
933
|
+
user-facing toggle was removed in v1. Advanced thresholds can still be tuned
|
|
934
|
+
via env var for self-hosted deployments:
|
|
935
|
+
|
|
936
|
+
| Env Var | Default | Description |
|
|
937
|
+
|---------|---------|-------------|
|
|
938
|
+
| `TOTALRECLAW_STORE_DEDUP_THRESHOLD` | `0.85` | Cosine similarity threshold for store-time dedup (0-1) |
|
|
939
|
+
| `TOTALRECLAW_CONSOLIDATION_THRESHOLD` | `0.88` | Cosine similarity threshold for bulk consolidation (0-1) |
|
|
940
|
+
|
|
941
|
+
Managed-service tenants receive the tuning values from the relay billing
|
|
942
|
+
response — these env vars act as fallbacks only. See
|
|
943
|
+
[`docs/guides/env-vars-reference.md`](../../docs/guides/env-vars-reference.md).
|
|
944
|
+
|
|
945
|
+
---
|
|
946
|
+
|
|
947
|
+
## Privacy & Security
|
|
948
|
+
|
|
949
|
+
- **End-to-End Encrypted**: All encryption happens client-side. The server never sees your data.
|
|
950
|
+
- **Recovery Phrase**: Never sent to the server. Used only for key derivation (Argon2id).
|
|
951
|
+
- **Export Portability**: Full plaintext export available anytime.
|
|
952
|
+
- **Tombstone Recovery**: Deleted memories can be recovered within 30 days.
|
|
953
|
+
|
|
954
|
+
---
|
|
955
|
+
|
|
956
|
+
## Lifecycle Hooks
|
|
957
|
+
|
|
958
|
+
TotalReclaw integrates with OpenClaw through three lifecycle hooks:
|
|
959
|
+
|
|
960
|
+
| Hook | Priority | Description |
|
|
961
|
+
|------|----------|-------------|
|
|
962
|
+
| `before_agent_start` | 10 | Retrieve relevant memories before agent processes message |
|
|
963
|
+
| `agent_end` | 90 | Extract and store facts after agent completes turn |
|
|
964
|
+
| `pre_compaction` | 5 | Full memory flush before context compaction |
|
|
965
|
+
|
|
966
|
+
---
|
|
967
|
+
|
|
968
|
+
## Example Usage
|
|
969
|
+
|
|
970
|
+
### Storing a preference
|
|
971
|
+
|
|
972
|
+
```json
|
|
973
|
+
// Tool call
|
|
974
|
+
{
|
|
975
|
+
"tool": "totalreclaw_remember",
|
|
976
|
+
"params": {
|
|
977
|
+
"text": "User prefers functional programming over OOP",
|
|
978
|
+
"type": "preference",
|
|
979
|
+
"importance": 6
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// Response
|
|
984
|
+
{
|
|
985
|
+
"factId": "abc123",
|
|
986
|
+
"status": "stored"
|
|
987
|
+
}
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
### Recalling memories
|
|
991
|
+
|
|
992
|
+
```json
|
|
993
|
+
// Tool call
|
|
994
|
+
{
|
|
995
|
+
"tool": "totalreclaw_recall",
|
|
996
|
+
"params": {
|
|
997
|
+
"query": "programming preferences",
|
|
998
|
+
"k": 5
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// Response
|
|
1003
|
+
{
|
|
1004
|
+
"memories": [
|
|
1005
|
+
{
|
|
1006
|
+
"factId": "abc123",
|
|
1007
|
+
"factText": "User prefers functional programming over OOP",
|
|
1008
|
+
"type": "preference",
|
|
1009
|
+
"importance": 6,
|
|
1010
|
+
"relevanceScore": 0.92
|
|
1011
|
+
}
|
|
1012
|
+
]
|
|
1013
|
+
}
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
### Forgetting a memory
|
|
1017
|
+
|
|
1018
|
+
```json
|
|
1019
|
+
// Tool call
|
|
1020
|
+
{
|
|
1021
|
+
"tool": "totalreclaw_forget",
|
|
1022
|
+
"params": {
|
|
1023
|
+
"factId": "abc123"
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// Response
|
|
1028
|
+
{
|
|
1029
|
+
"status": "deleted",
|
|
1030
|
+
"factId": "abc123"
|
|
1031
|
+
}
|
|
1032
|
+
```
|