Skip to content

Commit 05e881d

Browse files
authored
Merge pull request #8 from xhd0728/main
feat: update clawxmemory plugin
2 parents 0439ce8 + c0a587d commit 05e881d

25 files changed

Lines changed: 5696 additions & 280 deletions
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: memory-dream-review
3+
description: Review ClawXMemory memory quality with a read-only Dream pass over recent L1, linked project memories, and the global profile.
4+
homepage: https://github.com/OpenBMB/ClawXMemory/tree/main/clawxmemory
5+
metadata:
6+
{
7+
"openclaw":
8+
{
9+
"skillKey": "openbmb-clawxmemory",
10+
"requires": { "config": ["plugins.entries.openbmb-clawxmemory.enabled"] },
11+
},
12+
}
13+
---
14+
15+
# Memory Dream Review
16+
17+
Use this skill when the user asks to audit memory quality, clean up duplicate project memories, inspect profile drift, or decide what should be promoted into longer-term memory.
18+
19+
## Primary Path
20+
21+
1. Call `memory_dream_review`, usually with `focus: "all"`.
22+
2. Report findings in this order:
23+
- `projectRebuild`
24+
- `cleanup`
25+
- `profileSuggestions`
26+
- `ambiguous`
27+
- `noAction`
28+
- `timeLayerNotes`
29+
3. State clearly that Dream review is read-only and no memory records were modified.
30+
4. Only call `memory_get` if the user asks to inspect one specific finding in detail.
31+
32+
## Focus Guidance
33+
34+
- Project cleanup or duplicate project summaries:
35+
use `memory_dream_review({ focus: "projects" })`
36+
- Profile drift or promotion questions:
37+
use `memory_dream_review({ focus: "profile" })`
38+
- Mixed governance review:
39+
use `memory_dream_review({ focus: "all" })`
40+
41+
## Guardrails
42+
43+
- Do not imply that Dream already rewrote L2 or profile memory.
44+
- Treat `timeLayerNotes` as integrity observations only, not rewrite instructions.
45+
- Prefer citing the returned `evidenceRefs` instead of guessing where a finding came from.

