@nowledge/openclaw-nowledge-mem 0.6.2 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +135 -37
- package/CLAUDE.md +72 -52
- package/README.md +240 -45
- package/openclaw.plugin.json +23 -23
- package/package.json +1 -1
- package/src/client.js +182 -0
- package/src/config.js +234 -29
- package/src/hooks/behavioral.js +43 -0
- package/src/hooks/capture.js +3 -3
- package/src/hooks/recall.js +1 -1
- package/src/index.js +19 -6
- package/src/tools/forget.js +4 -3
- package/src/tools/memory-get.js +19 -9
- package/src/tools/memory-search.js +38 -9
- package/src/tools/save.js +33 -0
- package/src/tools/thread-fetch.js +106 -0
- package/src/tools/thread-search.js +108 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,20 +2,118 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the Nowledge Mem OpenClaw plugin will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.6.6] - 2026-02-27
|
|
6
|
+
|
|
7
|
+
### Changed - Config file + env var cascade
|
|
8
|
+
|
|
9
|
+
**Config file at `~/.nowledge-mem/openclaw.json`**
|
|
10
|
+
|
|
11
|
+
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 migrated into the file on first run. No manual steps needed.
|
|
12
|
+
|
|
13
|
+
This ensures your settings survive OpenClaw version upgrades that may strip custom plugin config fields (observed in OpenClaw >= 2026.2.25).
|
|
14
|
+
|
|
15
|
+
**Config cascade** (4 layers, highest to lowest priority):
|
|
16
|
+
1. `api.pluginConfig` - from OpenClaw's plugin config (when supported)
|
|
17
|
+
2. `~/.nowledge-mem/openclaw.json` - dedicated config file
|
|
18
|
+
3. Environment variables - `NMEM_SESSION_CONTEXT`, `NMEM_SESSION_DIGEST`, etc.
|
|
19
|
+
4. Built-in defaults
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- **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
|
|
24
|
+
- **Config strict mode**: unknown config keys throw a descriptive error listing all valid keys
|
|
25
|
+
- **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
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Environment variable support for all config keys (not just `apiUrl`/`apiKey`)
|
|
30
|
+
- Migration: first-run config file seeded from existing `pluginConfig` values
|
|
31
|
+
- `isDefaultApiUrl()` helper exported for local-vs-remote detection
|
|
32
|
+
|
|
33
|
+
## [0.6.5] - 2026-02-26
|
|
34
|
+
|
|
35
|
+
### Added - Thread tools + sourceThreadId linkage
|
|
36
|
+
|
|
37
|
+
**Two new tools for conversation retrieval.** The plugin now provides 9 tools total.
|
|
38
|
+
|
|
39
|
+
- `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.
|
|
40
|
+
- `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.
|
|
41
|
+
|
|
42
|
+
**Memories now link back to their source conversations.**
|
|
43
|
+
|
|
44
|
+
Every memory distilled from a conversation now includes `sourceThreadId` in search results (`memory_search`) and individual lookups (`memory_get`). This enables the progressive retrieval workflow: search memories, see which thread they came from, fetch the full conversation for context.
|
|
45
|
+
|
|
46
|
+
**New client methods:**
|
|
47
|
+
|
|
48
|
+
- `client.searchThreadsFull(query, { limit, source })` - full-featured thread search (throws on error, supports source filter). CLI-first with API fallback.
|
|
49
|
+
- `client.fetchThread(threadId, { offset, limit })` - fetch messages from a thread with pagination. CLI-first with API fallback.
|
|
50
|
+
|
|
51
|
+
**Save deduplication.**
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
**Context-aware behavioral guidance.**
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
## [0.6.4] - 2026-02-26
|
|
60
|
+
|
|
61
|
+
### Changed - Thread search enrichment + sessionDigest default on
|
|
62
|
+
|
|
63
|
+
**`memory_search` now includes relevant conversation threads.**
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
**`sessionDigest` now defaults to `true`.**
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
**Behavioral hook updated.**
|
|
72
|
+
|
|
73
|
+
The always-on guidance now mentions that `memory_search` returns conversation snippets alongside memories, so the agent knows to use the enriched results.
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- `client.searchThreads(query, limit)` - calls `GET /threads/search` API. Returns top matching threads with message snippets and relevance scores. Best-effort: never throws.
|
|
78
|
+
- Version bumped to 0.6.4.
|
|
79
|
+
|
|
80
|
+
## [0.4.0] - 2026-02-26
|
|
81
|
+
|
|
82
|
+
### Changed - Rename config + always-on behavioral guidance
|
|
83
|
+
|
|
84
|
+
**Renamed config options** (old names still work as silent aliases):
|
|
85
|
+
|
|
86
|
+
| Old name | New name |
|
|
87
|
+
|----------|----------|
|
|
88
|
+
| `autoRecall` | `sessionContext` |
|
|
89
|
+
| `autoCapture` | `sessionDigest` |
|
|
90
|
+
| `captureMinInterval` | `digestMinInterval` |
|
|
91
|
+
| `maxRecallResults` | `maxContextResults` |
|
|
92
|
+
|
|
93
|
+
Existing configs with old names continue to work. Aliases are resolved transparently in `parseConfig()`. New names take precedence if both are present.
|
|
94
|
+
|
|
95
|
+
**Added: Always-on behavioral hook**
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
**Migrated: `before_prompt_build` for session context**
|
|
100
|
+
|
|
101
|
+
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`.
|
|
102
|
+
|
|
5
103
|
## [0.3.0] - 2026-02-23
|
|
6
104
|
|
|
7
|
-
### Changed
|
|
105
|
+
### Changed - Architecture overhaul: tool-first, LLM-based capture
|
|
8
106
|
|
|
9
107
|
**Breaking: `autoRecall` now defaults to `false`**
|
|
10
108
|
|
|
11
|
-
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
|
|
109
|
+
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.
|
|
12
110
|
|
|
13
111
|
Users who explicitly set `autoRecall: true` are unaffected.
|
|
14
112
|
|
|
15
113
|
**Removed: English-only heuristic capture**
|
|
16
114
|
|
|
17
115
|
The entire rule-based capture pipeline has been removed:
|
|
18
|
-
- `shouldCaptureAsMemory()`
|
|
116
|
+
- `shouldCaptureAsMemory()` - English-only regex patterns (`/\bi (like|prefer|hate)\b/i`)
|
|
19
117
|
- `MEMORY_TRIGGER_PATTERNS`, `PROMPT_INJECTION_PATTERNS`
|
|
20
118
|
- `looksLikeQuestion()`, `hasMemoryTrigger()`, `looksLikePromptInjection()`
|
|
21
119
|
- `fingerprint()`, per-session dedup map
|
|
@@ -26,9 +124,9 @@ These were fundamentally broken for non-English users (~95% of the world) and vi
|
|
|
26
124
|
|
|
27
125
|
Replaced heuristics with a proper LLM-based pipeline:
|
|
28
126
|
|
|
29
|
-
1. **Thread capture** (unconditional, unchanged)
|
|
30
|
-
2. **Triage** (cheap, fast)
|
|
31
|
-
3. **Distillation** (only when worthwhile)
|
|
127
|
+
1. **Thread capture** (unconditional, unchanged) - full conversation appended to persistent thread
|
|
128
|
+
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`
|
|
129
|
+
3. **Distillation** (only when worthwhile) - full LLM extraction via existing `POST /memories/distill`, creating structured memories with proper unit_type, labels, and temporal data
|
|
32
130
|
|
|
33
131
|
Cost: negligible for conversations without save-worthy content (triage only). Moderate for rich conversations (triage + distill). Works in any language.
|
|
34
132
|
|
|
@@ -38,17 +136,17 @@ More directive description for tool-only mode: tells the agent when to proactive
|
|
|
38
136
|
|
|
39
137
|
**Migrated: `before_prompt_build` hook**
|
|
40
138
|
|
|
41
|
-
Auto-recall hook migrated from legacy `before_agent_start` to modern `before_prompt_build` API. Trimmed verbose tool guidance
|
|
139
|
+
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.
|
|
42
140
|
|
|
43
141
|
### Added
|
|
44
142
|
|
|
45
|
-
- `client.triageConversation(content)`
|
|
46
|
-
- `client.distillThread({ threadId, title, content })`
|
|
143
|
+
- `client.triageConversation(content)` - calls `POST /memories/distill/triage`
|
|
144
|
+
- `client.distillThread({ threadId, title, content })` - calls `POST /memories/distill`
|
|
47
145
|
- Backend `POST /memories/distill/triage` endpoint with lightweight LLM triage prompt
|
|
48
146
|
|
|
49
147
|
## [0.2.7] - 2026-02-18
|
|
50
148
|
|
|
51
|
-
### Added
|
|
149
|
+
### Added - Gap closures: date range, EVOLVES CLI, WM section edit
|
|
52
150
|
|
|
53
151
|
**Feed date range filtering**
|
|
54
152
|
|
|
@@ -59,82 +157,82 @@ Auto-recall hook migrated from legacy `before_agent_start` to modern `before_pro
|
|
|
59
157
|
|
|
60
158
|
**EVOLVES version chain via CLI**
|
|
61
159
|
|
|
62
|
-
- `nmem g evolves <id>`
|
|
63
|
-
- `client.graphEvolves()`
|
|
160
|
+
- `nmem g evolves <id>` - new CLI command showing the full EVOLVES chain for a memory (replaces/enriches/confirms/challenges relations).
|
|
161
|
+
- `client.graphEvolves()` - new client method using `nmem g evolves`; falls back to `GET /agent/evolves?memory_id=<id>`.
|
|
64
162
|
- `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.
|
|
65
163
|
- Backend `GET /agent/evolves` now accepts `memory_id` query param to filter edges for a specific memory.
|
|
66
164
|
|
|
67
165
|
**Working Memory section-level edit**
|
|
68
166
|
|
|
69
|
-
- `nmem wm patch --heading "## Notes" --content/--append`
|
|
70
|
-
- `client.patchWorkingMemory(heading, { content, append })`
|
|
167
|
+
- `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.
|
|
168
|
+
- `client.patchWorkingMemory(heading, { content, append })` - new client method.
|
|
71
169
|
- `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.
|
|
72
170
|
- Includes a JS `patchWmSection()` helper in `client.js` for the API fallback path (for CLI versions that predate `wm patch`).
|
|
73
171
|
|
|
74
172
|
## [0.2.6] - 2026-02-18
|
|
75
173
|
|
|
76
|
-
### Added
|
|
174
|
+
### Added - Rich save: labels, event_start, temporal_context, unit_type fixed
|
|
77
175
|
|
|
78
176
|
## [0.2.5] - 2026-02-18
|
|
79
177
|
|
|
80
|
-
### Added
|
|
178
|
+
### Added - Remote mode configuration
|
|
81
179
|
|
|
82
180
|
- `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`).
|
|
83
|
-
- `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
|
|
181
|
+
- `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.
|
|
84
182
|
- `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.
|
|
85
183
|
- Initialization log now shows `mode=remote → https://...` vs `mode=local` (key never appears in logs).
|
|
86
184
|
- `_spawnEnv()` helper: builds per-spawn env with credentials injected; `_apiUrlArgs()` adds `--api-url` flag only when not local.
|
|
87
185
|
|
|
88
186
|
## [0.2.4] - 2026-02-18
|
|
89
187
|
|
|
90
|
-
### Changed
|
|
188
|
+
### Changed - CLI-first architecture
|
|
91
189
|
|
|
92
190
|
All operations now go through the `nmem` CLI instead of direct API calls.
|
|
93
191
|
This is a structural alignment that makes every feature work in remote mode
|
|
94
192
|
(`NMEM_API_URL` + `NMEM_API_KEY`) without any plugin changes.
|
|
95
193
|
|
|
96
|
-
- `client.graphExpand()`
|
|
97
|
-
- `client.feedEvents()`
|
|
98
|
-
- `client.search()`
|
|
194
|
+
- `client.graphExpand()` - uses `nmem g expand <id>`; falls back to API on older CLI
|
|
195
|
+
- `client.feedEvents()` - uses `nmem f`; falls back to API on older CLI
|
|
196
|
+
- `client.search()` - CLI now returns `relevance_reason`, `importance`, `labels`,
|
|
99
197
|
temporal fields natively; `searchRich()` is now an alias for `search()`
|
|
100
|
-
- `client.searchTemporal()`
|
|
198
|
+
- `client.searchTemporal()` - uses `nmem m search --event-from/--recorded-from`
|
|
101
199
|
CLI args; falls back to API if CLI is pre-bi-temporal-update
|
|
102
|
-
- `client._normalizeMemory()`
|
|
200
|
+
- `client._normalizeMemory()` - canonical memory shape shared across all search paths
|
|
103
201
|
- Removed `client.apiJson()` usage in `connections.js` and `timeline.js`
|
|
104
202
|
- `connections.js`: `client.apiJson()` retained only for the `/agent/evolves` chain
|
|
105
|
-
(no CLI command for this yet
|
|
203
|
+
(no CLI command for this yet, tracked as future improvement)
|
|
106
204
|
|
|
107
205
|
## [0.2.3] - 2026-02-18
|
|
108
206
|
|
|
109
|
-
### Changed
|
|
207
|
+
### Changed - Graph Transparency & Scoring Visibility
|
|
110
208
|
|
|
111
209
|
- `nowledge_mem_connections`: completely rewritten output format
|
|
112
|
-
- Edges are now JOIN-ed to their target nodes
|
|
210
|
+
- Edges are now JOIN-ed to their target nodes. Each connection shows its relationship type and strength
|
|
113
211
|
- Sections organized by edge type: "Synthesized from N source memories" (CRYSTALLIZED_FROM), "Knowledge evolution" (EVOLVES), "Sourced from document" (SOURCED_FROM), "Entities mentioned" (MENTIONS)
|
|
114
212
|
- EVOLVES sub-relations are labeled: supersedes, enriches, confirms, challenges
|
|
115
213
|
- Each connected memory includes its `id` for direct follow-up with `memory_get` or `nowledge_mem_connections`
|
|
116
|
-
- `memory_search`: now always uses API path (`searchRich`)
|
|
214
|
+
- `memory_search`: now always uses API path (`searchRich`), returns `matchedVia` with scoring breakdown
|
|
117
215
|
- e.g. `"matchedVia": "Text Match (100%) + Semantic Match (69%) | decay[imp:high]"`
|
|
118
216
|
- Also returns `importance` per result
|
|
119
217
|
- Response `mode` field updated to `"multi-signal"` to reflect actual behavior
|
|
120
|
-
- `nowledge_mem_timeline`: timeline entries now include `(id: <memoryId>)` hint for events with linked memories
|
|
218
|
+
- `nowledge_mem_timeline`: timeline entries now include `(id: <memoryId>)` hint for events with linked memories, enables immediate chaining to `nowledge_mem_connections`
|
|
121
219
|
- `nowledge_mem_timeline`: `event_type` filter values documented in tool description for model discoverability
|
|
122
|
-
- Auto-recall hook: uses `searchRich` instead of CLI search
|
|
220
|
+
- Auto-recall hook: uses `searchRich` instead of CLI search, shows scoring breakdown in recalled context
|
|
123
221
|
|
|
124
222
|
### Added
|
|
125
223
|
|
|
126
|
-
- `client.searchRich()`
|
|
224
|
+
- `client.searchRich()` - convenience wrapper for `searchTemporal` without temporal filters; always returns `relevanceReason`
|
|
127
225
|
|
|
128
226
|
## [0.2.2] - 2026-02-18
|
|
129
227
|
|
|
130
228
|
### Added
|
|
131
229
|
|
|
132
230
|
- `memory_search` now supports bi-temporal filtering:
|
|
133
|
-
- `event_date_from` / `event_date_to`
|
|
134
|
-
- `recorded_date_from` / `recorded_date_to`
|
|
231
|
+
- `event_date_from` / `event_date_to` - when the fact/event happened (YYYY, YYYY-MM, YYYY-MM-DD)
|
|
232
|
+
- `recorded_date_from` / `recorded_date_to` - when the memory was saved to Nowledge Mem
|
|
135
233
|
- Uses API-direct path (`client.searchTemporal`) so it works regardless of installed CLI version
|
|
136
234
|
- Results include `eventStart`, `eventEnd`, `temporalContext` when available
|
|
137
|
-
- `client.searchTemporal()`
|
|
235
|
+
- `client.searchTemporal()` - new method wrapping `/memories/search` bi-temporal API directly
|
|
138
236
|
|
|
139
237
|
## [0.2.1] - 2026-02-18
|
|
140
238
|
|
|
@@ -146,7 +244,7 @@ This is a structural alignment that makes every feature work in remote mode
|
|
|
146
244
|
|
|
147
245
|
## [0.2.0] - 2026-02-18
|
|
148
246
|
|
|
149
|
-
### Changed
|
|
247
|
+
### Changed - Tool Set Redesign
|
|
150
248
|
|
|
151
249
|
Redesigned from first principles around Nowledge Mem's v0.6 architecture.
|
|
152
250
|
This version reflects our genuine strengths: knowledge graph, structured types,
|
|
@@ -154,9 +252,9 @@ Working Memory, and cross-AI continuity.
|
|
|
154
252
|
|
|
155
253
|
### Added
|
|
156
254
|
|
|
157
|
-
- `nowledge_mem_save` tool: structured knowledge capture with `unit_type` parameter (fact, preference, decision, plan, procedure, learning, context, event)
|
|
158
|
-
- `nowledge_mem_context` tool: read today's Working Memory daily briefing
|
|
159
|
-
- `nowledge_mem_connections` tool: explore knowledge graph around a topic
|
|
255
|
+
- `nowledge_mem_save` tool: structured knowledge capture with `unit_type` parameter (fact, preference, decision, plan, procedure, learning, context, event). Replaces generic `nowledge_mem_store`
|
|
256
|
+
- `nowledge_mem_context` tool: read today's Working Memory daily briefing. Replaces `nowledge_mem_working_memory` with clearer naming
|
|
257
|
+
- `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.
|
|
160
258
|
- `nowledge_mem_forget` tool: delete memories by ID or search query with confirmation flow
|
|
161
259
|
- `/forget` slash command: quick memory deletion from chat
|
|
162
260
|
- Capture quality gate: prompt injection detection, question filtering, memory-trigger pattern matching
|
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
1
|
+
# CLAUDE.md - Nowledge Mem OpenClaw Plugin
|
|
2
2
|
|
|
3
3
|
Continuation guide for `community/nowledge-mem-openclaw-plugin`.
|
|
4
4
|
|
|
@@ -7,77 +7,94 @@ 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**
|
|
11
|
-
- Remote mode: set `NMEM_API_URL` + `NMEM_API_KEY` env vars or
|
|
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**
|
|
18
|
-
2. **Source provenance**
|
|
19
|
-
3. **Structured types**
|
|
20
|
-
4. **Working Memory**
|
|
21
|
-
5. **Cross-AI continuity**
|
|
22
|
-
6. **Hybrid search**
|
|
23
|
-
7. **Transparent scoring**
|
|
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
|
|
30
|
-
client.js
|
|
31
|
-
config.js
|
|
29
|
+
index.js - plugin registration (tools, hooks, commands, CLI)
|
|
30
|
+
client.js - CLI wrapper with API fallback; credential handling
|
|
31
|
+
config.js - config cascade: pluginConfig > ~/.nowledge-mem/openclaw.json > env vars > defaults
|
|
32
32
|
hooks/
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
35
36
|
tools/
|
|
36
|
-
memory-search.js
|
|
37
|
-
memory-get.js
|
|
38
|
-
save.js
|
|
39
|
-
context.js
|
|
40
|
-
connections.js
|
|
41
|
-
timeline.js
|
|
42
|
-
forget.js
|
|
43
|
-
|
|
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 - user config file (auto-created on first run)
|
|
44
48
|
```
|
|
45
49
|
|
|
46
|
-
## Tool Surface (
|
|
50
|
+
## Tool Surface (9 tools)
|
|
47
51
|
|
|
48
52
|
### OpenClaw Memory Slot (required for system prompt activation)
|
|
49
|
-
- `memory_search`
|
|
50
|
-
- `memory_get`
|
|
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.
|
|
51
55
|
|
|
52
56
|
### Nowledge Mem Native (differentiators)
|
|
53
|
-
- `nowledge_mem_save`
|
|
54
|
-
- `nowledge_mem_context`
|
|
55
|
-
- `nowledge_mem_connections`
|
|
56
|
-
- `nowledge_mem_timeline`
|
|
57
|
-
- `nowledge_mem_forget`
|
|
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.
|
|
62
|
+
|
|
63
|
+
### Thread Tools (progressive conversation retrieval)
|
|
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.
|
|
58
66
|
|
|
59
67
|
## Hook Surface
|
|
60
68
|
|
|
61
|
-
- `
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
64
|
-
- `
|
|
69
|
+
- `before_prompt_build` (always-on) - behavioral guidance: brief note telling agent to save/search proactively. Adjusts when sessionContext is on to avoid redundant searches.
|
|
70
|
+
- `before_prompt_build` (sessionContext) - session context: Working Memory + `searchRich()` with `relevanceReason` in context
|
|
71
|
+
- `agent_end` - thread capture + LLM triage/distillation (requires `sessionDigest: true`)
|
|
72
|
+
- `after_compaction` - thread append
|
|
73
|
+
- `before_reset` - thread append
|
|
65
74
|
|
|
66
75
|
## Slash Commands
|
|
67
76
|
|
|
68
|
-
- `/remember`
|
|
69
|
-
- `/recall`
|
|
70
|
-
- `/forget`
|
|
77
|
+
- `/remember` - quick save
|
|
78
|
+
- `/recall` - quick search
|
|
79
|
+
- `/forget` - quick delete
|
|
71
80
|
|
|
72
81
|
## Config Keys
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
|
77
|
-
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
83
|
+
Config file at `~/.nowledge-mem/openclaw.json` (auto-created on first run). Also supports env vars and pluginConfig.
|
|
84
|
+
|
|
85
|
+
| Key | Type | Default | Env Var | Description |
|
|
86
|
+
|-----|------|---------|---------|-------------|
|
|
87
|
+
| `sessionContext` | boolean | `false` | `NMEM_SESSION_CONTEXT` | Inject Working Memory + relevant memories at prompt time |
|
|
88
|
+
| `sessionDigest` | boolean | `true` | `NMEM_SESSION_DIGEST` | Thread capture + LLM distillation at session end |
|
|
89
|
+
| `digestMinInterval` | integer 0-86400 | `300` | `NMEM_DIGEST_MIN_INTERVAL` | Minimum seconds between session digests |
|
|
90
|
+
| `maxContextResults` | integer 1-20 | `5` | `NMEM_MAX_CONTEXT_RESULTS` | How many memories to inject at prompt time |
|
|
91
|
+
| `apiUrl` | string | `""` | `NMEM_API_URL` | Remote server URL. Empty = local (127.0.0.1:14242) |
|
|
92
|
+
| `apiKey` | string | `""` | `NMEM_API_KEY` | API key. Never logged. |
|
|
93
|
+
|
|
94
|
+
**Priority**: pluginConfig > config file > env var > default.
|
|
95
|
+
|
|
96
|
+
Legacy aliases accepted silently in all sources for backward compat:
|
|
97
|
+
`autoRecall`→`sessionContext`, `autoCapture`→`sessionDigest`, `captureMinInterval`→`digestMinInterval`, `maxRecallResults`→`maxContextResults`.
|
|
81
98
|
|
|
82
99
|
### Credential Handling Rules
|
|
83
100
|
- `apiKey` → ONLY via child process env (`NMEM_API_KEY`). Never CLI arg, never logged.
|
|
@@ -98,6 +115,9 @@ openclaw.plugin.json — manifest + config schema (version, uiHints, configSchem
|
|
|
98
115
|
| `nmem --json wm read` | `client.readWorkingMemory()` | Working Memory read |
|
|
99
116
|
| `nmem --json wm patch --heading "## S" --content/--append` | `client.patchWorkingMemory()` | Section-level WM update |
|
|
100
117
|
| `nmem --json m delete <id>` | `client.execJson()` in forget.js | Delete |
|
|
118
|
+
| `GET /threads/search?query=&limit=` | `client.searchThreads()` | Thread search enrichment (best-effort, API-only) |
|
|
119
|
+
| `nmem --json t search <q> --limit N` | `client.searchThreadsFull()` | Full thread search (CLI-first, API fallback) |
|
|
120
|
+
| `nmem --json t show <id> --limit N --offset O` | `client.fetchThread()` | Fetch thread messages with pagination |
|
|
101
121
|
|
|
102
122
|
All commands have API fallback for older CLI versions.
|
|
103
123
|
|
|
@@ -124,15 +144,15 @@ NMEM_API_URL=https://your-server NMEM_API_KEY=key nmem status
|
|
|
124
144
|
|
|
125
145
|
## Known Gaps / Accepted Limitations
|
|
126
146
|
|
|
127
|
-
1. **Feed API `date_from`/`date_to`**
|
|
128
|
-
2. **Working Memory section edit**
|
|
129
|
-
3. **EVOLVES chain CLI**
|
|
130
|
-
4. **`unit_type` requires rebuilt backend**
|
|
131
|
-
5. **Working Memory full-overwrite only via API**
|
|
147
|
+
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`.
|
|
148
|
+
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`.
|
|
149
|
+
3. **EVOLVES chain CLI** - supported. `nmem g evolves <id>` calls `/agent/evolves?memory_id=<id>`. Plugin: `nowledge_mem_connections` uses `client.graphEvolves()`.
|
|
150
|
+
4. **`unit_type` requires rebuilt backend** - `MemoryCreateRequest` includes `unit_type` (fixed). Restart backend after rebuild.
|
|
151
|
+
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.
|
|
132
152
|
|
|
133
153
|
## Non-Goals
|
|
134
154
|
|
|
135
|
-
- Do NOT add `nowledge_mem_search`
|
|
136
|
-
- Do NOT expose full WM overwrite from agents
|
|
155
|
+
- Do NOT add `nowledge_mem_search` - `memory_search` covers it.
|
|
156
|
+
- Do NOT expose full WM overwrite from agents - section-level patch is the right granularity.
|
|
137
157
|
- Do NOT add cloud dependencies to the core path.
|
|
138
158
|
- Do NOT accept unknown config keys (strict parser in `config.js`).
|