@nowledge/openclaw-nowledge-mem 0.6.5 → 0.6.8

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
@@ -2,14 +2,65 @@
2
2
 
3
3
  All notable changes to the Nowledge Mem OpenClaw plugin will be documented in this file.
4
4
 
5
+ ## [0.6.8] - 2026-02-27
6
+
7
+ ### Changed
8
+
9
+ - **Config priority flipped**: `~/.nowledge-mem/openclaw.json` now takes priority over OpenClaw plugin settings. Most users configure via OpenClaw UI (no file needed). Users who create the file get predictable overrides.
10
+ - **No auto-created config file**: The plugin no longer creates `~/.nowledge-mem/openclaw.json` on first startup. OpenClaw's settings UI works out of the box. Create the file manually when you need persistent or scripted config.
11
+ - **Status tool shows config sources**: `nowledge_mem_status` now shows where each setting comes from (`file`, `pluginConfig`, `env`, or `default`).
12
+
13
+ ### Fixed
14
+
15
+ - **configSchema broke OpenClaw form UI**: `additionalProperties: true` (added in 0.6.7) caused OpenClaw's config form to show "Unsupported schema mode. Use Raw mode." Removed the field entirely - JSON Schema defaults to allowing additional properties when omitted, so typos still don't crash the plugin, and the form renders normally.
16
+
17
+ ## [0.6.7] - 2026-02-27
18
+
19
+ ### Added
20
+
21
+ - `nowledge_mem_status` tool: verify effective config, backend connectivity, and version. Shows mode (local/remote), whether API key is set, backend health, and all config values. 10 tools total.
22
+
23
+ ### Fixed
24
+
25
+ - **configSchema too strict**: `additionalProperties` changed from `false` to `true`. Previously, a typo in openclaw.json config (e.g. `sesionContext`) caused the plugin to silently fail to load. Now OpenClaw passes validation and the plugin's own parser gives a descriptive error listing valid keys.
26
+ - **apiUrl port typo**: configSchema description had port 14142 instead of 14242.
27
+
28
+ ## [0.6.6] - 2026-02-27
29
+
30
+ ### Changed - Config file + env var cascade
31
+
32
+ **Config file at `~/.nowledge-mem/openclaw.json`**
33
+
34
+ The plugin now reads configuration from a dedicated config file, independent of OpenClaw's `openclaw.json`. The file is auto-created on first startup with sensible defaults. If you had settings in OpenClaw's plugin config, those values are automatically seeded into the file on first run. No manual steps needed.
35
+
36
+ This gives you a single, easy-to-find place for all Nowledge Mem settings. The file persists across plugin reinstalls and OpenClaw upgrades.
37
+
38
+ **Config cascade** (4 layers, highest to lowest priority):
39
+ 1. `api.pluginConfig` - from OpenClaw's plugin config (when supported)
40
+ 2. `~/.nowledge-mem/openclaw.json` - dedicated config file
41
+ 3. Environment variables - `NMEM_SESSION_CONTEXT`, `NMEM_SESSION_DIGEST`, etc.
42
+ 4. Built-in defaults
43
+
44
+ ### Fixed
45
+
46
+ - **Conversation text unbounded**: `buildConversationText()` now caps per-message content at 2000 chars and total at 30K chars, preventing oversized LLM API payloads from long coding sessions
47
+ - **Config strict mode**: unknown config keys throw a descriptive error listing all valid keys
48
+ - **apiKey not written to config file**: API keys are intentionally excluded from the auto-created config file. They should stay in env vars or OpenClaw's secure config
49
+
50
+ ### Added
51
+
52
+ - Environment variable support for all config keys (not just `apiUrl`/`apiKey`)
53
+ - Migration: first-run config file seeded from existing `pluginConfig` values
54
+ - `isDefaultApiUrl()` helper exported for local-vs-remote detection
55
+
5
56
  ## [0.6.5] - 2026-02-26
6
57
 
7
- ### Added — Thread tools + sourceThreadId linkage
58
+ ### Added - Thread tools + sourceThreadId linkage
8
59
 
9
- **Two new tools for conversation retrieval.** The plugin now provides 9 tools total.
60
+ **Two new tools for conversation retrieval.**
10
61
 
11
- - `nowledge_mem_thread_search` — Search past conversations by keyword. Returns matched threads with message snippets and relevance scores. Use when the user asks about a past discussion or wants to find a specific conversation.
12
- - `nowledge_mem_thread_fetch` — Fetch full messages from a specific thread with pagination support. Use to progressively retrieve long conversations. Accepts `offset` and `limit` for paginated retrieval.
62
+ - `nowledge_mem_thread_search` - search past conversations by keyword. Returns matched threads with message snippets and relevance scores. Use when the user asks about a past discussion or wants to find a specific conversation.
63
+ - `nowledge_mem_thread_fetch` - fetch full messages from a specific thread with pagination support. Use to progressively retrieve long conversations. Accepts `offset` and `limit` for paginated retrieval.
13
64
 
14
65
  **Memories now link back to their source conversations.**
15
66
 
@@ -17,28 +68,28 @@ Every memory distilled from a conversation now includes `sourceThreadId` in sear
17
68
 
18
69
  **New client methods:**
19
70
 
