Skip to content

Commit bbf0e8d

Browse files
authored
Merge pull request #135 from nowledge-co/dev_0613
fix: openclaw plugin optimization, claud-code plugin fixes
2 parents ec60491 + 1795ed6 commit bbf0e8d

13 files changed

Lines changed: 108 additions & 33 deletions

File tree

nowledge-mem-bub-plugin/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.2.0 (2026-03-17)
44

55
- Fixed: memory context (Working Memory + recalled knowledge) no longer injected into system prompt, which was breaking LLM prefix cache and causing full KV recomputation every turn. Context now injected via `build_prompt` hook into user prompt space. System prompt stays static and cacheable. Contributed by @frostming.
6+
- Fixed: trailing slash in API URL no longer causes silent 404 — URLs like `https://mem.example.com/` are now normalized at config load time.
67
- Changed: `system_prompt` hook now returns only static behavioral guidance (identical every turn), preserving prefix cache.
78
- Changed: memory loading moved from `load_state` hook to private `_load_memory` method called from `build_prompt`.
89
- Changed: skill directory renamed from `bub_skills/` to `skills/` for consistency.

nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,18 @@ def _load_config(self) -> None:
4444
except Exception:
4545
logger.warning("failed to parse %s", config_path)
4646

47-
self._api_url = (
47+
raw_url = (
4848
os.environ.get("NMEM_API_URL")
4949
or file_config.get("apiUrl")
5050
or file_config.get("api_url")
5151
or None
5252
)
53+
if isinstance(raw_url, str):
54+
normalized = raw_url.strip().rstrip("/")
55+
self._api_url = normalized or None
56+
else:
57+
self._api_url = None
58+
self._api_url = raw_url.rstrip("/") if raw_url else None
5359
self._api_key = (
5460
os.environ.get("NMEM_API_KEY")
5561
or file_config.get("apiKey")

nowledge-mem-claude-code-plugin/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to the Nowledge Mem Claude Code plugin will be documented in
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.7.2] - 2026-03-18
9+
10+
### Fixed
11+
12+
- **Slash commands `/search-memory`, `/save-thread`, `/distill-memory` now work.** Skill names had spaces (e.g. `Search Memory`) which Claude Code parsed as command "Search" + args "Memory", causing "Unknown skill" errors. Names now use hyphens matching all other plugins.
13+
814
## [0.7.1] - 2026-03-09
915

1016
### Changed

nowledge-mem-claude-code-plugin/skills/distill-memory/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Distill Memory
2+
name: distill-memory
33
description: Recognize breakthrough moments, blocking resolutions, and design decisions worth preserving. Detect high-value insights that save future time. Suggest distillation at valuable moments, not routine work.
44
---
55

nowledge-mem-claude-code-plugin/skills/save-thread/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Save Thread
2+
name: save-thread
33
description: Save the real Claude Code session messages only when the user explicitly requests it. Use nmem t save to import the recorded session, not a summary-only checkpoint.
44
---
55

nowledge-mem-claude-code-plugin/skills/search-memory/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Search Memory
2+
name: search-memory
33
description: Search memory store when past insights would improve response. Recognize when user's stored breakthroughs, decisions, or solutions are relevant. Search proactively based on context, not just explicit requests.
44
---
55

nowledge-mem-openclaw-plugin/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to the Nowledge Mem OpenClaw plugin will be documented in this file.
44

5+
## [0.6.15] - 2026-03-18
6+
7+
### Changed
8+
9+
- **Shared config for remote credentials.** The plugin now reads `apiUrl` and `apiKey` from `~/.nowledge-mem/config.json` — the same file used by nmem CLI, Bub, Claude Code, and other integrations. One config file connects all your tools. The legacy `~/.nowledge-mem/openclaw.json` is still honored at highest priority for backward compatibility, but is no longer the recommended path. New cascade for credentials: `openclaw.json` (legacy) > OpenClaw dashboard > `config.json` (shared) > env vars > defaults.
10+
11+
### Fixed
12+
13+
- **Trailing slash in API URL no longer causes 404.** URLs like `https://mem.example.com/` (with trailing slash) produced double-slash paths in API fallback requests. The URL is now normalized at construction time.
14+
515
## [0.6.14] - 2026-03-17
616

717
### Added

nowledge-mem-openclaw-plugin/CLAUDE.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Continuation guide for `community/nowledge-mem-openclaw-plugin`.
99
- Memory backend: `nmem` CLI (fallback: `uvx --from nmem-cli nmem`)
1010
- OpenClaw minimum: `2026.3.7` (`appendSystemContext` / system-context guidance required)
1111
- Architecture: **CLI-first via OpenClaw runtime** - all CLI execution goes through `api.runtime.system.runCommandWithTimeout`, not direct `child_process`
12-
- Remote mode: set `NMEM_API_URL` + `NMEM_API_KEY` env vars or config file `apiUrl` + `apiKey`
12+
- Remote mode: `~/.nowledge-mem/config.json` (shared) or OpenClaw dashboard. Legacy `openclaw.json` still honored.
1313

1414
## Design Philosophy
1515

@@ -30,7 +30,7 @@ src/
3030
index.js - plugin registration (tools, hooks, commands, CLI)
3131
client.js - CLI wrapper with API fallback; async runtime command execution; credential handling
3232
spawn-env.js - env-only credential injection for the nmem runner
33-
config.js - config cascade: ~/.nowledge-mem/openclaw.json > pluginConfig > env vars > defaults
33+
config.js - config cascade: openclaw.json (legacy) > pluginConfig > config.json (credentials) > env > defaults
3434
hooks/
3535
behavioral.js - always-on behavioral guidance (~50 tokens/turn)
3636
recall.js - before_prompt_build: inject Working Memory + recalled memories
@@ -49,7 +49,8 @@ skills/
4949
memory-guide/
5050
SKILL.md - agent behavioral skill: when/how to search, save, explore memory (auto-discovered by OpenClaw)
5151
openclaw.plugin.json - manifest + config schema (version, uiHints, configSchema, skills)
52-
~/.nowledge-mem/openclaw.json - optional user config file (overrides OpenClaw settings when present)
52+
~/.nowledge-mem/openclaw.json - legacy config file (still honored, deprecated in docs)
53+
~/.nowledge-mem/config.json - shared credentials (apiUrl/apiKey) read by all Nowledge Mem tools
5354
```
5455

5556
## Tool Surface (10 tools)
@@ -92,7 +93,8 @@ openclaw.plugin.json - manifest + config schema (version, uiHints, configSchema,
9293

9394
## Config Keys
9495

95-
Optional config file at `~/.nowledge-mem/openclaw.json`. Falls through to OpenClaw plugin settings when the file is absent.
96+
Plugin settings: OpenClaw dashboard (pluginConfig). Legacy `~/.nowledge-mem/openclaw.json` still honored.
97+
Credentials (apiUrl/apiKey): also reads `~/.nowledge-mem/config.json` (shared with all Nowledge Mem tools).
9698

9799
| Key | Type | Default | Env Var | Description |
98100
|-----|------|---------|---------|-------------|
@@ -105,9 +107,10 @@ Optional config file at `~/.nowledge-mem/openclaw.json`. Falls through to OpenCl
105107
| `apiUrl` | string | `""` | `NMEM_API_URL` | Remote server URL. Empty = local (127.0.0.1:14242) |
106108
| `apiKey` | string | `""` | `NMEM_API_KEY` | API key. Never logged. |
107109

108-
**Priority**: config file > pluginConfig > env var > default.
110+
**Priority** (plugin-specific keys): `openclaw.json` (legacy) > pluginConfig > env var > default.
111+
**Priority** (apiUrl/apiKey): `openclaw.json` (legacy) > pluginConfig > `config.json` (shared) > env var > default.
109112

110-
`parseConfig()` returns `_sources` object tracking where each value came from (`"file"`, `"pluginConfig"`, `"env"`, `"default"`). Used by `nowledge_mem_status` tool.
113+
`parseConfig()` returns `_sources` object tracking where each value came from (`"file"`, `"pluginConfig"`, `"sharedConfig"`, `"env"`, `"default"`). Used by `nowledge_mem_status` tool.
111114

112115
Legacy aliases accepted silently in all sources for backward compat:
113116
`autoRecall``sessionContext`, `autoCapture``sessionDigest`, `captureMinInterval``digestMinInterval`, `maxRecallResults``maxContextResults`.

nowledge-mem-openclaw-plugin/README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -372,24 +372,18 @@ To change settings, use the OpenClaw plugin settings UI. Changes take effect on
372372
| `apiUrl` | string | `""` | Remote server URL. Empty = local (`http://127.0.0.1:14242`) |
373373
| `apiKey` | string | `""` | API key for remote access. Injected as `NMEM_API_KEY` env var, never logged |
374374

375-
### Advanced: config file
375+
### Remote access
376376

377-
For persistent or scripted config, create `~/.nowledge-mem/openclaw.json`:
377+
Create `~/.nowledge-mem/config.json` with your credentials. This file is shared by all Nowledge Mem integrations (nmem CLI, Bub, Claude Code, etc.) so one file connects everything:
378378

379379
```json
380380
{
381-
"sessionContext": false,
382-
"sessionDigest": true,
383-
"digestMinInterval": 300,
384-
"maxContextResults": 5,
385-
"recallMinScore": 0,
386-
"maxThreadMessageChars": 800,
387-
"apiUrl": "",
388-
"apiKey": ""
381+
"apiUrl": "https://<your-url>",
382+
"apiKey": "nmem_..."
389383
}
390384
```
391385

392-
The config file takes priority over OpenClaw settings. Only the keys you include are overridden; missing keys fall through to OpenClaw settings, then env vars, then defaults.
386+
See [Access Mem Anywhere](https://mem.nowledge.co/docs/remote-access).
393387

394388
### Advanced: environment variables
395389

@@ -401,16 +395,25 @@ NMEM_SESSION_DIGEST=true
401395
NMEM_DIGEST_MIN_INTERVAL=300
402396
NMEM_MAX_CONTEXT_RESULTS=5
403397
NMEM_RECALL_MIN_SCORE=0
398+
NMEM_MAX_THREAD_MESSAGE_CHARS=800
404399
NMEM_API_URL=https://...
405400
NMEM_API_KEY=your-key
406401
```
407402

408403
### Priority
409404

405+
Plugin-specific settings:
410406
```
411-
config file > OpenClaw settings > env vars > defaults
407+
openclaw.json (legacy) > OpenClaw dashboard > env vars > defaults
412408
```
413409

410+
Credentials (apiUrl, apiKey):
411+
```
412+
openclaw.json (legacy) > OpenClaw dashboard > config.json (shared) > env vars > defaults
413+
```
414+
415+
`~/.nowledge-mem/openclaw.json` is still honored for backward compatibility but is no longer the recommended path. New users should configure plugin-specific settings via the OpenClaw dashboard and shared credentials via `~/.nowledge-mem/config.json`.
416+
414417
Use `nowledge_mem_status` (or `openclaw nowledge-mem status`) to see where each value comes from.
415418

416419
### Trust warning after install

nowledge-mem-openclaw-plugin/openclaw.plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "openclaw-nowledge-mem",
3-
"version": "0.6.14",
3+
"version": "0.6.15",
44
"kind": "memory",
55
"skills": ["skills/memory-guide"],
66
"uiHints": {

0 commit comments

Comments
 (0)