@totalreclaw/totalreclaw 3.3.1-rc.7 → 3.3.1-rc.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,208 @@ All notable changes to `@totalreclaw/totalreclaw` (the OpenClaw plugin) are docu
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.3.1-rc.9] — 2026-04-23
8
+
9
+ Coordinated version bump with Hermes Python `2.3.1rc9`. Plugin code itself is unchanged from `3.3.1-rc.6` (the first-run banner fix lives entirely on the Python side — `totalreclaw.onboarding.maybe_emit_welcome`). The rc.9 bundle ships the Hermes-side banner suppression and keeps plugin + Python versions aligned so the release-pipeline tracker can carry them through QA as one artifact set.
10
+
11
+ ### Why a plugin bump when only Python changed
12
+
13
+ Our RC cadence publishes both registries from the same bundle. Out-of-sync version tags cause downstream confusion (the `qa-totalreclaw` skill and the release-pipeline tracker both key on a single RC-number per wave). Skipping the plugin bump would leave rc.9 documented on the Python side only; a later plugin bug would then have to skip to rc.10 to catch up. Much simpler to bump both in lockstep.
14
+
15
+ See `python/CHANGELOG.md` (the `2.3.1rc9` entry) for the underlying fix: suppress the first-run welcome banner emitted by `totalreclaw.onboarding.maybe_emit_welcome`. Two problems surfaced during the rc.8 Hermes auto-QA run:
16
+
17
+ 1. **Chat-breaker.** The banner dominated `hermes chat -q` stdout when credentials were absent, breaking the QA harness's `session_id` parsing on every fresh install.
18
+ 2. **Phrase-safety violation.** The banner told users to `Run: totalreclaw setup` — a CLI that emits the recovery phrase to stdout. In an agent-driven context, stdout is echoed back into LLM context, so the phrase would cross the LLM boundary in violation of `project_phrase_safety_rule.md`.
19
+
20
+ Agent-driven setup now routes through the `totalreclaw_pair` tool (browser-side crypto, phrase-safe) per SKILL.md. User-in-terminal setup still runs through `totalreclaw setup` / `openclaw totalreclaw onboard` OUTSIDE any agent context.
21
+
22
+ ### Skipped
23
+
24
+ - **`3.3.1-rc.7`** and **`3.3.1-rc.8`** — registry-only bumps from 2026-04-22 workflow dispatches; the git repo on `main` carried rc.6 code unchanged through both publishes.
25
+
26
+ ## [3.3.1-rc.6] — 2026-04-22
27
+
28
+ Coordinated version bump with Hermes Python `2.3.1rc6`. Plugin code itself is unchanged from `3.3.1-rc.4` (the OpenClaw plugin's `register()` path already wired every tool advertised in `skill.yaml`). The rc.6 bundle ships the Hermes-side tool-registration fix and keeps plugin + Python versions aligned so the release-pipeline tracker can carry them through QA as one artifact set.
29
+
30
+ ### Why a plugin bump when only Python changed
31
+
32
+ Our RC cadence publishes both registries from the same bundle. Out-of-sync version tags cause downstream confusion (the `qa-totalreclaw` skill and the release-pipeline tracker both key on a single RC-number per wave). Skipping the plugin bump would leave rc.6 documented on the Python side only; a later plugin bug would then have to skip to rc.7 to catch up. Much simpler to bump both in lockstep.
33
+
34
+ ### Skipped
35
+
36
+ - **`3.3.1-rc.5`** — PR #76 (branch `fix/plugin-3.3.1-rc.5-qr-display`) remained unmerged when the rc.4 Hermes regression was escalated. rc.5's QR-display work rebases onto rc.6 as a follow-up.
37
+
38
+ ## [3.3.1-rc.4] — 2026-04-22
39
+
40
+ Phrase-safety hardening: `totalreclaw_onboard` agent tool removed. Paired with Hermes Python `2.3.1rc4` (which ports the QR-pair flow to Python so Hermes users gain a phrase-safe agent setup path too).
41
+
42
+ ### Removed (phrase-safety enforcement — BREAKING for agent tool callers)
43
+
44
+ - **`totalreclaw_onboard` agent tool — REMOVED.** rc.3 shipped a `totalreclaw_onboard` tool that generated a fresh BIP-39 mnemonic in-process, wrote it to `credentials.json`, and returned `{scope_address, credentials_path}`. `emitPhrase: false` kept the mnemonic out of the tool's return payload, but NOTHING ARCHITECTURALLY PREVENTED leakage — a future patch could regress the flag, a different code path could echo the mnemonic in a log/error, or the mere existence of the tool signalled to agents that phrase generation inside chat is fine (it isn't). Per `project_phrase_safety_rule.md`: "recovery phrase MUST NEVER cross the LLM context in ANY form." rc.4 removes the registration. The underlying `runNonInteractiveOnboard` code path stays reachable via the CLI `openclaw totalreclaw onboard` — that path runs in the user's own terminal, OUTSIDE any agent shell, so phrase stdout never feeds back into LLM context.
45
+
46
+ ### Changed
47
+
48
+ - **`SKILL.md` — setup section rewritten.** `totalreclaw_pair` is now the canonical setup surface for all users (local or remote). The CLI wizard (`openclaw totalreclaw onboard`) is explicitly documented as user-terminal-only — agents MUST NOT invoke it via their shell tool. Tool surface table updated: `totalreclaw_onboard` removed, `totalreclaw_pair` promoted to canonical. `totalreclaw_onboarding_start` remains as a pointer-only tool for users who explicitly prefer local-terminal setup.
49
+ - **`index.ts` — `totalreclaw_pair` tool description updated.** Removed backref to `totalreclaw_onboard`; now instructs agents to always prefer pair, with `totalreclaw_onboarding_start` as the fallback pointer for local-terminal-only users.
50
+ - **`docs/guides/openclaw-setup.md` — QR pairing is now documented as the default setup flow.** CLI wizard moved to a user-terminal-only subsection with a prominent "do NOT run this through an agent shell" warning.
51
+
52
+ ### Tests
53
+
54
+ - **`phrase-safety-registry.test.ts`** — new. Text-scans `index.ts` for `api.registerTool({ name: '...' })` literals and asserts: (a) `totalreclaw_onboard` is NOT in the list; (b) `totalreclaw_pair` IS in the list; (c) no name contains phrase-adjacent tokens (`onboard_generate`, `generate_phrase`, `generate_mnemonic`, `restore_phrase`, `restore_mnemonic`, `mnemonic`). Runs as part of `npm test`.
55
+
56
+ ## [3.3.1-rc.3] — 2026-04-22
57
+
58
+ Patch RC bundling two stability fixes, one new RC-gated tool, two SKILL.md addendums, and a configurable LLM retry budget. All prior rc.1 + rc.2 fixes are preserved.
59
+
60
+ ### Changed
61
+
62
+ - **`llm-client.ts` — configurable `ZAI_BASE_URL` + auto-fallback on "Insufficient balance" 429.** rc.2 QA surfaced that GLM Coding Plan keys hitting the STANDARD zai endpoint (and PAYG keys hitting CODING) return HTTP 429 with body `"Insufficient balance or no resource package. Please recharge."` — misleading because the key itself is valid. rc.3: (a) accepts `ZAI_BASE_URL` env override via `config.ts` / `getZaiBaseUrl()`; (b) auto-detects the error signature and flips CODING ↔ STANDARD once per call (logged at INFO). SKILL.md now documents "GLM Coding Plan → leave unset; PAYG → set `ZAI_BASE_URL=https://api.z.ai/api/paas/v4`."
63
+ - **`llm-client.ts` — retry budget 7s → ~62s (configurable).** rc.1/rc.2 QA: 5–9 of 10 extraction windows returned 0 facts against multi-minute upstream 429 storms. The 3-attempt 1s/2s/4s backoff couldn't outlast a 9-minute outage. rc.3: 5 attempts, 2s/4s/8s/16s/32s backoff, total ~62s. Configurable via `TOTALRECLAW_LLM_RETRY_BUDGET_MS` env (default 60_000). First retry logs at INFO, rest at DEBUG (debounced — no spam during long outages). On exhaustion throws `LLMUpstreamOutageError` (structured, `attempts` + `lastStatus`) so extraction callers can recognise vs bail silently. Non-retryable errors (401/403/404/parse) still propagate as plain `Error`.
64
+ - **`subgraph-store.ts` — per-account submission mutex.** rc.2 logged 16 AA25 `invalid account nonce` events from concurrent `submitFactBatchOnChain` / `submitFactOnChain` calls racing at the `eth_call getNonce(sender, 0)` step. rc.3 wraps both submission entry points in a per-`sender` `Map<scopeAddress, Promise>` chain so only one UserOp is in flight per Smart Account at a time. The existing AA25-retry-with-fresh-nonce path is unchanged and still catches relay-side zombie UserOps.
65
+
66
+ ### Added
67
+
68
+ - **`totalreclaw_report_qa_bug`** (RC-gated tool) — lets agents file structured QA-bug issues to `p-diogo/totalreclaw-internal` without the maintainer opening a fresh issue per RC finding. Only registered when the plugin version matches the `-rc.` token (via `readPluginVersion` in `fs-helpers.ts` + `isRcBuild` in the new `qa-bug-report.ts`). Handler POSTs to `https://api.github.com/repos/.../issues` with `Authorization: Bearer <token>` where `token = CONFIG.qaGithubToken` (reads `TOTALRECLAW_QA_GITHUB_TOKEN` or `GITHUB_TOKEN`). Secrets (BIP-39 phrases, `sk-*`, `AIzaSy*`, Telegram bot tokens, bearer tokens, 64+ char hex blobs, 0x-private-keys, `token=`/`secret=` qualifiers) are redacted fail-close in `redactSecrets()` before POST. Stable builds never expose this tool. See SKILL.md "Filing QA bugs (RC builds only)" for trigger rules — always ask user before filing, never the same bug twice.
69
+ - **`skill/plugin/qa-bug-report.ts`** — new pure-logic + HTTP module. Exports `isRcBuild`, `redactSecrets`, `validateQaBugArgs`, `buildIssueBody`, `postQaBugIssue`. Unit-tested in `qa-bug-report.test.ts`.
70
+ - **`skill/plugin/nonce-serialization.test.ts`** — exercises the per-`sender` mutex primitive: same-sender serializes, different-sender runs in parallel, case-insensitive keying, first-call failure releases the lock for the next.
71
+ - **`fs-helpers.ts` — `readPluginVersion(packageJsonDir)`** — scanner-safe helper used by the RC gate. Resolves via `path.dirname(fileURLToPath(import.meta.url))` in `index.ts` and returns the `version` field from `package.json` next to the module.
72
+
73
+ ### SKILL.md
74
+
75
+ - **First-person recall rule.** rc.2 debug found agents skipped `totalreclaw_recall` in 5/5 attempts on "Where do I live?". SKILL.md now hard-rules it: any first-person factual query ("where do I live/work", "what do I prefer", "my [noun]", etc.) MUST call recall first. If recall returns 0, say "I don't have anything about that yet" rather than invent.
76
+ - **QA bug triggers.** New "Filing QA bugs (RC builds only)" section with the four triggers (repeated tool failure, user friction signals, setup errors, docs-vs-reality mismatch). Offer to file, never auto-file, never same bug twice.
77
+ - **zai endpoint + retry budget** documented in a new "zai provider configuration" section.
78
+
79
+ ### Tests
80
+
81
+ - `llm-client-retry.test.ts` extended from 29 → 59 assertions. Covers: balance-error detection, CODING↔STANDARD fallback URL helper, `ZAI_BASE_URL` env override, full fallback happy/sad paths, `LLMUpstreamOutageError` surfacing, budget short-circuit.
82
+ - `qa-bug-report.test.ts` — 57 assertions covering isRcBuild, redactSecrets (BIP-39 / sk- / AIza / Telegram / Bearer / hex / private-key / preservation of UUIDs+SHAs+addresses), validateQaBugArgs, buildIssueBody, postQaBugIssue success + all failure paths.
83
+ - `nonce-serialization.test.ts` — 9 assertions.
84
+ - All existing tests (`llm-client.test.ts`, `manifest-shape.test.ts`, etc.) unchanged and green.
85
+
86
+ ### Scanner
87
+
88
+ - `check-scanner.mjs` still passes (0 flags). The `TOTALRECLAW_QA_GITHUB_TOKEN` + `ZAI_BASE_URL` + `TOTALRECLAW_LLM_RETRY_BUDGET_MS` env reads live in `config.ts` (the env-harvesting-free house). `llm-client.ts`, `index.ts`, and `qa-bug-report.ts` all stay off `process.env`.
89
+
90
+ ## [3.3.1-rc.2] — 2026-04-22
91
+
92
+ Follow-up RC for the 3.3.1-rc.1 QA NO-GO
93
+ (`docs/notes/QA-plugin-3.3.1-rc.1-20260422-0121.md` in
94
+ `totalreclaw-internal`). Fixes 3 ship-stoppers + 1 serious non-blocker
95
+ identified by the first real-user-flow QA under the 2026-04-22 chat-only
96
+ discipline, plus several UX gaps flagged by Pedro's agent (Hermes) during
97
+ parallel Telegram testing. All 3.3.1-rc.1 provider-agnostic LLM work is
98
+ preserved.
99
+
100
+ ### Changed
101
+
102
+ - **`gateway-url.ts` — drop `child_process` subprocess probe.** The rc.1
103
+ implementation shelled out to `tailscale status --json` via
104
+ `child_process.execFileSync` to discover the local MagicDNS hostname.
105
+ This tripped the OpenClaw dangerous-code scanner's shell-execution
106
+ rule and **blocked every `openclaw plugins install @totalreclaw/totalreclaw`**.
107
+ rc.2 swaps to a passive probe: `os.networkInterfaces()` detects a
108
+ `tailscale*` NIC carrying a CGNAT IPv4 (100.64/10), and we surface
109
+ the raw IP as the auto-detected host. Operators who want a proper
110
+ `https://<magicdns>.ts.net` URL now set
111
+ `plugins.entries.totalreclaw.config.publicUrl` explicitly (documented
112
+ in SKILL.md). The six-layer URL cascade is otherwise unchanged.
113
+
114
+ - **`check-scanner.mjs` — add shell-execution rule (catches `child_process`).**
115
+ Scanner-sim now mirrors the real OpenClaw `shell-execution` rule that
116
+ trips on any `child_process` substring (no context gate). Prevents a
117
+ repeat of the rc.1 regression. See `skill/scripts/check-scanner.mjs`
118
+ SHELL_EXEC_PATTERN.
119
+
120
+ - **`totalreclaw_forget` — route through `submitFactBatchOnChain` and write
121
+ tombstones at legacy v3.** The rc.1 implementation used the single-fact
122
+ `submitFactOnChain` path and wrote the tombstone at protobuf v4, which
123
+ the subgraph did NOT reflect as `isActive=false`. rc.2 mirrors the
124
+ pin/unpin tombstone shape exactly (legacy v3, `source="tombstone"`,
125
+ single-payload batch via `submitFactBatchOnChain`). Also adds
126
+ UUID-shape validation on `factId` to reject LLM hallucinations
127
+ ("forget that I live in Porto" passed as the factId) with a clear
128
+ message pointing the agent at `totalreclaw_recall` first.
129
+
130
+ - **`totalreclaw_forget` tool description** — rewritten from terse
131
+ ("Delete a specific memory by its ID.") to agent-instructive with a
132
+ recall-first workflow hint. Fixes the rc.1 QA failure where the LLM
133
+ hallucinated "Done" without actually calling the tool.
134
+
135
+ - **`chatCompletion` — exponential-backoff retry for 429 / timeouts.**
136
+ rc.1 QA: 5 of 6 extraction windows returned 0 raw facts because zai
137
+ 429s and timeouts had no retry path. rc.2 adds a retry wrapper:
138
+ 3 attempts with 1s → 2s → 4s backoff; 30s per-attempt timeout;
139
+ fail-fast on 4xx-other-than-429. Every extractor callsite
140
+ (`extractFacts`, `extractFactsForCompaction`, `comparativeRescoreV1`,
141
+ `extractDebriefFacts`) opts in to the retry + logger. See
142
+ `isRetryable()` for the classification list.
143
+
144
+ - **`llm-profile-reader.ts` — fallback to legacy `models.json` format.**
145
+ rc.1 QA VPS had `~/.openclaw/agents/<agent>/agent/models.json` (the
146
+ pre-auth-profiles shape, `{ providers: { zai: { apiKey: "..." } } }`)
147
+ not `auth-profiles.json`. The auto-resolve silently no-op'd.
148
+ rc.2 adds a 5th cascade tier: `readAllProfileKeys` reads
149
+ auth-profiles.json FIRST (takes precedence on overlap), then merges
150
+ in models.json entries for any provider not already covered.
151
+
152
+ ### Added
153
+
154
+ - **`totalreclaw_onboard`** (agent tool) — lets the agent drive the
155
+ non-interactive onboard flow from chat without shelling out. Generate
156
+ mode only (restore still requires `openclaw totalreclaw onboard --mode
157
+ restore` in the local terminal for security). Returns scope address +
158
+ credentials path; NEVER returns the mnemonic. Directly wraps
159
+ `runNonInteractiveOnboard` in-process.
160
+
161
+ - **`totalreclaw_pair`** (agent tool) — lets the agent start a pairing
162
+ session from chat and relay the URL + PIN + QR ASCII to the user.
163
+ Built on the same `createPairSession` + `buildPairingUrl` surface the
164
+ CLI uses, no subprocess. The recovery phrase still never crosses the
165
+ LLM — it's generated/entered in the BROWSER and uploaded E2EE.
166
+
167
+ - **`totalreclaw_retype`** (agent tool) — reclassify an existing memory
168
+ from one taxonomy type to another (claim/preference/directive/
169
+ commitment/episode/summary). Writes a new v1.1 claim with the updated
170
+ type, tombstones the old fact on-chain. rc.1 QA confirmed this tool
171
+ was documented in SKILL.md but NOT registered — agents couldn't call
172
+ it.
173
+
174
+ - **`totalreclaw_set_scope`** (agent tool) — move an existing memory to
175
+ a different scope (work/personal/health/family/creative/finance/misc/
176
+ unspecified). Same write pattern as retype. Also previously
177
+ documented-not-registered; rc.1 QA showed agents falling back to a
178
+ hallucinated delete+re-store workaround.
179
+
180
+ - **`skill/plugin/retype-setscope.ts`** — new pure-logic module
181
+ supporting the two agent tools above. Tightly mirrors pin.ts but
182
+ without the idempotent-status short-circuit (user may be confirming
183
+ a prior auto-extraction label) and without feedback wiring.
184
+
185
+ - **`skill/plugin/gateway-url.test.ts`** — unit coverage for the new
186
+ passive Tailscale + LAN detection. 17 cases, all green.
187
+
188
+ - **`skill/plugin/retype-setscope.test.ts`** — 31 cases covering arg
189
+ validation, successful rewrites, fact-not-found, submit failure,
190
+ malformed-blob, invalid-type/scope.
191
+
192
+ - **`skill/plugin/llm-client-retry.test.ts`** — 29 cases for the retry
193
+ wrapper: isRetryable classification, backoff behaviour, fail-fast on
194
+ non-retryable errors, logger interaction.
195
+
196
+ - **`skill/plugin/llm-profile-reader.test.ts`** — 13 additional cases
197
+ for models.json parsing + combined reader.
198
+
199
+ ### Preserved from rc.1
200
+
201
+ All the rc.1 LLM-autoresolve work carries forward unchanged:
202
+ - 4-tier cascade (plugin config → openclawProviders → auth-profiles →
203
+ env). With rc.2's `models.json` fallback it's effectively 5 tiers.
204
+ - `openclaw totalreclaw onboard --non-interactive --json --mode` CLI.
205
+ - `openclaw totalreclaw pair generate --json` CLI.
206
+ - `extraction.llm` plugin-config override block.
207
+ - Synchronous HTTP-route registration, manifest `kind` drop, etc.
208
+
7
209
  ## [3.3.1-rc.1] — 2026-04-22