20
- - `client.searchThreadsFull(query, { limit, source })` — Full-featured thread search (throws on error, supports source filter). CLI-first with API fallback.
21
- - `client.fetchThread(threadId, { offset, limit })` — Fetch messages from a thread with pagination. CLI-first with API fallback.
71
+ - `client.searchThreadsFull(query, { limit, source })` - full-featured thread search (throws on error, supports source filter). CLI-first with API fallback.
72
+ - `client.fetchThread(threadId, { offset, limit })` - fetch messages from a thread with pagination. CLI-first with API fallback.
22
73
 
23
74
  **Save deduplication.**
24
75
 
25
- Before saving, the plugin checks for near-identical existing memories (≥90% similarity). If a match is found, the save is skipped and the existing memory is returned — preventing obvious duplicates at the plugin level. Deeper semantic dedup is handled by the Knowledge Agent's EVOLVES chains in the background.
76
+ Before saving, the plugin checks for near-identical existing memories (>=90% similarity). If a match is found, the save is skipped and the existing memory is returned, preventing obvious duplicates at the plugin level. Deeper semantic dedup is handled by the Knowledge Agent's EVOLVES chains in the background.
26
77
 
27
78
  **Context-aware behavioral guidance.**
28
79
 
29
- The always-on hook now tells the agent about `nowledge_mem_thread_fetch` for following up on `sourceThreadId` links. When `sessionContext` is enabled, the guidance adjusts to note that relevant memories have already been injected — reducing redundant `memory_search` calls.
80
+ The always-on hook now tells the agent about `nowledge_mem_thread_fetch` for following up on `sourceThreadId` links. When `sessionContext` is enabled, the guidance adjusts to note that relevant memories have already been injected, reducing redundant `memory_search` calls.
30
81
 
31
82
  ## [0.6.4] - 2026-02-26
32
83
 
33
- ### Changed — Thread search enrichment + sessionDigest default on
84
+ ### Changed - Thread search enrichment + sessionDigest default on
34
85
 
35
86
  **`memory_search` now includes relevant conversation threads.**
36
87
 
37
- When you search memories, the response now also includes `relatedThreads` — snippets from past conversations that match the query. This uses the backend's BM25 thread search (`GET /threads/search`). Thread search is best-effort: if it fails or returns nothing, the memory results are returned as before. No new tool for the agent to learn — thread context surfaces automatically alongside memories.
88
+ When you search memories, the response now also includes `relatedThreads` - snippets from past conversations that match the query. This uses the backend's BM25 thread search (`GET /threads/search`). Thread search is best-effort: if it fails or returns nothing, the memory results are returned as before. No new tool for the agent to learn. Thread context surfaces automatically alongside memories.
38
89
 
39
90
  **`sessionDigest` now defaults to `true`.**
40
91
 
41
- Previously, session digest (thread capture + LLM distillation at session end) was off by default. The cost is negligible — one lightweight triage call per session end, full distillation only when worthwhile. With this change, conversations are captured and distilled automatically out of the box. Users who explicitly set `sessionDigest: false` are unaffected.
92
+ Previously, session digest (thread capture + LLM distillation at session end) was off by default. The cost is negligible: one lightweight triage call per session end, full distillation only when worthwhile. Conversations are now captured and distilled automatically out of the box. Users who explicitly set `sessionDigest: false` are unaffected.
42
93
 
43
94
  **Behavioral hook updated.**
44
95
 
@@ -46,12 +97,12 @@ The always-on guidance now mentions that `memory_search` returns conversation sn
46
97
 
47
98
  ### Added
48
99
 
49
- - `client.searchThreads(query, limit)` — calls `GET /threads/search` API. Returns top matching threads with message snippets and relevance scores. Best-effort: never throws.
100
+ - `client.searchThreads(query, limit)` - calls `GET /threads/search` API. Returns top matching threads with message snippets and relevance scores. Best-effort: never throws.
50
101
  - Version bumped to 0.6.4.
51
102
 
52
103
  ## [0.4.0] - 2026-02-26
53
104
 
54
- ### Changed — Rename config + always-on behavioral guidance
105
+ ### Changed - Rename config + always-on behavioral guidance
55
106
 
56
107
  **Renamed config options** (old names still work as silent aliases):
57
108
 
@@ -62,30 +113,30 @@ The always-on guidance now mentions that `memory_search` returns conversation sn
62
113
  | `captureMinInterval` | `digestMinInterval` |
63
114
  | `maxRecallResults` | `maxContextResults` |
64
115
 
65
- Existing configs with old names continue to work — aliases are resolved transparently in `parseConfig()`. New names take precedence if both are present.
116
+ Existing configs with old names continue to work. Aliases are resolved transparently in `parseConfig()`. New names take precedence if both are present.
66
117
 
67
118
  **Added: Always-on behavioral hook**
68
119
 
69
- The agent now receives brief behavioral guidance (~50 tokens) on every turn via `before_prompt_build`, telling it to proactively save and search. This fires in ALL modes, including tool-only (default). Previously, without `sessionContext` enabled, the agent had no system-level instruction to use memory tools — most LLMs ignored the "call proactively" hints in tool descriptions. This is the single most impactful change for memory adoption.
120
+ The agent now receives brief behavioral guidance (~50 tokens) on every turn via `before_prompt_build`, telling it to proactively save and search. This fires in ALL modes, including tool-only (default). Previously, without `sessionContext` enabled, the agent had no system-level instruction to use memory tools. Most LLMs ignored the "call proactively" hints in tool descriptions. This is the single most impactful change for memory adoption.
70
121
 
71
122
  **Migrated: `before_prompt_build` for session context**
72
123
 