extensions/openbmb-clawxmemory/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@sinclair/typebox": "^0.34.41"
5858
},
5959
"devDependencies": {
60-
"openclaw": "^2026.3.31",
60+
"openclaw": "^2026.3.28",
6161
"vitest": "^4.0.5"
6262
},
6363
"peerDependencies": {

extensions/openbmb-clawxmemory/skills/context-template.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ enoughAt={{enoughAt}}
55

66
{{profileBlock}}
77

8+
{{evidenceNoteBlock}}
9+
810
{{l2Block}}
911

1012
{{l1Block}}

extensions/openbmb-clawxmemory/src/config.ts

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export interface PluginRuntimeConfig {
1111
maxMessageChars: number;
1212
heartbeatBatchSize: number;
1313
autoIndexIntervalMinutes: number;
14+
autoDreamIntervalMinutes: number;
15+
autoDreamMinNewL1: number;
1416
indexIdleDebounceMs: number;
1517
defaultIndexingSettings: IndexingSettings;
1618
recallEnabled: boolean;
@@ -58,11 +60,23 @@ export const pluginConfigJsonSchema = {
5860
type: "integer",
5961
default: 60,
6062
},
63+
autoDreamIntervalMinutes: {
64+
type: "integer",
65+
default: 360,
66+
},
67+
autoDreamMinNewL1: {
68+
type: "integer",
69+
default: 10,
70+
},
6171
reasoningMode: {
6272
type: "string",
6373
enum: ["answer_first", "accuracy_first"],
6474
default: "answer_first",
6575
},
76+
recallTopK: {
77+
type: "integer",
78+
default: 10,
79+
},
6680
maxAutoReplyLatencyMs: {
6781
type: "integer",
6882
default: 1800,
@@ -127,12 +141,24 @@ export const pluginConfigUiHints = {
127141
label: "Auto Index Interval",
128142
placeholder: "60",
129143
},
144+
autoDreamIntervalMinutes: {
145+
label: "Auto Dream Interval",
146+
placeholder: "360",
147+
},
148+
autoDreamMinNewL1: {
149+
label: "Auto Dream L1 Threshold",
150+
placeholder: "10",
151+
},
130152
reasoningMode: {
131153
label: "Reasoning Mode",
132-
help: "answer_first stops when reply latency budget is about to run out; accuracy_first prefers full recursive memory retrieval.",
154+
help: "answer_first stops at L2 evidence notes; accuracy_first can continue down to L1 and L0.",
155+
},
156+
recallTopK: {
157+
label: "Recall Top K",
158+
placeholder: "10",
133159
},
134160
maxAutoReplyLatencyMs: {
135-
label: "Max Auto Reply Latency (ms)",
161+
label: "Legacy Max Auto Reply Latency (ms)",
136162
placeholder: "1800",
137163
},
138164
uiEnabled: {
@@ -186,16 +212,12 @@ export function buildPluginConfig(raw: unknown): PluginRuntimeConfig {
186212
const skillsDir =
187213
typeof cfg.skillsDir === "string" && cfg.skillsDir.trim() ? cfg.skillsDir : undefined;
188214

189-
const configuredLatency =
190-
typeof cfg.maxAutoReplyLatencyMs === "number" && Number.isFinite(cfg.maxAutoReplyLatencyMs)
191-
? Math.floor(cfg.maxAutoReplyLatencyMs)
192-
: typeof cfg.maxAutoReplyLatencyMs === "string" && cfg.maxAutoReplyLatencyMs.trim()
193-
? Number.parseInt(cfg.maxAutoReplyLatencyMs, 10)
194-
: typeof cfg.recallBudgetMs === "number" && Number.isFinite(cfg.recallBudgetMs)
195-
? Math.floor(cfg.recallBudgetMs)
196-
: typeof cfg.recallBudgetMs === "string" && cfg.recallBudgetMs.trim()
197-
? Number.parseInt(cfg.recallBudgetMs, 10)
198-
: 1800;
215+
const configuredRecallTopK =
216+
typeof cfg.recallTopK === "number" && Number.isFinite(cfg.recallTopK)
217+
? Math.floor(cfg.recallTopK)
218+
: typeof cfg.recallTopK === "string" && cfg.recallTopK.trim()
219+
? Number.parseInt(cfg.recallTopK, 10)
220+
: 10;
199221
const captureStrategy = cfg.captureStrategy === "last_turn" ? "last_turn" : "full_session";
200222
const runtime: PluginRuntimeConfig = {
201223
dataDir,
@@ -205,13 +227,18 @@ export function buildPluginConfig(raw: unknown): PluginRuntimeConfig {
205227
maxMessageChars: toInteger(cfg.maxMessageChars, 6000),
206228
heartbeatBatchSize: Math.max(1, toInteger(cfg.heartbeatBatchSize, 30)),
207229
autoIndexIntervalMinutes: Math.max(0, toInteger(cfg.autoIndexIntervalMinutes, 60)),
230+
autoDreamIntervalMinutes: Math.max(0, toInteger(cfg.autoDreamIntervalMinutes, 360)),
231+
autoDreamMinNewL1: Math.max(0, toInteger(cfg.autoDreamMinNewL1, 10)),
208232
indexIdleDebounceMs: Math.max(200, toInteger(cfg.indexIdleDebounceMs, 2500)),
209233
defaultIndexingSettings: {
210234
reasoningMode: cfg.reasoningMode === "accuracy_first" ? "accuracy_first" : "answer_first",
211-
maxAutoReplyLatencyMs: Math.max(
212-
300,
213-
Number.isFinite(configuredLatency) ? configuredLatency : 1800,
235+
recallTopK: Math.max(
236+
1,
237+
Math.min(50, Number.isFinite(configuredRecallTopK) ? configuredRecallTopK : 10),
214238
),
239+
autoIndexIntervalMinutes: Math.max(0, toInteger(cfg.autoIndexIntervalMinutes, 60)),
240+
autoDreamIntervalMinutes: Math.max(0, toInteger(cfg.autoDreamIntervalMinutes, 360)),
241+
autoDreamMinNewL1: Math.max(0, toInteger(cfg.autoDreamMinNewL1, 10)),
215242
},
216243
recallEnabled: toBoolean(cfg.recallEnabled, true),
217244
addEnabled: toBoolean(cfg.addEnabled, true),

extensions/openbmb-clawxmemory/src/hooks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export function registerMemoryHooks(api: OpenClawPluginApi, runtime: MemoryPlugi
5050
if (!api.on) return;
5151

5252
api.on("before_prompt_build", runtime.handleBeforePromptBuild, { priority: 60 });
53+
api.on("before_tool_call", runtime.handleBeforeToolCall, { priority: 60 });
54+
api.on("after_tool_call", runtime.handleAfterToolCall);
5355
api.on("before_message_write", runtime.handleBeforeMessageWrite, { priority: 80 });
5456
api.on("agent_end", runtime.handleAgentEnd);
5557
api.on("before_reset", runtime.handleBeforeReset);

0 commit comments

Comments
 (0)