8
210
 
9
211
  First release candidate for 3.3.1. Comprehensive patch release addressing
package/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
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: 3.3.1-rc.1
3
+ description: "Install + set up TotalReclaw encrypted memory for OpenClaw, then use totalreclaw_remember / totalreclaw_recall. Trigger on 'install TotalReclaw', 'set up TotalReclaw', 'restore my recovery phrase', or any remember / recall request."
4
+ version: 3.3.1-rc.6
5
5
  author: TotalReclaw Team
6
6
  license: MIT
7
7
  homepage: https://totalreclaw.xyz
@@ -22,325 +22,56 @@ metadata:
22
22
  - persistent-context
23
23
  ---
24
24
 
25
- # TotalReclaw Skill
25
+ # TotalReclaw — OpenClaw
26
26
 
27
- ## Installation
27
+ ## Fast path — "install totalreclaw" (Approach A, preferred)
28
28
 
29
- TotalReclaw ships as an OpenClaw plugin. There are **two install artifacts** a skill (which registers the instructions you're reading now) and a plugin (which provides the executable memory tools). Both are needed, and you install them in this order:
29
+ ClawHub classifies TotalReclaw as a skill. `openclaw skills install totalreclaw` registers this SKILL.md into your agent context BEFORE the plugin is installed (so you may be reading this with no `totalreclaw_*` tools yet).
30
30
 
31
- ```sh
32
- # 1. Install the skill (registers instructions + tool surface)
33
- openclaw skills install totalreclaw
31
+ If the user says "install totalreclaw" (or any variant) AND no `totalreclaw_*` tools are in your toolset:
34
32
 
35
- # 2. Install the plugin (activates routes, hooks, and tool implementations)
36
- openclaw plugins install @totalreclaw/totalreclaw
33
+ 1. Run via your shell tool: `openclaw plugins install totalreclaw`. (For RC candidates: `openclaw plugins install @totalreclaw/totalreclaw@rc` — the `rc` dist-tag on npm is the latest candidate.)
34
+ 2. Tell the user: *"Plugin installed. Restarting the gateway so the tools bind."* Then ask the user to restart the gateway: `openclaw gateway restart` (native) or `docker restart tr-openclaw` (Docker). The agent-facing shell CANNOT self-restart the gateway it's running inside of — this step has to be a user action. Wait for the user to confirm the restart is done.
35
+ 3. After restart: verify `totalreclaw_pair` is now in your toolset. If not, tell the user the restart didn't take effect and to retry the restart command. Do not loop the install.
36
+ 4. Check `~/.totalreclaw/credentials.json` (via `test -s ~/.totalreclaw/credentials.json`). If it exists, confirm *"TotalReclaw is already set up."* and stop.
37
+ 5. Call `totalreclaw_pair`. Returns `{url, pin, qr_ascii, expires_at_ms}`.
38
+ 6. Relay verbatim: *"Open <url> in your browser. Enter your 12-word recovery phrase (or let the browser generate one). Confirm PIN <pin>. I'll wait for you to say done."*
39
+ 7. After user says done: verify `~/.totalreclaw/credentials.json`. If missing, call `totalreclaw_pair` again (PIN likely expired) and resend.
40
+ 8. Confirm: *"TotalReclaw set up ✓. Ask me to remember or recall anything — try `totalreclaw_remember` or ask me to remember something."*
37
41
 
38
- # 3. Restart the gateway for the plugin to bind HTTP routes + hooks
39
- # On native install:
40
- openclaw restart
41
- # Inside Docker:
42
- docker restart openclaw-qa
43
- ```
42
+ If `totalreclaw_*` tools ARE already in your toolset when the user asks, SKIP the install step and jump to step 4.
44
43
 
45
- The two-step install is necessary because OpenClaw separates "skill metadata" (what this file describes) from "plugin code" (the compiled TypeScript that runs). Skipping step 2 leaves the user with instructions but no tools. Skipping step 3 leaves the tools installed but unbound — calls fail silently.
44
+ ## Explicit two-step setup flow (Approach B, fallback)
46
45
 
47
- Some OpenClaw versions support a single-step `openclaw plugins install @totalreclaw/totalreclaw` that auto-registers the skill; if so, you can skip step 1.
46
+ Used when the user pastes a verbose prompt describing skill install + plugin install + restart + pair (e.g. *"TotalReclaw is a skill at 'totalreclaw' on ClawHub. Install it, then install the plugin, restart the gateway, and walk me through the QR pairing flow"*) OR when a tool returns `onboarding required`.
48
47
 
49
- ---
50
-
51
- ## Recovery Phrase CRITICAL SAFETY RULES
52
-
53
- ### RULE 1 Never generate, display, or transmit a recovery phrase in chat.
54
-
55
- The recovery phrase is the **only** key to the user's encrypted memories. LLM providers log conversation transcripts; any phrase that appears in a chat reply leaks to every hop in that logging path.
56
-
57
- **You MUST NOT:**
58
- - Produce a 12-word phrase yourself and paste it into the chat. You **cannot** compute a valid BIP-39 checksum, and even if you could, this leaks the phrase.
59
- - Ask the user to paste their recovery phrase into the chat. If they do, explicitly tell them to delete the message and use the CLI flow instead.
60
- - Display a phrase that another tool returned via chat output.
61
-
62
- The phrase lives **only** in the user's terminal and in `~/.totalreclaw/credentials.json` (mode 0600).
63
-
64
- ### RULE 2 — Direct the user to the CLI wizard, or use the non-interactive flag for agent-driven setup.
65
-
66
- There are exactly two correct onboarding paths:
67
-
68
- **A. Interactive (human at a TTY):**
69
-
70
- ```sh
71
- openclaw totalreclaw onboard
72
- ```
73
-
74
- This runs a terminal wizard. The wizard generates the phrase (if chosen), asks the user to write it down, verifies three random words, then saves `~/.totalreclaw/credentials.json`. The phrase never leaves the user's terminal.
75
-
76
- **B. Agent-driven (Claude / another AI agent setting up TotalReclaw for the user):**
77
-
78
- ```sh
79
- openclaw totalreclaw onboard --non-interactive --json --mode generate
80
- ```
81
-
82
- Returns structured JSON: `{"ok": true, "action": "generate", "scope_address": "0x...", "credentials_path": "..."}`.
83
-
84
- The phrase is **not** in the payload. It was written to `credentials_path` (mode 0600). Tell the user: "Your recovery phrase is at `~/.totalreclaw/credentials.json` — open that file in your terminal to read it, and store it somewhere safe."
85
-
86
- For restore:
87
-
88
- ```sh
89
- openclaw totalreclaw onboard --non-interactive --json --mode restore --phrase "word1 word2 ..."
90
- ```
91
-
92
- ### RULE 3 — Remote gateways use QR pairing, not phrase paste.
93
-
94
- If the user is running OpenClaw on a VPS, Docker host, home server, or anywhere you can't see the terminal, run:
95
-
96
- ```sh
97
- openclaw totalreclaw pair generate
98
- # or for agent-driven:
99
- openclaw totalreclaw pair generate --json
100
- ```
101
-
102
- The CLI prints (or emits JSON with) a QR code, a URL, and a 6-digit PIN. The user scans with their phone, the browser generates a phrase on-device, encrypts it end-to-end with the gateway's ephemeral public key, and uploads the ciphertext. The phrase never touches chat, the LLM, or the relay.
103
-
104
- ---
105
-
106
- ## Tools
107
-
108
- Every tool below is available once onboarding is complete (credentials file exists + state = active) AND the gateway has been restarted post-install. If a tool returns `onboarding required`, direct the user to run `openclaw totalreclaw onboard` (or the non-interactive variant).
109
-
110
- ### totalreclaw_remember
111
-
112
- Store a new fact or preference in long-term memory.
113
-
114
- **Parameters:**
115
-
116
- | Name | Type | Required | Description |
117
- |------|------|----------|-------------|
118
- | text | string | Yes | The fact or information to remember |
119
- | type | string | No | Type of memory: `claim`, `preference`, `directive`, `commitment`, `episode`, `summary`. Default: `claim` |
120
- | importance | integer | No | 1-10. Default: auto-detected by extraction LLM |
121
-
122
- **Returns:** `{ factId, status: "stored", importance, encrypted: true }`
123
-
124
- ### totalreclaw_recall
125
-
126
- Search and retrieve relevant memories from long-term storage.
127
-
128
- **Parameters:**
129
-
130
- | Name | Type | Required | Description |
131
- |------|------|----------|-------------|
132
- | query | string | Yes | Natural language query |
133
- | k | integer | No | Results to return. Default 8, max 20 |
134
-
135
- **Returns:** `{ memories: [{ id, text, type, importance, score }], count }`
136
-
137
- ### totalreclaw_forget
138
-
139
- Soft-delete a specific fact.
140
-
141
- **Parameters:** `{ factId: string }` — the UUID of the fact to delete.
142
-
143
- ### totalreclaw_pin
144
-
145
- Pin a memory so auto-resolution can never supersede it. Use when the user explicitly wants a fact to stick around regardless of newer contradictions ("remember permanently", "never forget this").
146
-
147
- **Parameters:** `{ factId: string, reason?: string }`
148
-
149
- ### totalreclaw_unpin
150
-
151
- Remove a pin, returning the memory to normal decay / resolution.
152
-
153
- **Parameters:** `{ factId: string }`
154
-
155
- ### totalreclaw_retype
156
-
157
- Change the v1 taxonomy type of an existing memory (e.g. reclassify a misdetected `claim` as a `preference`).
158
-
159
- **Parameters:** `{ factId: string, newType: "claim"|"preference"|"directive"|"commitment"|"episode"|"summary" }`
160
-
161
- ### totalreclaw_set_scope
162
-
163
- Set the memory scope — `personal` (private to this user) or `shared` (available to delegates).
164
-
165
- **Parameters:** `{ factId: string, scope: "personal"|"shared" }`
166
-
167
- ### totalreclaw_export
168
-
169
- Export all memories in plaintext.
170
-
171
- **Parameters:** `{ format?: "json"|"markdown" }` — default `json`
172
-
173
- ### totalreclaw_status
48
+ 1. `openclaw plugins install @totalreclaw/totalreclaw` (stable). For RC: `@totalreclaw/totalreclaw@rc`.
49
+ 2. Restart gateway so plugin routes + tools bind. Docker: `docker restart tr-openclaw`. Native: `openclaw gateway restart`. Wait ~5s; confirm the gateway is back up. (If you are running inside the gateway, ask the user to run the restart command and wait for confirmation.)
50
+ 3. Call `totalreclaw_pair`. Returns `{url, pin, qr_ascii, expires_at_ms}`.
51
+ 4. Relay to user verbatim: *"Open <url> in your browser. Enter your 12-word recovery phrase (or let the browser generate one). Confirm PIN <pin>. I'll wait for you to say done."*
52
+ 5. After user says done: verify `~/.totalreclaw/credentials.json` exists and is non-empty. If missing, call `totalreclaw_pair` again (PIN likely expired) and resend.
53
+ 6. Confirm: *"TotalReclaw is set up. Ask me to remember or recall anything."*
174
54
 
175
- Check billing + subscription status.
55
+ ## Phrase safety (HARD — never break)
176
56
 
177
- **Parameters:** `{}` (no arguments)
57
+ NEVER echo / generate / ask the user to paste a recovery phrase in chat. NEVER invoke `openclaw totalreclaw onboard`, `totalreclaw setup`, or any phrase-touching CLI via your shell tool (stdout enters LLM context). The ONLY agent-facilitated setup path is `totalreclaw_pair`. If the user pastes a phrase anyway: tell them it is compromised, call `totalreclaw_pair` with `mode=generate` for a fresh wallet.
178
58
 
179
- **Returns:** `{ tier, quota, usage, resetsAt, upgradeUrl? }`
59
+ ## Usage (post-setup)
180
60
 
181
- ### totalreclaw_upgrade
61
+ - Stable user facts / preferences / identity / "remember X" → `totalreclaw_remember` (don't ask permission).
62
+ - First-person factual query ("do I / what's my / where do I …") → `totalreclaw_recall` FIRST, then answer from returned facts. If 0 results, say so.
63
+ - "forget / pin / unpin / retype / move to <scope>" X → `totalreclaw_recall` first for `factId`, then `totalreclaw_forget` / `_pin` / `_unpin` / `_retype` / `_set_scope`.
64
+ - "status" → `totalreclaw_status`. "upgrade" → `totalreclaw_upgrade` (paste Stripe URL verbatim). Post-upgrade testnet → mainnet: `totalreclaw_migrate` with `dry_run` first.
65
+ - "import / export / consolidate" → `totalreclaw_import_from` (`dry_run=true` first; `_import_batch` for >50 chunks) · `totalreclaw_export` · `totalreclaw_consolidate` (`dry_run` first).
182
66
 
183
- Get a Stripe checkout URL to upgrade to Pro (unlimited memories on Gnosis mainnet).
184
-
185
- **Parameters:** `{}`
186
-
187
- ### totalreclaw_migrate
188
-
189
- Migrate testnet (Base Sepolia) memories to mainnet (Gnosis) after upgrading to Pro.
190
-
191
- **Parameters:** `{ confirm?: boolean }` — dry-run by default; set `confirm: true` to execute.
192
-
193
- ### totalreclaw_import_from
194
-
195
- Import memories from other agent-memory tools (Mem0, MCP Memory Server, etc.).
196
-
197
- **Parameters:** `{ source, api_key?, source_user_id?, content?, file_path?, namespace?, dry_run? }`
198
-
199
- ### totalreclaw_consolidate
200
-
201
- Scan all memories and merge near-duplicates.
202
-
203
- **Parameters:** `{ dry_run?: boolean }`
204
-
205
- ---
206
-
207
- ## When to Use Each Tool
208
-
209
- ### totalreclaw_remember
210
-
211
- Use when:
212
- - The user explicitly asks you to remember something ("remember that...", "note that...", "don't forget...")
213
- - You detect a significant preference, decision, or fact useful in future conversations
214
- - The user corrects or updates previous information about themselves
215
- - You observe important context about the user's work, projects, or preferences
216
-
217
- Do NOT use for:
218
- - Temporary info only relevant to the current turn
219
- - Things the user explicitly says are temporary
220
- - Generic knowledge that isn't user-specific
221
-
222
- ### totalreclaw_recall
223
-
224
- Use when:
225
- - The user asks about their past preferences, decisions, or history
226
- - You need context about their projects, tools, or working style
227
- - The user asks "do you remember..." or "what did I tell you about..."
228
- - You're unsure about a preference and want to check before assuming
229
- - Starting a new conversation to load relevant context
230
-
231
- Do NOT use for:
232
- - Every single message — use sparingly, at most once per conversation start or when explicitly relevant
233
- - General knowledge questions unrelated to the user
234
-
235
- ### totalreclaw_pin / totalreclaw_unpin
236
-
237
- Use `pin` when the user says something like "remember this permanently", "always keep this", or "this is important — don't forget". Use `unpin` when they say "you can forget that", "it's no longer relevant", etc.
238
-
239
- ### totalreclaw_set_scope
240
-
241
- Use when the user indicates a memory should be shared with delegates ("share this with my team", "make this visible to everyone I work with") or scoped back to personal ("only for me", "private").
242
-
243
- ---
244
-
245
- ## Configuration
246
-
247
- All configuration lives under `plugins.entries.totalreclaw.config.*` in the OpenClaw config. The full 3.3.1 schema:
248
-
249
- ```yaml
250
- plugins:
251
- entries:
252
- totalreclaw:
253
- config:
254
- # Public URL for QR pairing (optional — auto-detected if Tailscale or LAN)
255
- publicUrl: https://gateway.example.com:18789
256
-
257
- # Extraction tuning (all optional)
258
- extraction:
259
- enabled: true # default true
260
- interval: 3 # turns between auto-extractions
261
- maxFactsPerExtraction: 15 # hard cap per turn
262
- model: glm-4.5-flash # shorthand override (just the model id)
263
- llm: # full provider override block
264
- provider: zai # zai|openai|anthropic|gemini|groq|deepseek|mistral|openrouter|xai|together|cerebras
265
- model: glm-4.5-flash
266
- apiKey: <your-key>
267
- baseUrl: https://api.z.ai/api/coding/paas/v4 # self-hosted / custom gateway only
268
- ```
269
-
270
- ### LLM Provider Auto-Resolution
271
-
272
- TotalReclaw needs a small LLM to extract facts from conversations. Resolution order (highest priority first):
273
-
274
- 1. **Plugin config** — `plugins.entries.totalreclaw.config.extraction.llm.{provider,apiKey}`
275
- 2. **OpenClaw provider config** — `api.config.models.providers`
276
- 3. **OpenClaw auth profiles** — keys stored in `~/.openclaw/agents/<agent>/agent/auth-profiles.json`. This is where most users have their provider keys; 3.3.1 added it as a resolution tier.
277
- 4. **Environment variables** — `ZAI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `GROQ_API_KEY`, `DEEPSEEK_API_KEY`, `MISTRAL_API_KEY`, `OPENROUTER_API_KEY`, `XAI_API_KEY`, `TOGETHER_API_KEY`, `CEREBRAS_API_KEY`
278
-
279
- If none of these resolve, auto-extraction is cleanly disabled and a single INFO message is logged at startup — manual `totalreclaw_remember` still works.
280
-
281
- ### QR Pairing URL Resolution
282
-
283
- For `openclaw totalreclaw pair generate`, the gateway's externally-reachable URL is resolved in this order:
284
-
285
- 1. `plugins.entries.totalreclaw.config.publicUrl` — explicit override
286
- 2. `gateway.remote.url` — OpenClaw's own remote-gateway URL
287
- 3. `gateway.bind === 'custom'` + `gateway.customBindHost`
288
- 4. Tailscale MagicDNS auto-detect (`tailscale status --json` → `https://<magicdns>`, assumes `tailscale serve` on 443)
289
- 5. LAN IPv4 auto-detect — first non-loopback non-virtual interface (warns: only reachable from same network)
290
- 6. `http://localhost:<port>` fallback (warns: only works on this machine)
291
-
292
- ---
293
-
294
- ## Security
295
-
296
- 1. **E2EE** — all memories are encrypted client-side with XChaCha20-Poly1305. The server never sees plaintext.
297
- 2. **On-chain** — encrypted fact bodies plus blind indices are written to the Memory DataEdge contract. Free tier = Base Sepolia (84532); Pro tier = Gnosis mainnet (100).
298
- 3. **Recovery phrase stays local** — it lives only in `~/.totalreclaw/credentials.json` with mode 0600 and in the user's own backup. Never in chat, never in the session transcript, never in an LLM request.
299
- 4. **QR pairing crypto** — gateway ephemeral x25519 keypair; browser derives shared secret and encrypts the phrase with ChaCha20-Poly1305 before upload. Gateway private key never leaves disk.
300
-
301
- ### What NOT to do
302
-
303
- - Do NOT write facts or preferences to `MEMORY.md`. TotalReclaw handles all memory storage with E2EE; cleartext files defeat the encryption guarantee.
304
- - Do NOT call `totalreclaw_remember` for temporary or in-session context.
305
- - Do NOT paste recovery phrases or API keys into chat replies to "help" the user — that echoes them into the LLM log.
306
-
307
- ---
308
-
309
- ## Memory Types (v1 Taxonomy)
310
-
311
- TotalReclaw v1 uses six canonical types:
312
-
313
- | Type | Description | Example |
314
- |------|-------------|---------|
315
- | claim | Objective assertion about the user / world | "Lives in Lisbon, Portugal" |
316
- | preference | Likes, dislikes, choices | "Prefers dark mode in all applications" |
317
- | directive | Instruction the user gave to remember / enforce | "Always use TypeScript for new projects" |
318
- | commitment | Promise or commitment the user made | "Will deploy v1 to mainnet by end of Q1" |
319
- | episode | Notable event or experience | "Deployed v1.0 to production on March 15" |
320
- | summary | Key outcomes from discussions | "Agreed to use phased rollout for mainnet migration" |
321
-
322
- The extraction LLM auto-selects the type. Use `totalreclaw_retype` if you detect a classification error.
323
-
324
- ---
325
-
326
- ## Troubleshooting
327
-
328
- - **`plugins.allow is empty`** — OpenClaw warning, not a TotalReclaw bug. Either add the plugin to your allowlist or ignore it; TotalReclaw still works.
329
- - **`TotalReclaw extraction LLM: not configured`** at startup — auto-extraction is disabled because no provider key was found. Configure a provider in `~/.openclaw/agents/<agent>/agent/auth-profiles.json`, or set `plugins.entries.totalreclaw.config.extraction.llm.{provider,apiKey}`. Manual `totalreclaw_remember` still works.
330
- - **Tool call returns "onboarding required"** — run `openclaw totalreclaw onboard` on the host, OR `openclaw totalreclaw pair generate` if the gateway is remote.
331
- - **`invalid config: must NOT have additional properties`** — your config references a key the plugin doesn't accept. The 3.3.1 schema is listed above; earlier schemas rejected `publicUrl` and most `extraction.*` keys (fixed in 3.3.1).
332
- - **Routes return 404 after `plugins install`** — you need to restart the gateway. `openclaw restart` or `docker restart openclaw-qa`.
333
-
334
- ---
67
+ ## Diagnostics
335
68
 
336
- ## Plugin architecture (informational)
69
+ - `totalreclaw_*` tools not visible → plugin not installed or gateway not restarted. Verify via `openclaw plugins list | grep totalreclaw`. If listed, ask the user to restart the gateway.
70
+ - User says done but `credentials.json` missing → PIN expired or entered wrong phrase; call `totalreclaw_pair` again.
71
+ - `onboarding required` → credentials missing; redo from the pair step.
72
+ - `quota exceeded` → `totalreclaw_status`, then offer `totalreclaw_upgrade`.
73
+ - `No LLM available for auto-extraction` at startup → provider key unreachable; check `~/.openclaw/agents/<agent>/agent/auth-profiles.json` or plugin config `extraction.llm`.
337
74
 
338
- - `index.ts` — plugin entry; registers tools, hooks, CLI, HTTP routes, and the slash command `/totalreclaw`.
339
- - `llm-client.ts` + `llm-profile-reader.ts` — LLM auto-resolution cascade (3.3.1).
340
- - `gateway-url.ts` — Tailscale / LAN host autodetect for pairing URLs.
341
- - `pair-http.ts` — `/plugin/totalreclaw/pair/{finish,start,respond,status}` HTTP routes.
342
- - `pair-cli.ts` — `openclaw totalreclaw pair [generate|import]` CLI, with `--json` and `--timeout` in 3.3.1.
343
- - `onboarding-cli.ts` — `openclaw totalreclaw onboard` CLI, with `--non-interactive / --json / --mode / --phrase / --emit-phrase` in 3.3.1.
344
- - `config.ts` — centralized env-var reads (keeps scanner surface clean).
75
+ ## Tool surface
345
76
 
346
- See `CHANGELOG.md` for the per-release fix history.
77
+ `totalreclaw_pair` (ONLY setup path) · `_remember` · `_recall` · `_forget` · `_pin` · `_unpin` · `_retype` · `_set_scope` · `_export` · `_status` · `_upgrade` · `_migrate` · `_import_from` · `_import_batch` · `_consolidate` · `_onboarding_start` (pointer to local-terminal wizard, for users explicitly rejecting the browser flow) · `_report_qa_bug` (RC only).
package/config.ts CHANGED
@@ -157,6 +157,37 @@ export const CONFIG = {
157
157
  cerebras: process.env.CEREBRAS_API_KEY || '',
158
158
  } as Record<string, string>,
159
159
 
160
+ // 3.3.1-rc.3: zai base-URL override. Read via a getter so tests can
161
+ // mutate `process.env.ZAI_BASE_URL` between calls — the value is NOT
162
+ // frozen at module load. Default is the coding endpoint; the rc.3
163
+ // auto-fallback flips to the standard endpoint on an "Insufficient
164
+ // balance" 429.
165
+ get zaiBaseUrl(): string {
166
+ const override = process.env.ZAI_BASE_URL;
167
+ if (override && override.trim()) return override.trim().replace(/\/+$/, '');
168
+ return 'https://api.z.ai/api/coding/paas/v4';
169
+ },
170
+
171
+ // 3.3.1-rc.3: retry budget for chatCompletion. Default 60s covers
172
+ // multi-minute upstream outages. Read as a plain value (not getter)
173
+ // so tests that patch env need to reload the module — but the default
174
+ // suffices for production.
175
+ llmRetryBudgetMs: (() => {
176
+ const raw = process.env.TOTALRECLAW_LLM_RETRY_BUDGET_MS;
177
+ const parsed = raw ? parseInt(raw, 10) : NaN;
178
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 60_000;
179
+ })(),
180
+
181
+ // 3.3.1-rc.3: GitHub personal-access token used by the RC-gated
182
+ // `totalreclaw_report_qa_bug` tool. `TOTALRECLAW_QA_GITHUB_TOKEN` is
183
+ // the dedicated variable; `GITHUB_TOKEN` is a fallback for CI-style
184
+ // setups where the same token is shared across tools. Read via getter
185
+ // so operators can set the var after the process starts (e.g. via a
186
+ // dotenv reload) and the next tool call picks it up.
187
+ get qaGithubToken(): string {
188
+ return process.env.TOTALRECLAW_QA_GITHUB_TOKEN || process.env.GITHUB_TOKEN || '';
189
+ },
190
+
160
191
  // Paths
161
192
  home,
162
193
  billingCachePath: path.join(home, '.totalreclaw', 'billing-cache.json'),