73
- Session context injection (formerly "autoRecall") now uses the modern `before_prompt_build` hook instead of legacy `before_agent_start`. Both the behavioral hook and session context coexist — OpenClaw concatenates multiple `prependContext` values with `\n\n`.
124
+ Session context injection (formerly "autoRecall") now uses the modern `before_prompt_build` hook instead of legacy `before_agent_start`. Both the behavioral hook and session context coexist. OpenClaw concatenates multiple `prependContext` values with `\n\n`.
74
125
 
75
126
  ## [0.3.0] - 2026-02-23
76
127
 
77
- ### Changed — Architecture overhaul: tool-first, LLM-based capture
128
+ ### Changed - Architecture overhaul: tool-first, LLM-based capture
78
129
 
79
130
  **Breaking: `autoRecall` now defaults to `false`**
80
131
 
81
- The agent has full access to all 7 tools regardless of this setting. Tool-only mode (both `autoRecall` and `autoCapture` off) is now the recommended default. The agent calls `memory_search`, `nowledge_mem_save`, etc. on demand — no tokens wasted on irrelevant context injection.
132
+ The agent has full access to all 7 tools regardless of this setting. Tool-only mode (both `autoRecall` and `autoCapture` off) is now the recommended default. The agent calls `memory_search`, `nowledge_mem_save`, etc. on demand. No tokens wasted on irrelevant context injection.
82
133
 
83
134
  Users who explicitly set `autoRecall: true` are unaffected.
84
135
 
85
136
  **Removed: English-only heuristic capture**
86
137
 
87
138
  The entire rule-based capture pipeline has been removed:
88
- - `shouldCaptureAsMemory()` — English-only regex patterns (`/\bi (like|prefer|hate)\b/i`)
139
+ - `shouldCaptureAsMemory()` - English-only regex patterns (`/\bi (like|prefer|hate)\b/i`)
89
140
  - `MEMORY_TRIGGER_PATTERNS`, `PROMPT_INJECTION_PATTERNS`
90
141
  - `looksLikeQuestion()`, `hasMemoryTrigger()`, `looksLikePromptInjection()`
91
142
  - `fingerprint()`, per-session dedup map
@@ -96,9 +147,9 @@ These were fundamentally broken for non-English users (~95% of the world) and vi
96
147
 
97
148
  Replaced heuristics with a proper LLM-based pipeline:
98
149
 
99
- 1. **Thread capture** (unconditional, unchanged) — full conversation appended to persistent thread
100
- 2. **Triage** (cheap, fast) — lightweight LLM call (~50 output tokens) determines if conversation contains save-worthy content. Language-agnostic. New backend endpoint: `POST /memories/distill/triage`
101
- 3. **Distillation** (only when worthwhile) — full LLM extraction via existing `POST /memories/distill`, creating structured memories with proper unit_type, labels, and temporal data
150
+ 1. **Thread capture** (unconditional, unchanged) - full conversation appended to persistent thread
151
+ 2. **Triage** (cheap, fast) - lightweight LLM call (~50 output tokens) determines if conversation contains save-worthy content. Language-agnostic. New backend endpoint: `POST /memories/distill/triage`
152
+ 3. **Distillation** (only when worthwhile) - full LLM extraction via existing `POST /memories/distill`, creating structured memories with proper unit_type, labels, and temporal data
102
153
 
103
154
  Cost: negligible for conversations without save-worthy content (triage only). Moderate for rich conversations (triage + distill). Works in any language.
104
155
 
@@ -108,17 +159,17 @@ More directive description for tool-only mode: tells the agent when to proactive
108
159
 
109
160
  **Migrated: `before_prompt_build` hook**
110
161
 
111
- Auto-recall hook migrated from legacy `before_agent_start` to modern `before_prompt_build` API. Trimmed verbose tool guidance — the agent already sees tool descriptions in its tool list.
162
+ Auto-recall hook migrated from legacy `before_agent_start` to modern `before_prompt_build` API. Trimmed verbose tool guidance. The agent already sees tool descriptions in its tool list.
112
163
 
113
164
  ### Added
114
165
 
115
- - `client.triageConversation(content)` — calls `POST /memories/distill/triage`
116
- - `client.distillThread({ threadId, title, content })` — calls `POST /memories/distill`
166
+ - `client.triageConversation(content)` - calls `POST /memories/distill/triage`
167
+ - `client.distillThread({ threadId, title, content })` - calls `POST /memories/distill`
117
168
  - Backend `POST /memories/distill/triage` endpoint with lightweight LLM triage prompt
118
169
 
119
170
  ## [0.2.7] - 2026-02-18
120
171
 
121
- ### Added — Gap closures: date range, EVOLVES CLI, WM section edit
172
+ ### Added - Gap closures: date range, EVOLVES CLI, WM section edit
122
173
 
123
174
  **Feed date range filtering**
124
175
 
