@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/CLAWHUB.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# ClawHub Publishing
|
|
2
|
+
|
|
3
|
+
Internal notes for publishing the TotalReclaw skill on [clawhub.ai](https://clawhub.ai).
|
|
4
|
+
|
|
5
|
+
## Published
|
|
6
|
+
|
|
7
|
+
- **Published:** 2026-03-26
|
|
8
|
+
- **Version:** 1.4.0
|
|
9
|
+
- **Package ID:** k978pv4b9nyrx4bt968vqyzpa983mbx3
|
|
10
|
+
- **URL:** https://clawhub.ai/skills/totalreclaw
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## How ClawHub Works
|
|
15
|
+
|
|
16
|
+
ClawHub is the official skill registry for OpenClaw agents. Key facts:
|
|
17
|
+
|
|
18
|
+
- **SKILL.md IS the listing page** — the full markdown body is rendered as the listing content
|
|
19
|
+
- **Publishing is instant via CLI** — no manual review queue
|
|
20
|
+
- **Automated security scan runs post-publish** — flags suspicious patterns, undeclared env vars, dynamic code execution
|
|
21
|
+
- **No screenshots/video hosted on ClawHub** — embed as markdown image links in SKILL.md if desired
|
|
22
|
+
- **Discovery via vector search** — embedding similarity + slug/name boosts + popularity prior
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Readiness Status
|
|
27
|
+
|
|
28
|
+
### Published (v1.4.0, 2026-03-26)
|
|
29
|
+
|
|
30
|
+
- [x] `skill.json` — Metadata, hooks, tools, config, and ClawHub fields populated
|
|
31
|
+
- [x] `SKILL.md` — YAML frontmatter with full metadata; tools, hooks, prompts, and LLM instructions documented
|
|
32
|
+
- [x] `README.md` — Public-facing documentation with quick start, benchmarks, configuration, and architecture
|
|
33
|
+
- [x] Hooks defined: `before_agent_start`, `agent_end`, `pre_compaction`
|
|
34
|
+
- [x] Tools defined: `totalreclaw_remember`, `totalreclaw_recall`, `totalreclaw_forget`, `totalreclaw_export`, `totalreclaw_status`, `totalreclaw_generate_recovery_phrase`
|
|
35
|
+
- [x] Environment variables documented (`TOTALRECLAW_SERVER_URL`, `TOTALRECLAW_RECOVERY_PHRASE`)
|
|
36
|
+
- [x] Benchmark comparison table (98.1% recall@8 with 100% privacy)
|
|
37
|
+
- [x] License declared (MIT)
|
|
38
|
+
- [x] Keywords and OS compatibility specified
|
|
39
|
+
- [x] E2E onboarding tests passing (4/4)
|
|
40
|
+
- [x] E2E subgraph tests passing (9/9)
|
|
41
|
+
|
|
42
|
+
### Not Yet Done
|
|
43
|
+
|
|
44
|
+
- [ ] **Screenshots** (optional — linked from external hosting as markdown images in SKILL.md)
|
|
45
|
+
- Suggested:
|
|
46
|
+
1. Agent remembering a user preference (tool call + response)
|
|
47
|
+
2. Agent recalling memories at conversation start (context injection)
|
|
48
|
+
3. Memory export in JSON format
|
|
49
|
+
4. Encryption in action (showing encrypted vs plaintext data)
|
|
50
|
+
- [ ] **Demo video** (optional, 30-90 seconds)
|
|
51
|
+
- Show a full cycle: store a memory, start a new conversation, recall it automatically
|
|
52
|
+
- Highlight that the server never sees plaintext
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## SKILL.md Frontmatter
|
|
57
|
+
|
|
58
|
+
Ensure the SKILL.md starts with this frontmatter for ClawHub:
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
---
|
|
62
|
+
name: totalreclaw
|
|
63
|
+
description: "End-to-end encrypted memory for AI agents — portable, yours forever. XChaCha20-Poly1305 E2EE: server never sees plaintext."
|
|
64
|
+
version: 1.5.1
|
|
65
|
+
author: TotalReclaw Team
|
|
66
|
+
license: MIT
|
|
67
|
+
homepage: https://totalreclaw.xyz
|
|
68
|
+
metadata:
|
|
69
|
+
openclaw:
|
|
70
|
+
requires:
|
|
71
|
+
env: []
|
|
72
|
+
bins: []
|
|
73
|
+
emoji: "\U0001F9E0"
|
|
74
|
+
os: ["macos", "linux", "windows"]
|
|
75
|
+
keywords:
|
|
76
|
+
- memory
|
|
77
|
+
- e2ee
|
|
78
|
+
- e2e-encryption
|
|
79
|
+
- encryption
|
|
80
|
+
- privacy
|
|
81
|
+
- agent-memory
|
|
82
|
+
- persistent-context
|
|
83
|
+
---
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Note:** `env: []` is intentional. The skill installs without any pre-configured env vars. The agent guides the user through onboarding (generating a recovery phrase) during first use.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Publish Command
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Login
|
|
94
|
+
clawhub login
|
|
95
|
+
|
|
96
|
+
# Publish (update version as needed)
|
|
97
|
+
clawhub publish ./skill \
|
|
98
|
+
--slug totalreclaw \
|
|
99
|
+
--name "TotalReclaw" \
|
|
100
|
+
--version 1.4.0 \
|
|
101
|
+
--tags latest,memory,encryption,e2ee,e2e-encryption,privacy,agent-memory,persistent-context \
|
|
102
|
+
--changelog "v1.4.0: ClawHub as primary install method, LLM-guided dedup, dual-chain billing, Harrier-OSS-v1-270M."
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Security Scan Notes
|
|
108
|
+
|
|
109
|
+
The `TOTALRECLAW_RECOVERY_PHRASE` env var will likely trigger extra scrutiny from the automated security scanner. The E2EE architecture explanation in SKILL.md should help it pass as `clean`:
|
|
110
|
+
|
|
111
|
+
- The password is a 12-word BIP-39 mnemonic used to derive encryption keys
|
|
112
|
+
- It never leaves the client device
|
|
113
|
+
- The server only ever receives encrypted blobs
|
|
114
|
+
- All crypto code is open-source and auditable
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Competitor Context
|
|
119
|
+
|
|
120
|
+
ClawHub has one similar listing: **Everclaw** (also XChaCha20-Poly1305 encrypted cloud memory, ~2,959 downloads). It is flagged as `suspicious` by the moderation system. TotalReclaw differentiates by:
|
|
121
|
+
|
|
122
|
+
- Fully open-source (server + client)
|
|
123
|
+
- On-chain data anchoring (Gnosis Chain + The Graph)
|
|
124
|
+
- Seed-phrase portability (no accounts)
|
|
125
|
+
- Competitive benchmark data (98.1% recall@8)
|
|
126
|
+
- Clean security scan (no suspicious patterns)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Post-Publishing
|
|
131
|
+
|
|
132
|
+
- **Version updates**: Bump version in `skill.json` and SKILL.md frontmatter, then `clawhub publish` again
|
|
133
|
+
- **Monitor**: Check downloads, stars, and comments on the listing
|
|
134
|
+
- **Respond to feedback**: Monitor the ClawHub listing for user comments
|
package/README.md
CHANGED
|
@@ -1,103 +1,446 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="../../docs/assets/logo.png" alt="TotalReclaw" width="80" />
|
|
3
|
-
</p>
|
|
1
|
+
# TotalReclaw Skill for OpenClaw
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
> **End-to-end encrypted memory + knowledge graph for AI agents -- portable, yours forever.**
|
|
4
|
+
>
|
|
5
|
+
> Your AI remembers everything. Your server sees nothing.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
<strong>End-to-end encrypted memory for OpenClaw -- fully automatic, yours forever</strong>
|
|
9
|
-
</p>
|
|
7
|
+
TotalReclaw gives any [OpenClaw](https://github.com/openclaw/openclaw) agent persistent, encrypted long-term memory. Preferences, decisions, commitments, rules, and context carry across every conversation -- fully end-to-end encrypted so the server **never** sees plaintext.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
<a href="https://totalreclaw.xyz">Website</a> ·
|
|
13
|
-
<a href="https://www.npmjs.com/package/@totalreclaw/totalreclaw">npm</a> ·
|
|
14
|
-
<a href="../../docs/guides/beta-tester-guide.md">Getting Started</a>
|
|
15
|
-
</p>
|
|
9
|
+
**v3.0.0 ships Memory Taxonomy v1**: every memory is typed (`claim` / `preference` / `directive` / `commitment` / `episode` / `summary`) and tagged with source, scope, and volatility. Recall uses source-weighted reranking so user-authored claims consistently rank above assistant-regurgitated noise. See [`docs/guides/memory-types-guide.md`](../../docs/guides/memory-types-guide.md).
|
|
16
10
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
### ClawHub (recommended)
|
|
14
|
+
|
|
15
|
+
Tell your OpenClaw agent:
|
|
16
|
+
|
|
17
|
+
> "Install the TotalReclaw skill from ClawHub"
|
|
18
|
+
|
|
19
|
+
Or via terminal:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
openclaw skills install totalreclaw
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then set one environment variable:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export TOTALRECLAW_RECOVERY_PHRASE="your twelve word recovery phrase here"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That's it. TotalReclaw hooks into your agent automatically. The server URL defaults to `https://api.totalreclaw.xyz` (managed service) -- only set `TOTALRECLAW_SERVER_URL` if you are self-hosting. See the [env vars reference](../../docs/guides/env-vars-reference.md) for the full (short) list.
|
|
32
|
+
|
|
33
|
+
### Alternative: npm
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
openclaw plugins install @totalreclaw/totalreclaw
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Why TotalReclaw?
|
|
42
|
+
|
|
43
|
+
Most AI memory solutions force a tradeoff: **good recall OR privacy**. TotalReclaw eliminates that tradeoff.
|
|
44
|
+
|
|
45
|
+
| | Recall@8 | Privacy | Encryption | Portable Export |
|
|
46
|
+
|---|:---:|:---:|:---:|:---:|
|
|
47
|
+
| **TotalReclaw (E2EE)** | **98.1%** | **100%** | XChaCha20-Poly1305 | Yes |
|
|
48
|
+
| Plaintext vector search | 99.2% | 0% | None | Varies |
|
|
49
|
+
| Mem0 (hosted) | ~95% | 0% | At-rest only | No |
|
|
50
|
+
| Native OpenClaw QMD | ~90% | 50% | Partial | No |
|
|
51
|
+
|
|
52
|
+
**98.1% recall with 100% privacy** -- tested against 8,727 real-world memories. The server never sees your data, yet search quality is within 1.1% of plaintext alternatives.
|
|
53
|
+
|
|
54
|
+
### Key Differentiators
|
|
55
|
+
|
|
56
|
+
- **True end-to-end encryption**: XChaCha20-Poly1305 encryption, Argon2id key derivation, HKDF-SHA256 auth. The server is cryptographically unable to read your memories.
|
|
57
|
+
- **Near-plaintext recall**: LSH blind indices with client-side BM25 + cosine + RRF reranking achieve 98.1% recall@8.
|
|
58
|
+
- **No vendor lock-in**: One-click plaintext export in JSON or Markdown. Your data is always yours.
|
|
59
|
+
- **Works everywhere**: Any MCP-compatible AI agent, not just OpenClaw.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
- **End-to-End Encryption**: XChaCha20-Poly1305 ensures the server never sees plaintext memories
|
|
66
|
+
- **Memory Taxonomy v1**: 6 speech-act types + source / scope / volatility axes on every memory. [Learn more](../../docs/guides/memory-types-guide.md)
|
|
67
|
+
- **Intelligent Extraction**: G-pipeline — single merged-topic LLM call, provenance filter, comparative rescoring, volatility heuristic. v1 is the only write path.
|
|
68
|
+
- **Semantic Search**: LSH blind indices with client-side BM25 + cosine + RRF fusion reranking
|
|
69
|
+
- **Retrieval v2 Tier 1**: Source-weighted reranking — user=1.0, user-inferred=0.9, derived/external=0.7, assistant=0.55
|
|
70
|
+
- **Lifecycle Hooks**: Seamlessly integrates with OpenClaw's agent lifecycle (before_agent_start, agent_end, pre_compaction, before_reset)
|
|
71
|
+
- **Natural-language overrides**: "pin that", "that was actually a rule, not a preference", "file that under work" — agent calls the right tool automatically
|
|
72
|
+
- **Portable Export**: One-click plaintext export -- no vendor lock-in
|
|
73
|
+
- **Decay Management**: Automatic memory decay with configurable thresholds
|
|
22
74
|
|
|
23
75
|
---
|
|
24
76
|
|
|
25
|
-
|
|
77
|
+
## Quick Start
|
|
26
78
|
|
|
27
|
-
|
|
79
|
+
### 1. Install
|
|
28
80
|
|
|
29
|
-
|
|
81
|
+
Tell your OpenClaw agent:
|
|
30
82
|
|
|
31
|
-
> "Install the
|
|
83
|
+
> "Install the TotalReclaw skill from ClawHub"
|
|
32
84
|
|
|
33
|
-
Or
|
|
85
|
+
Or via terminal:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
openclaw skills install totalreclaw
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Alternative (npm):
|
|
34
92
|
|
|
35
93
|
```bash
|
|
36
94
|
openclaw plugins install @totalreclaw/totalreclaw
|
|
37
95
|
```
|
|
38
96
|
|
|
39
|
-
|
|
97
|
+
### 2. Configure
|
|
40
98
|
|
|
41
|
-
|
|
99
|
+
Set one environment variable:
|
|
42
100
|
|
|
43
|
-
|
|
101
|
+
```bash
|
|
102
|
+
export TOTALRECLAW_RECOVERY_PHRASE="your twelve word recovery phrase here"
|
|
103
|
+
```
|
|
44
104
|
|
|
45
|
-
-
|
|
46
|
-
- **During conversation** -- extracts facts, preferences, and decisions automatically
|
|
47
|
-
- **Before context compaction** -- saves important context before the window is trimmed
|
|
105
|
+
**That's it.** v1 is the default extraction and write path. Extraction cadence, importance floor, candidate pool size, and dedup thresholds are all server-tuned via the relay's billing response -- no client env vars to set. See [env vars reference](../../docs/guides/env-vars-reference.md).
|
|
48
106
|
|
|
49
|
-
|
|
107
|
+
For self-hosted deployments:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
export TOTALRECLAW_SERVER_URL="http://your-totalreclaw-server:8080"
|
|
111
|
+
export TOTALRECLAW_SELF_HOSTED=true
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. Use
|
|
115
|
+
|
|
116
|
+
Once installed, TotalReclaw hooks into your agent lifecycle automatically. No code changes needed.
|
|
117
|
+
|
|
118
|
+
Your agent will:
|
|
119
|
+
- **Load relevant memories** before processing each message (`before_agent_start`)
|
|
120
|
+
- **Extract and store facts** after each turn (`agent_end`)
|
|
121
|
+
- **Flush all memories** before context compaction (`pre_compaction`)
|
|
122
|
+
|
|
123
|
+
You can also use the tools directly in conversation:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
"Remember that I prefer dark mode in all editors"
|
|
127
|
+
"What do you know about my programming preferences?"
|
|
128
|
+
"Forget the memory about my old email address"
|
|
129
|
+
"Export all my memories as JSON"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
50
133
|
|
|
51
134
|
## Tools
|
|
52
135
|
|
|
53
|
-
|
|
136
|
+
The plugin exposes these tools to your OpenClaw agent. Most invocations happen via natural language -- the agent picks the right tool from context.
|
|
54
137
|
|
|
55
|
-
|
|
56
|
-
|------|-------------|
|
|
57
|
-
| `totalreclaw_remember` | Manually store a fact |
|
|
58
|
-
| `totalreclaw_recall` | Search memories by natural language |
|
|
59
|
-
| `totalreclaw_forget` | Delete a specific memory |
|
|
60
|
-
| `totalreclaw_export` | Export all memories as plaintext |
|
|
61
|
-
| `totalreclaw_status` | Check billing status and quota |
|
|
62
|
-
| `totalreclaw_consolidate` | Merge duplicate memories |
|
|
63
|
-
| `totalreclaw_import_from` | Import from Mem0 or MCP Memory Server |
|
|
138
|
+
### totalreclaw_remember
|
|
64
139
|
|
|
65
|
-
|
|
140
|
+
Explicitly store a memory. Accepts v1 taxonomy fields.
|
|
66
141
|
|
|
67
|
-
|
|
142
|
+
```typescript
|
|
143
|
+
const result = await skill.remember({
|
|
144
|
+
text: 'User prefers dark mode',
|
|
145
|
+
type: 'preference', // v1 types: claim, preference, directive, commitment, episode, summary
|
|
146
|
+
source: 'user', // v1 sources: user, user-inferred, assistant, external, derived
|
|
147
|
+
scope: 'personal', // v1 scopes: work, personal, health, family, creative, finance, misc, unspecified
|
|
148
|
+
importance: 7, // 1-10 (see importance rubric)
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
console.log(result); // "Memory stored successfully with ID: fact-123"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### totalreclaw_recall
|
|
155
|
+
|
|
156
|
+
Search for relevant memories.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
const memories = await skill.recall({
|
|
160
|
+
query: 'programming language preferences',
|
|
161
|
+
k: 5, // optional: number of results (default: 8, max: 20)
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// Each memory has:
|
|
165
|
+
// - fact: The fact object with text, metadata, etc.
|
|
166
|
+
// - score: Combined relevance score
|
|
167
|
+
// - vectorScore: Vector similarity score
|
|
168
|
+
// - textScore: BM25 text score
|
|
169
|
+
// - decayAdjustedScore: Score adjusted for decay
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### totalreclaw_forget
|
|
173
|
+
|
|
174
|
+
Delete a specific memory.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
await skill.forget({
|
|
178
|
+
factId: 'fact-123',
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### totalreclaw_export
|
|
183
|
+
|
|
184
|
+
Export all memories for portability.
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
const jsonExport = await skill.export({
|
|
188
|
+
format: 'json', // or 'markdown'
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
console.log(jsonExport);
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Lifecycle Hooks
|
|
197
|
+
|
|
198
|
+
TotalReclaw integrates with OpenClaw through three lifecycle hooks:
|
|
199
|
+
|
|
200
|
+
| Hook | Priority | Description |
|
|
201
|
+
|------|----------|-------------|
|
|
202
|
+
| `before_agent_start` | 10 | Retrieve relevant memories before agent processes message |
|
|
203
|
+
| `agent_end` | 90 | Extract and store facts after agent completes turn |
|
|
204
|
+
| `pre_compaction` | 5 | Full memory flush before context compaction |
|
|
205
|
+
|
|
206
|
+
### before_agent_start
|
|
68
207
|
|
|
69
|
-
|
|
70
|
-
- **Automatic extraction** -- LLM extracts facts from conversations, no manual input needed
|
|
71
|
-
- **Semantic search** -- Local embeddings + BM25 + cosine reranking with RRF fusion
|
|
72
|
-
- **Smart dedup** -- Cosine similarity catches paraphrases; LLM-guided dedup catches contradictions (Pro)
|
|
73
|
-
- **On-chain storage** -- Encrypted data stored on Gnosis Chain, indexed by The Graph
|
|
74
|
-
- **Portable** -- One 12-word phrase. Any device, same memories, no lock-in
|
|
75
|
-
- **Import** -- Migrate from Mem0 or MCP Memory Server
|
|
208
|
+
Runs before the agent processes a user message. Retrieves relevant memories and formats them for context injection.
|
|
76
209
|
|
|
77
|
-
|
|
210
|
+
```typescript
|
|
211
|
+
const result = await skill.onBeforeAgentStart(context);
|
|
78
212
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
213
|
+
// result.memories - Array of retrieved memories
|
|
214
|
+
// result.contextString - Formatted string for injection
|
|
215
|
+
// result.latencyMs - Search latency in milliseconds
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### agent_end
|
|
219
|
+
|
|
220
|
+
Runs after the agent completes its turn. Extracts facts from the conversation and stores them.
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
const result = await skill.onAgentEnd(context);
|
|
224
|
+
|
|
225
|
+
// result.factsExtracted - Number of facts extracted
|
|
226
|
+
// result.factsStored - Number of facts stored
|
|
227
|
+
// result.processingTimeMs - Processing time
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### pre_compaction
|
|
231
|
+
|
|
232
|
+
Runs before conversation history is compacted. Performs comprehensive extraction of the full history.
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
const result = await skill.onPreCompaction(context);
|
|
236
|
+
|
|
237
|
+
// result.factsExtracted - Number of facts extracted
|
|
238
|
+
// result.factsStored - Number of facts stored
|
|
239
|
+
// result.duplicatesSkipped - Duplicates skipped
|
|
240
|
+
// result.processingTimeMs - Processing time
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Configuration
|
|
246
|
+
|
|
247
|
+
### Environment Variables
|
|
248
|
+
|
|
249
|
+
See [`docs/guides/env-vars-reference.md`](../../docs/guides/env-vars-reference.md)
|
|
250
|
+
for the complete, authoritative list. The v1-launch cleanup reduced the
|
|
251
|
+
user-facing surface to 5 vars plus LLM provider keys. The short version:
|
|
252
|
+
|
|
253
|
+
| Variable | Required | Default | Description |
|
|
254
|
+
|----------|:---:|---------|-------------|
|
|
255
|
+
| `TOTALRECLAW_RECOVERY_PHRASE` | **Yes** | -- | 12-word BIP-39 recovery phrase (never sent to server) |
|
|
256
|
+
| `TOTALRECLAW_SERVER_URL` | No | `https://api.totalreclaw.xyz` | Relay URL (override for self-hosted / staging) |
|
|
257
|
+
| `TOTALRECLAW_SELF_HOSTED` | No | `false` | Set `true` if running against a self-hosted PostgreSQL server |
|
|
258
|
+
| `TOTALRECLAW_CREDENTIALS_PATH` | No | `~/.totalreclaw/credentials.json` | Credential file location |
|
|
259
|
+
| `TOTALRECLAW_CACHE_PATH` | No | `~/.totalreclaw/cache.enc` | Encrypted cache file location |
|
|
260
|
+
|
|
261
|
+
Tuning knobs (extraction interval, importance threshold, cosine thresholds)
|
|
262
|
+
now come from the relay billing response. Self-hosted operators can still
|
|
263
|
+
set the env-var equivalents as fallbacks — see the env vars reference.
|
|
264
|
+
|
|
265
|
+
### Configuration Sources (Priority Order)
|
|
266
|
+
|
|
267
|
+
Configuration is loaded from multiple sources. Higher priority overrides lower:
|
|
268
|
+
|
|
269
|
+
1. **Default values** -- Built-in defaults
|
|
270
|
+
2. **OpenClaw config** -- `agents.defaults.totalreclaw.*`
|
|
271
|
+
3. **Environment variables** -- `TOTALRECLAW_*`
|
|
272
|
+
4. **Explicit overrides** -- Passed to constructor
|
|
273
|
+
|
|
274
|
+
### OpenClaw Configuration
|
|
275
|
+
|
|
276
|
+
Add to your OpenClaw configuration file:
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"agents": {
|
|
281
|
+
"defaults": {
|
|
282
|
+
"totalreclaw": {
|
|
283
|
+
"serverUrl": "http://your-server:8080",
|
|
284
|
+
"autoExtractEveryTurns": 3,
|
|
285
|
+
"minImportanceForAutoStore": 6,
|
|
286
|
+
"maxMemoriesInContext": 8,
|
|
287
|
+
"forgetThreshold": 0.3
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Memory Types
|
|
83
297
|
|
|
84
|
-
|
|
298
|
+
TotalReclaw categorizes memories into five types:
|
|
85
299
|
|
|
86
|
-
|
|
300
|
+
| Type | Description | Example |
|
|
301
|
+
|------|-------------|---------|
|
|
302
|
+
| `fact` | Objective information | "User works at Acme Corp" |
|
|
303
|
+
| `preference` | User likes/dislikes | "User prefers dark mode" |
|
|
304
|
+
| `decision` | Choices made | "User decided to use PostgreSQL" |
|
|
305
|
+
| `episodic` | Events and experiences | "User attended PyCon 2024" |
|
|
306
|
+
| `goal` | Objectives and targets | "User wants to learn Rust" |
|
|
87
307
|
|
|
88
|
-
|
|
308
|
+
## Importance Scoring
|
|
89
309
|
|
|
90
|
-
|
|
91
|
-
- **NanoClaw** -- Built-in support via MCP bridge
|
|
310
|
+
Memories are scored on a 1-10 scale:
|
|
92
311
|
|
|
93
|
-
|
|
312
|
+
| Score | Level | Description |
|
|
313
|
+
|-------|-------|-------------|
|
|
314
|
+
| 1-3 | Trivial | Small talk, pleasantries |
|
|
315
|
+
| 4-6 | Useful | Tool preferences, working style |
|
|
316
|
+
| 7-8 | Important | Key decisions, major preferences |
|
|
317
|
+
| 9-10 | Critical | Core values, safety info |
|
|
94
318
|
|
|
95
|
-
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Encryption Details
|
|
322
|
+
|
|
323
|
+
All cryptographic operations are powered by [`@totalreclaw/core`](https://www.npmjs.com/package/@totalreclaw/core) -- a unified Rust/WASM module that ensures byte-for-byte consistency across all TotalReclaw clients.
|
|
324
|
+
|
|
325
|
+
TotalReclaw uses end-to-end encryption:
|
|
326
|
+
|
|
327
|
+
1. **Key Derivation**: Recovery phrase is processed through Argon2id to derive encryption keys. The phrase is never sent to the server.
|
|
328
|
+
2. **Encryption**: All memories are encrypted client-side using XChaCha20-Poly1305 before transmission.
|
|
329
|
+
3. **Search**: LSH blind indices (SHA-256 hashed) enable server-side search without exposing plaintext.
|
|
330
|
+
4. **Decryption**: Memories are decrypted client-side after retrieval.
|
|
331
|
+
5. **Authentication**: HKDF-SHA256 for authentication tokens.
|
|
332
|
+
|
|
333
|
+
The server is cryptographically unable to read your memories, embeddings, or search queries.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Performance Targets
|
|
338
|
+
|
|
339
|
+
| Metric | Target |
|
|
340
|
+
|--------|--------|
|
|
341
|
+
| Search latency (p95) | < 140ms for 1M memories |
|
|
342
|
+
| Recall accuracy | >= 93% of true top-250 |
|
|
343
|
+
| Storage overhead | <= 2.2x vs plaintext |
|
|
344
|
+
| Extraction latency | < 500ms |
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Architecture
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
+-------------------+ +-------------------+ +-------------------+
|
|
352
|
+
| OpenClaw Agent | | TotalReclaw Skill | | TotalReclaw Server |
|
|
353
|
+
+-------------------+ +-------------------+ +-------------------+
|
|
354
|
+
| | |
|
|
355
|
+
| onBeforeAgentStart() | |
|
|
356
|
+
|------------------------>| recall() |
|
|
357
|
+
| |------------------------>|
|
|
358
|
+
| |<------------------------|
|
|
359
|
+
|<------------------------| |
|
|
360
|
+
| | |
|
|
361
|
+
| [Agent processes] | |
|
|
362
|
+
| | |
|
|
363
|
+
| onAgentEnd() | |
|
|
364
|
+
|------------------------>| extract + store() |
|
|
365
|
+
| |------------------------>|
|
|
366
|
+
|<------------------------| |
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
96
370
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
371
|
+
## Troubleshooting
|
|
372
|
+
|
|
373
|
+
### "Skill not initialized"
|
|
374
|
+
|
|
375
|
+
Call `await skill.init()` before using any methods.
|
|
376
|
+
|
|
377
|
+
### "Failed to load reranker model"
|
|
378
|
+
|
|
379
|
+
The reranker model is optional. If not found, vector scores are used as fallback.
|
|
380
|
+
|
|
381
|
+
### "Memory not found"
|
|
382
|
+
|
|
383
|
+
The fact ID may be incorrect, or the memory may have been evicted due to decay.
|
|
384
|
+
|
|
385
|
+
### Slow searches
|
|
386
|
+
|
|
387
|
+
- Ensure the TotalReclaw server is properly indexed
|
|
388
|
+
- Check network latency to the server
|
|
389
|
+
- Consider increasing `maxMemoriesInContext` for better recall
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Development
|
|
394
|
+
|
|
395
|
+
### Setup
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
git clone https://github.com/p-diogo/totalreclaw
|
|
399
|
+
cd totalreclaw/skill
|
|
400
|
+
npm install
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Build
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
npm run build
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Test
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
npm test
|
|
413
|
+
|
|
414
|
+
# With coverage
|
|
415
|
+
npm test -- --coverage
|
|
416
|
+
|
|
417
|
+
# Watch mode
|
|
418
|
+
npm run test:watch
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Lint
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
npm run lint
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Contributing
|
|
430
|
+
|
|
431
|
+
1. Fork the repository
|
|
432
|
+
2. Create a feature branch: `git checkout -b feature/my-feature`
|
|
433
|
+
3. Commit changes: `git commit -am 'Add my feature'`
|
|
434
|
+
4. Push to the branch: `git push origin feature/my-feature`
|
|
435
|
+
5. Submit a pull request
|
|
100
436
|
|
|
101
437
|
## License
|
|
102
438
|
|
|
103
|
-
MIT
|
|
439
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
440
|
+
|
|
441
|
+
## Links
|
|
442
|
+
|
|
443
|
+
- [TotalReclaw Documentation](https://github.com/p-diogo/totalreclaw)
|
|
444
|
+
- [Claw Hub Listing](https://clawhub.ai/skills/totalreclaw)
|
|
445
|
+
- [OpenClaw](https://github.com/openclaw/openclaw)
|
|
446
|
+
- [Issue Tracker](https://github.com/p-diogo/totalreclaw/issues)
|