@@ -129,82 +180,82 @@ Auto-recall hook migrated from legacy `before_agent_start` to modern `before_pro
129
180
 
130
181
  **EVOLVES version chain via CLI**
131
182
 
132
- - `nmem g evolves <id>` — new CLI command showing the full EVOLVES chain for a memory (replaces/enriches/confirms/challenges relations).
133
- - `client.graphEvolves()` — new client method using `nmem g evolves`; falls back to `GET /agent/evolves?memory_id=<id>`.
183
+ - `nmem g evolves <id>` - new CLI command showing the full EVOLVES chain for a memory (replaces/enriches/confirms/challenges relations).
184
+ - `client.graphEvolves()` - new client method using `nmem g evolves`; falls back to `GET /agent/evolves?memory_id=<id>`.
134
185
  - `connections.js` now uses `client.graphEvolves()` instead of a raw API call. "Knowledge evolution" section now correctly shows direction (→ newer / ← older) relative to the queried memory.
135
186
  - Backend `GET /agent/evolves` now accepts `memory_id` query param to filter edges for a specific memory.
136
187
 
137
188
  **Working Memory section-level edit**
138
189
 
139
- - `nmem wm patch --heading "## Notes" --content/--append` — new CLI subcommand. Does client-side read-modify-write: reads WM, patches just the target section, writes the full doc back.
140
- - `client.patchWorkingMemory(heading, { content, append })` — new client method.
190
+ - `nmem wm patch --heading "## Notes" --content/--append` - new CLI subcommand. Does client-side read-modify-write: reads WM, patches just the target section, writes the full doc back.
191
+ - `client.patchWorkingMemory(heading, { content, append })` - new client method.
141
192
  - `nowledge_mem_context` now supports optional `patch_section` + `patch_content`/`patch_append` parameters. An agent can now update one section of Working Memory without destroying the rest.
142
193
  - Includes a JS `patchWmSection()` helper in `client.js` for the API fallback path (for CLI versions that predate `wm patch`).
143
194
 
144
195
  ## [0.2.6] - 2026-02-18
145
196
 
146
- ### Added — Rich save: labels, event_start, temporal_context, unit_type fixed
197
+ ### Added - Rich save: labels, event_start, temporal_context, unit_type fixed
147
198
 
148
199
  ## [0.2.5] - 2026-02-18
149
200
 
150
- ### Added — Remote mode configuration
201
+ ### Added - Remote mode configuration
151
202
 
152
203
  - `apiUrl` config option: set to your remote server URL to use Nowledge Mem across devices or in a team. Leave empty for local mode (default: `http://127.0.0.1:14242`).
153
- - `apiKey` config option: API key for remote access. Marked `"secret": true` in uiHints so OpenClaw can mask it in the UI. **Never logged, never passed as a CLI argument** — injected as `NMEM_API_KEY` env var into child processes only.
204
+ - `apiKey` config option: API key for remote access. Marked `"secret": true` in uiHints so OpenClaw can mask it in the UI. **Never logged, never passed as a CLI argument.** Injected as `NMEM_API_KEY` env var into child processes only.
154
205
  - `NowledgeMemClient` now accepts `{ apiUrl, apiKey }` credentials at construction time. Both config values and `NMEM_API_URL` / `NMEM_API_KEY` env vars are supported; plugin config wins over env vars.
155
206
  - Initialization log now shows `mode=remote → https://...` vs `mode=local` (key never appears in logs).
156
207
  - `_spawnEnv()` helper: builds per-spawn env with credentials injected; `_apiUrlArgs()` adds `--api-url` flag only when not local.
157
208
 
158
209
  ## [0.2.4] - 2026-02-18
159
210
 
160
- ### Changed — CLI-first architecture
211
+ ### Changed - CLI-first architecture
161
212
 
162
213
  All operations now go through the `nmem` CLI instead of direct API calls.
163
214
  This is a structural alignment that makes every feature work in remote mode
164
215
  (`NMEM_API_URL` + `NMEM_API_KEY`) without any plugin changes.
165
216
 
166
- - `client.graphExpand()` — uses `nmem g expand <id>`; falls back to API on older CLI
167
- - `client.feedEvents()` — uses `nmem f`; falls back to API on older CLI
168
- - `client.search()` — CLI now returns `relevance_reason`, `importance`, `labels`,
217
+ - `client.graphExpand()` - uses `nmem g expand <id>`; falls back to API on older CLI
218
+ - `client.feedEvents()` - uses `nmem f`; falls back to API on older CLI
219
+ - `client.search()` - CLI now returns `relevance_reason`, `importance`, `labels`,
169
220
  temporal fields natively; `searchRich()` is now an alias for `search()`
170
- - `client.searchTemporal()` — uses `nmem m search --event-from/--recorded-from`
221
+ - `client.searchTemporal()` - uses `nmem m search --event-from/--recorded-from`
171
222
  CLI args; falls back to API if CLI is pre-bi-temporal-update
172
- - `client._normalizeMemory()` — canonical memory shape shared across all search paths
223
+ - `client._normalizeMemory()` - canonical memory shape shared across all search paths
173
224
  - Removed `client.apiJson()` usage in `connections.js` and `timeline.js`
174
225
  - `connections.js`: `client.apiJson()` retained only for the `/agent/evolves` chain
175
- (no CLI command for this yet — tracked as future improvement)
226
+ (no CLI command for this yet, tracked as future improvement)
176
227
 
177
228
  ## [0.2.3] - 2026-02-18
178
229
 
179
- ### Changed — Graph Transparency & Scoring Visibility
230
+ ### Changed - Graph Transparency & Scoring Visibility
180
231
 
181
232
  - `nowledge_mem_connections`: completely rewritten output format
182
- - Edges are now JOIN-ed to their target nodes — each connection shows its relationship type and strength
233
+ - Edges are now JOIN-ed to their target nodes. Each connection shows its relationship type and strength
183
234
  - Sections organized by edge type: "Synthesized from N source memories" (CRYSTALLIZED_FROM), "Knowledge evolution" (EVOLVES), "Sourced from document" (SOURCED_FROM), "Entities mentioned" (MENTIONS)
184
235
  - EVOLVES sub-relations are labeled: supersedes, enriches, confirms, challenges
185
236
  - Each connected memory includes its `id` for direct follow-up with `memory_get` or `nowledge_mem_connections`
186
- - `memory_search`: now always uses API path (`searchRich`) — returns `matchedVia` with scoring breakdown
237
+ - `memory_search`: now always uses API path (`searchRich`), returns `matchedVia` with scoring breakdown
187
238
  - e.g. `"matchedVia": "Text Match (100%) + Semantic Match (69%) | decay[imp:high]"`
188
239
  - Also returns `importance` per result
189
240
  - Response `mode` field updated to `"multi-signal"` to reflect actual behavior
190
- - `nowledge_mem_timeline`: timeline entries now include `(id: <memoryId>)` hint for events with linked memories — enables immediate chaining to `nowledge_mem_connections`
241
+ - `nowledge_mem_timeline`: timeline entries now include `(id: <memoryId>)` hint for events with linked memories, enables immediate chaining to `nowledge_mem_connections`
191
242
  - `nowledge_mem_timeline`: `event_type` filter values documented in tool description for model discoverability
192
- - Auto-recall hook: uses `searchRich` instead of CLI search — shows scoring breakdown in recalled context
243
+ - Auto-recall hook: uses `searchRich` instead of CLI search, shows scoring breakdown in recalled context
193
244
 
194
245
  ### Added
195
246
 
196
- - `client.searchRich()` — convenience wrapper for `searchTemporal` without temporal filters; always returns `relevanceReason`
247
+ - `client.searchRich()` - convenience wrapper for `searchTemporal` without temporal filters; always returns `relevanceReason`
197
248
 
198
249
  ## [0.2.2] - 2026-02-18
199
250
 
200
251
  ### Added
201
252
 
202
253
  - `memory_search` now supports bi-temporal filtering:
203
- - `event_date_from` / `event_date_to` — when the fact/event happened (YYYY, YYYY-MM, YYYY-MM-DD)
204
- - `recorded_date_from` / `recorded_date_to` — when the memory was saved to Nowledge Mem
254
+ - `event_date_from` / `event_date_to` - when the fact/event happened (YYYY, YYYY-MM, YYYY-MM-DD)
255
+ - `recorded_date_from` / `recorded_date_to` - when the memory was saved to Nowledge Mem
205
256
  - Uses API-direct path (`client.searchTemporal`) so it works regardless of installed CLI version
206
257
  - Results include `eventStart`, `eventEnd`, `temporalContext` when available
207
- - `client.searchTemporal()` — new method wrapping `/memories/search` bi-temporal API directly
258
+ - `client.searchTemporal()` - new method wrapping `/memories/search` bi-temporal API directly
208
259
 
209
260
  ## [0.2.1] - 2026-02-18
210
261
 
@@ -216,7 +267,7 @@ This is a structural alignment that makes every feature work in remote mode
216
267
 
217
268
  ## [0.2.0] - 2026-02-18
218
269
 
219
- ### Changed — Tool Set Redesign
270
+ ### Changed - Tool Set Redesign
220
271
 
221
272
  Redesigned from first principles around Nowledge Mem's v0.6 architecture.
222
273
  This version reflects our genuine strengths: knowledge graph, structured types,
@@ -224,9 +275,9 @@ Working Memory, and cross-AI continuity.
224
275
 
225
276
  ### Added
226
277
 
227
- - `nowledge_mem_save` tool: structured knowledge capture with `unit_type` parameter (fact, preference, decision, plan, procedure, learning, context, event) — replaces generic `nowledge_mem_store`
228
- - `nowledge_mem_context` tool: read today's Working Memory daily briefing — replaces `nowledge_mem_working_memory` with clearer naming
229
- - `nowledge_mem_connections` tool: explore knowledge graph around a topic — returns connected memories, EVOLVES chains, related entities, and Source document provenance (SOURCED_FROM edges from Library). This is our graph-native differentiator.
278
+ - `nowledge_mem_save` tool: structured knowledge capture with `unit_type` parameter (fact, preference, decision, plan, procedure, learning, context, event). Replaces generic `nowledge_mem_store`
279
+ - `nowledge_mem_context` tool: read today's Working Memory daily briefing. Replaces `nowledge_mem_working_memory` with clearer naming
280
+ - `nowledge_mem_connections` tool: explore knowledge graph around a topic. Returns connected memories, EVOLVES chains, related entities, and Source document provenance (SOURCED_FROM edges from Library). This is our graph-native differentiator.
230
281
  - `nowledge_mem_forget` tool: delete memories by ID or search query with confirmation flow
231
282
  - `/forget` slash command: quick memory deletion from chat
232
283
  - Capture quality gate: prompt injection detection, question filtering, memory-trigger pattern matching
package/CLAUDE.md CHANGED
@@ -1,4 +1,4 @@
1
- # CLAUDE.md — Nowledge Mem OpenClaw Plugin
1
+ # CLAUDE.md - Nowledge Mem OpenClaw Plugin
2
2
 
3
3
  Continuation guide for `community/nowledge-mem-openclaw-plugin`.
4
4
 
@@ -7,91 +7,103 @@ Continuation guide for `community/nowledge-mem-openclaw-plugin`.
7
7
  - Plugin target: OpenClaw plugin runtime (memory slot provider)
8
8
  - Runtime: JS ESM modules under `src/`, no TS build pipeline
9
9
  - Memory backend: `nmem` CLI (fallback: `uvx --from nmem-cli nmem`)
10
- - Architecture: **CLI-first** — all operations go through the nmem CLI, not direct API calls
11
- - Remote mode: set `NMEM_API_URL` + `NMEM_API_KEY` env vars or plugin config `apiUrl` + `apiKey`
10
+ - Architecture: **CLI-first** - all operations go through the nmem CLI, not direct API calls
11
+ - Remote mode: set `NMEM_API_URL` + `NMEM_API_KEY` env vars or config file `apiUrl` + `apiKey`
12
12
 
13
13
  ## Design Philosophy
14
14
 
15
15
  Reflects Nowledge Mem's genuine v0.6 strengths:
16
16
 
17
- 1. **Knowledge graph** — EVOLVES chains, entity relationships, typed memory connections
18
- 2. **Source provenance** — Library ingests docs/URLs; `SOURCED_FROM` edges trace knowledge origin
19
- 3. **Structured types** — 8 unit types: `fact | preference | decision | plan | procedure | learning | context | event`
20
- 4. **Working Memory** — daily evolving briefing; agents can patch sections without overwriting the whole document
21
- 5. **Cross-AI continuity** — "Your AI tools forget. We remember. Everywhere."
22
- 6. **Hybrid search** — BM25 + semantic + graph + decay, not vector-only
23
- 7. **Transparent scoring** — `relevance_reason` in every search result
17
+ 1. **Knowledge graph** - EVOLVES chains, entity relationships, typed memory connections
18
+ 2. **Source provenance** - Library ingests docs/URLs; `SOURCED_FROM` edges trace knowledge origin
19
+ 3. **Structured types** - 8 unit types: `fact | preference | decision | plan | procedure | learning | context | event`
20
+ 4. **Working Memory** - daily evolving briefing; agents can patch sections without overwriting the whole document
21
+ 5. **Cross-AI continuity** - "Your AI tools forget. We remember. Everywhere."
22
+ 6. **Hybrid search** - BM25 + semantic + graph + decay, not vector-only
23
+ 7. **Transparent scoring** - `relevance_reason` in every search result
24
24
 
25
25
  ## Files That Matter
26
26
 
27
27
  ```
28
28
  src/
29
- index.js — plugin registration (tools, hooks, commands, CLI)
30
- client.js — CLI wrapper with API fallback; credential handling
31
- config.js — strict config parsing (apiUrl, apiKey, sessionContext, etc.)
29
+ index.js - plugin registration (tools, hooks, commands, CLI)
30
+ client.js - CLI wrapper with API fallback; credential handling
31
+ config.js - config cascade: ~/.nowledge-mem/openclaw.json > pluginConfig > env vars > defaults
32
32
  hooks/
33
- behavioral.js — always-on behavioral guidance (~50 tokens/turn)
34
- recall.js — before_prompt_build: inject Working Memory + recalled memories
35
- capture.js — thread capture + LLM triage/distillation at session lifecycle events
33
+ behavioral.js - always-on behavioral guidance (~50 tokens/turn)
34
+ recall.js - before_prompt_build: inject Working Memory + recalled memories
35
+ capture.js - thread capture + LLM triage/distillation at session lifecycle events
36
36
  tools/
37
- memory-search.js — OpenClaw compat; multi-signal; bi-temporal; relevance_reason; sourceThreadId
38
- memory-get.js — OpenClaw compat; supports MEMORY.md alias; sourceThreadId
39
- save.js — structured capture: unit_type, labels, temporal, importance; pre-save dedup check
40
- context.js — Working Memory daily briefing (read + section-level patch)
41
- connections.js — graph exploration: edge types, relationship strength, provenance
42
- timeline.js — activity feed: daily grouping, event_type filter, memoryId hints
43
- forget.js — memory deletion by ID or search
44
- thread-search.js — search past conversations by keyword
45
- thread-fetch.js — fetch full messages from a thread with pagination
46
- openclaw.plugin.json — manifest + config schema (version, uiHints, configSchema)
37
+ memory-search.js - OpenClaw compat; multi-signal; bi-temporal; relevance_reason; sourceThreadId
38
+ memory-get.js - OpenClaw compat; supports MEMORY.md alias; sourceThreadId
39
+ save.js - structured capture: unit_type, labels, temporal, importance; pre-save dedup check
40
+ context.js - Working Memory daily briefing (read + section-level patch)
41
+ connections.js - graph exploration: edge types, relationship strength, provenance
42
+ timeline.js - activity feed: daily grouping, event_type filter, memoryId hints
43
+ forget.js - memory deletion by ID or search
44
+ thread-search.js - search past conversations by keyword
45
+ thread-fetch.js - fetch full messages from a thread with pagination
46
+ openclaw.plugin.json - manifest + config schema (version, uiHints, configSchema)
47
+ ~/.nowledge-mem/openclaw.json - optional user config file (overrides OpenClaw settings when present)
47
48
  ```
48
49
 
49
- ## Tool Surface (9 tools)
50
+ ## Tool Surface (10 tools)
50
51
 
51
52
  ### OpenClaw Memory Slot (required for system prompt activation)
52
- - `memory_search` — multi-signal: BM25 + embedding + label + graph + decay. Returns `matchedVia` ("Text Match 100% + Semantic 69%"), `importance`, bi-temporal filters (`event_date_from/to`, `recorded_date_from/to`). Also returns `relatedThreads` (past conversation snippets matching the query) and `sourceThreadId` (link to source conversation). Mode: `"multi-signal"`.
53
- - `memory_get` — retrieve by `nowledgemem://memory/<id>` path or bare ID. `MEMORY.md` → Working Memory. Returns `sourceThreadId` when available.
53
+ - `memory_search` - multi-signal: BM25 + embedding + label + graph + decay. Returns `matchedVia` ("Text Match 100% + Semantic 69%"), `importance`, bi-temporal filters (`event_date_from/to`, `recorded_date_from/to`). Also returns `relatedThreads` (past conversation snippets matching the query) and `sourceThreadId` (link to source conversation). Mode: `"multi-signal"`.
54
+ - `memory_get` - retrieve by `nowledgemem://memory/<id>` path or bare ID. `MEMORY.md` → Working Memory. Returns `sourceThreadId` when available.
54
55
 
55
56
  ### Nowledge Mem Native (differentiators)
56
- - `nowledge_mem_save` — structured capture: `unit_type`, `labels[]`, `event_start`, `event_end`, `temporal_context`, `importance`. All fields wired to CLI and API.
57
- - `nowledge_mem_context` — Working Memory daily briefing. Read-only by default; supports section-level patch via `patch_section` + `patch_content`/`patch_append` params (uses `nmem wm patch` client-side read-modify-write).
58
- - `nowledge_mem_connections` — graph exploration. Edges JOIN-ed to nodes by type: CRYSTALLIZED_FROM (crystal → source memories), EVOLVES (with sub-relations: supersedes/enriches/confirms/challenges), SOURCED_FROM (document provenance), MENTIONS (entities). Each connection shows strength % and memoryId.
59
- - `nowledge_mem_timeline` — activity feed via `nmem f`. Groups by day. `event_type` filter. Exact date range via `date_from`/`date_to` (YYYY-MM-DD). Entries include `(id: <memoryId>)` for chaining to connections.
60
- - `nowledge_mem_forget` — delete by ID or fuzzy query.
57
+ - `nowledge_mem_save` - structured capture: `unit_type`, `labels[]`, `event_start`, `event_end`, `temporal_context`, `importance`. All fields wired to CLI and API.
58
+ - `nowledge_mem_context` - Working Memory daily briefing. Read-only by default; supports section-level patch via `patch_section` + `patch_content`/`patch_append` params (uses `nmem wm patch` client-side read-modify-write).
59
+ - `nowledge_mem_connections` - graph exploration. Edges JOIN-ed to nodes by type: CRYSTALLIZED_FROM (crystal → source memories), EVOLVES (with sub-relations: supersedes/enriches/confirms/challenges), SOURCED_FROM (document provenance), MENTIONS (entities). Each connection shows strength % and memoryId.
60
+ - `nowledge_mem_timeline` - activity feed via `nmem f`. Groups by day. `event_type` filter. Exact date range via `date_from`/`date_to` (YYYY-MM-DD). Entries include `(id: <memoryId>)` for chaining to connections.
61
+ - `nowledge_mem_forget` - delete by ID or fuzzy query.
61
62
 
62
63
  ### Thread Tools (progressive conversation retrieval)
63
- - `nowledge_mem_thread_search` — search past conversations by keyword. Returns threads with matched message snippets, relevance scores, and message counts. Supports `source` filter.
64
- - `nowledge_mem_thread_fetch` — fetch full messages from a specific thread. Supports pagination via `offset` + `limit` for progressive retrieval of long conversations.
64
+ - `nowledge_mem_thread_search` - search past conversations by keyword. Returns threads with matched message snippets, relevance scores, and message counts. Supports `source` filter.
65
+ - `nowledge_mem_thread_fetch` - fetch full messages from a specific thread. Supports pagination via `offset` + `limit` for progressive retrieval of long conversations.
66
+
67
+ ### Diagnostics
68
+ - `nowledge_mem_status` - show effective config (mode, apiUrl, apiKey set, sessionContext, sessionDigest, etc.), backend connectivity, and version. No parameters.
65
69
 
66
70
  ## Hook Surface
67
71
 
68
- - `before_prompt_build` (always-on) — behavioral guidance: brief note telling agent to save/search proactively. Adjusts when sessionContext is on to avoid redundant searches.
69
- - `before_prompt_build` (sessionContext) — session context: Working Memory + `searchRich()` with `relevanceReason` in context
70
- - `agent_end` — thread capture + LLM triage/distillation (requires `sessionDigest: true`)
71
- - `after_compaction` — thread append
72
- - `before_reset` — thread append
72
+ - `before_prompt_build` (always-on) - behavioral guidance: brief note telling agent to save/search proactively. Adjusts when sessionContext is on to avoid redundant searches.
73
+ - `before_prompt_build` (sessionContext) - session context: Working Memory + `searchRich()` with `relevanceReason` in context
74
+ - `agent_end` - thread capture + LLM triage/distillation (requires `sessionDigest: true`)
75
+ - `after_compaction` - thread append
76
+ - `before_reset` - thread append
73
77
 
74
78
  ## Slash Commands
75
79
 
76
- - `/remember` — quick save
77
- - `/recall` — quick search
78
- - `/forget` — quick delete
80
+ - `/remember` - quick save
81
+ - `/recall` - quick search
82
+ - `/forget` - quick delete
79
83
 
80
84
  ## Config Keys
81
85
 
82
- | Key | Type | Default | Description |
83
- |-----|------|---------|-------------|
84
- | `sessionContext` | boolean | `false` | Inject Working Memory + relevant memories at prompt time |
85
- | `sessionDigest` | boolean | `true` | Thread capture + LLM distillation at session end |
86
- | `maxContextResults` | integer 1–20 | `5` | How many memories to inject at prompt time |
87
- | `digestMinInterval` | integer | `300` | Minimum seconds between session digests |
88
- | `apiUrl` | string | `""` | Remote server URL. Empty = local (127.0.0.1:14242) |
89
- | `apiKey` | string | `""` | API key. Injected as `NMEM_API_KEY` env var only. Never logged. |
86
+ Optional config file at `~/.nowledge-mem/openclaw.json`. Falls through to OpenClaw plugin settings when the file is absent.
87
+
88
+ | Key | Type | Default | Env Var | Description |
89
+ |-----|------|---------|---------|-------------|
90
+ | `sessionContext` | boolean | `false` | `NMEM_SESSION_CONTEXT` | Inject Working Memory + relevant memories at prompt time |
91
+ | `sessionDigest` | boolean | `true` | `NMEM_SESSION_DIGEST` | Thread capture + LLM distillation at session end |
92
+ | `digestMinInterval` | integer 0-86400 | `300` | `NMEM_DIGEST_MIN_INTERVAL` | Minimum seconds between session digests |
93
+ | `maxContextResults` | integer 1-20 | `5` | `NMEM_MAX_CONTEXT_RESULTS` | How many memories to inject at prompt time |
94
+ | `apiUrl` | string | `""` | `NMEM_API_URL` | Remote server URL. Empty = local (127.0.0.1:14242) |
95
+ | `apiKey` | string | `""` | `NMEM_API_KEY` | API key. Never logged. |
96
+
97
+ **Priority**: config file > pluginConfig > env var > default.
98
+
99
+ `parseConfig()` returns `_sources` object tracking where each value came from (`"file"`, `"pluginConfig"`, `"env"`, `"default"`). Used by `nowledge_mem_status` tool.
100
+
101
+ Legacy aliases accepted silently in all sources for backward compat:
102
+ `autoRecall`→`sessionContext`, `autoCapture`→`sessionDigest`, `captureMinInterval`→`digestMinInterval`, `maxRecallResults`→`maxContextResults`.
90
103
 
91
104
  ### Credential Handling Rules
92
105
  - `apiKey` → ONLY via child process env (`NMEM_API_KEY`). Never CLI arg, never logged.
93
106
  - `apiUrl` → passed as `--api-url` flag to CLI (not a secret).
94
- - Config values win over environment variables.
95
107
  - `_spawnEnv()` builds per-spawn env; `_apiUrlArgs()` adds `--api-url` when non-default.
96
108
 
97
109
  ## CLI Surface (nmem commands used by plugin)
@@ -136,15 +148,15 @@ NMEM_API_URL=https://your-server NMEM_API_KEY=key nmem status
136
148
 
137
149
  ## Known Gaps / Accepted Limitations
138
150
 
139
- 1. **Feed API `date_from`/`date_to`** — supported. Backend filters events by YYYY-MM-DD range. CLI: `nmem f --from/--to`. Plugin: `nowledge_mem_timeline` accepts `date_from`/`date_to`.
140
- 2. **Working Memory section edit** — supported. `nmem wm patch --heading "## X" --content/--append` does client-side read-modify-write. Plugin: `nowledge_mem_context` accepts `patch_section` + `patch_content`/`patch_append`.
141
- 3. **EVOLVES chain CLI** — supported. `nmem g evolves <id>` calls `/agent/evolves?memory_id=<id>`. Plugin: `nowledge_mem_connections` uses `client.graphEvolves()`.
142
- 4. **`unit_type` requires rebuilt backend** — `MemoryCreateRequest` includes `unit_type` (fixed). Restart backend after rebuild.
143
- 5. **Working Memory full-overwrite only via API** — the API (`PUT /agent/working-memory`) still takes full content. The section-level patch is implemented purely client-side. This is acceptable; the Knowledge Agent regenerates WM each morning anyway.
151
+ 1. **Feed API `date_from`/`date_to`** - supported. Backend filters events by YYYY-MM-DD range. CLI: `nmem f --from/--to`. Plugin: `nowledge_mem_timeline` accepts `date_from`/`date_to`.
152
+ 2. **Working Memory section edit** - supported. `nmem wm patch --heading "## X" --content/--append` does client-side read-modify-write. Plugin: `nowledge_mem_context` accepts `patch_section` + `patch_content`/`patch_append`.
153
+ 3. **EVOLVES chain CLI** - supported. `nmem g evolves <id>` calls `/agent/evolves?memory_id=<id>`. Plugin: `nowledge_mem_connections` uses `client.graphEvolves()`.
154
+ 4. **`unit_type` requires rebuilt backend** - `MemoryCreateRequest` includes `unit_type` (fixed). Restart backend after rebuild.
155
+ 5. **Working Memory full-overwrite only via API** - the API (`PUT /agent/working-memory`) still takes full content. The section-level patch is implemented purely client-side. This is acceptable; the Knowledge Agent regenerates WM each morning anyway.
144
156
 
145
157
  ## Non-Goals
146
158
 
147
- - Do NOT add `nowledge_mem_search` — `memory_search` covers it.
148
- - Do NOT expose full WM overwrite from agents — section-level patch is the right granularity.
159
+ - Do NOT add `nowledge_mem_search` - `memory_search` covers it.
160
+ - Do NOT expose full WM overwrite from agents - section-level patch is the right granularity.
149
161
  - Do NOT add cloud dependencies to the core path.
150
162
  - Do NOT accept unknown config keys (strict parser in `config.js`).