Skip to content

fix: openclaw plugin optimization, claud-code plugin fixes#135

Merged
wey-gu merged 5 commits into
mainfrom
dev_0613
Mar 18, 2026
Merged

fix: openclaw plugin optimization, claud-code plugin fixes#135
wey-gu merged 5 commits into
mainfrom
dev_0613

Conversation

@wey-gu

@wey-gu wey-gu commented Mar 18, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Fixed API URL handling to eliminate 404s caused by trailing slashes
    • Restored slash-command behavior (/search-memory, /save-thread, /distill-memory) by correcting skill name parsing
  • New Features

    • Added shared credential configuration support via ~/.nowledge-mem/config.json for use across tools
  • Documentation

    • Updated remote access and credential management guides to reflect shared config and precedence rules

wey-gu and others added 4 commits March 18, 2026 12:49
The plugin now reads apiUrl/apiKey from ~/.nowledge-mem/config.json,
the same file used by nmem CLI, Bub, Claude Code, and other integrations.
One file connects all tools for Access Anywhere.

Legacy ~/.nowledge-mem/openclaw.json is still honored at highest priority
for backward compatibility. New cascade for credentials:
  openclaw.json > pluginConfig (dashboard) > config.json > env > defaults

README, CLAUDE.md updated to recommend config.json + dashboard over
the legacy openclaw.json path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Matches the same fix in nmem-cli and the existing behavior in
the frontend RemoteTransport. Prevents double-slash URLs when
users configure apiUrl with a trailing slash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skill names "Search Memory", "Save Thread", "Distill Memory" were
parsed by Claude Code as command + args (e.g. /Search with arg Memory).
Renamed to hyphenated form matching all other plugins:
search-memory, save-thread, distill-memory.

read-working-memory was already correct.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Normalizes API URLs by stripping trailing slashes at config load, adds shared credentials support via ~/.nowledge-mem/config.json (while preserving legacy files), fixes skill metadata names to hyphenated forms, and updates changelogs/docs and plugin versions accordingly.

Changes

Cohort / File(s) Summary
API URL Normalization
nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py, nowledge-mem-openclaw-plugin/src/client.js
Normalize API URL by removing trailing slashes during config/client initialization to avoid silent 404s. Note: nowledge_mem_bub change introduces a duplicate/overwriting assignment that may cause a type issue if non-string values are present.
Shared Configuration Support
nowledge-mem-openclaw-plugin/src/config.js
Adds SHARED_CONFIG_PATH and readSharedConfig(); includes shared ~/.nowledge-mem/config.json in credential resolution cascade (legacy file > pluginConfig > shared config > env > defaults).
Skill Name Hyphenation
nowledge-mem-claude-code-plugin/skills/search-memory/SKILL.md, nowledge-mem-claude-code-plugin/skills/save-thread/SKILL.md, nowledge-mem-claude-code-plugin/skills/distill-memory/SKILL.md
Rename skill front-matter name fields from space-separated to hyphenated identifiers (e.g., "Search Memory" → search-memory) to match slash-command parsing.
Changelogs & Docs
nowledge-mem-bub-plugin/CHANGELOG.md, nowledge-mem-claude-code-plugin/CHANGELOG.md, nowledge-mem-openclaw-plugin/CHANGELOG.md, nowledge-mem-openclaw-plugin/CLAUDE.md, nowledge-mem-openclaw-plugin/README.md
Add changelog entries and documentation describing API URL normalization, shared config usage, credential cascade changes, and updated remote-access guidance.
Manifests / Version
nowledge-mem-openclaw-plugin/openclaw.plugin.json, nowledge-mem-openclaw-plugin/package.json
Bump OpenClaw plugin version from 0.6.14 to 0.6.15.
Other
nowledge-mem-bub-plugin/CHANGELOG.md
Adds changelog entry documenting API URL normalization fix.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI / Plugin
    participant Config as parseConfig
    participant FS as Filesystem (~/.nowledge-mem)
    participant Env as Environment
    participant Client as Client (OpenClaw / Bub)

    CLI->>Config: request resolved credentials
    Config->>FS: read legacy openclaw.json
    Config->>FS: read shared config.json
    Config->>Env: read NMEM_* env vars
    Config->>CLI: return resolved { apiUrl, apiKey, source }
    CLI->>Client: initialize with resolved credentials
    Client->>Client: normalize apiUrl (strip trailing /)
    Client-->>CLI: ready (apiUrl normalized)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐇 I nibbled at configs, neat and spry,

Stripped stray slashes that made calls sigh.
Shared crumbs of keys in one warm nest,
Hyphens hopped in to do their best,
Legacy honored — now forward we fly!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague and generic. 'Optimization' does not accurately describe the primary changes (bug fixes for API URL normalization and skill name parsing), and the title omits critical details about the main objectives. Consider a more specific title like 'fix: normalize API URL trailing slashes and correct skill name parsing' that clearly conveys the main changes without vague terms.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev_0613
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
nowledge-mem-openclaw-plugin/README.md (3)

381-382: Consider clarifying trailing-slash handling.

The PR summary mentions that API URLs are normalized by stripping trailing slashes at configuration load time. Consider adding a brief note in the example or nearby text to inform users that trailing slashes are automatically removed.

📝 Suggested clarification
 {
-  "apiUrl": "https://<your-url>",
+  "apiUrl": "https://<your-url>",  // trailing slashes are automatically stripped
   "apiKey": "nmem_..."
 }

Or add a note below the example:

 }

+> Note: Trailing slashes in apiUrl are automatically removed during configuration loading.

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @nowledge-mem-openclaw-plugin/README.md around lines 381 - 382, Add a brief
clarification next to the example JSON showing "apiUrl" and "apiKey" that
trailing slashes in the apiUrl are stripped at configuration load time;
specifically, update the README section that contains the example lines
"apiUrl": "https://<your-url>", and "apiKey": "nmem_..." to include a short
note (e.g., “Note: Trailing slashes in apiUrl are automatically removed during
configuration loading.”) immediately after the example so users know the
normalization behavior.


</details>

---

`406-408`: **Add language specification to the code block.**

The static analysis tool correctly flagged this fenced code block as missing a language specification. Use `text` or `plaintext` for better rendering.



<details>
<summary>📝 Proposed fix</summary>

```diff
 Plugin-specific settings:
-```
+```text
 openclaw.json (legacy) > OpenClaw dashboard > env vars > defaults
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @nowledge-mem-openclaw-plugin/README.md around lines 406 - 408, The fenced
code block in README.md is missing a language tag causing lint warnings; update
the triple-backtick fence for the snippet "openclaw.json (legacy) > OpenClaw
dashboard > env vars > defaults" to include a language specifier (use text or
plaintext) so the block becomes text ... (or plaintext ... ).
Locate the code block in README.md and add the language token immediately after
the opening backticks to satisfy the static analysis rule.


</details>

---

`411-413`: **Add language specification to the code block.**

The static analysis tool correctly flagged this fenced code block as missing a language specification. Use `text` or `plaintext` for better rendering.



<details>
<summary>📝 Proposed fix</summary>

```diff
 Credentials (apiUrl, apiKey):
-```
+```text
 openclaw.json (legacy) > OpenClaw dashboard > config.json (shared) > env vars > defaults
 ```
```
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @nowledge-mem-openclaw-plugin/README.md around lines 411 - 413, The fenced
code block in README.md is missing a language hint; update the block that
currently contains "openclaw.json (legacy) > OpenClaw dashboard > config.json
(shared) > env vars > defaults" to use a plaintext language specifier (e.g.,
change totext) so the line renders correctly; locate the exact fenced
block in the README and add the language token immediately after the opening
backticks.


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Inline comments:
In @nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py:

  • Around line 47-53: The code assumes raw_url is a string and calls
    raw_url.rstrip("/") which fails for non-string config values; update the
    initialization in client.py so the value pulled from
    os.environ.get("NMEM_API_URL") or file_config.get("apiUrl") /
    file_config.get("api_url") is validated/converted to a string before calling
    rstrip — e.g. check isinstance(raw_url, str) and only call raw_url.rstrip("/")
    when true, or coerce with str(raw_url) for non-None values, and ensure
    self._api_url is set to None when no valid URL is present (referencing raw_url,
    file_config, NMEM_API_URL and self._api_url to locate the change).

Nitpick comments:
In @nowledge-mem-openclaw-plugin/README.md:

  • Around line 381-382: Add a brief clarification next to the example JSON
    showing "apiUrl" and "apiKey" that trailing slashes in the apiUrl are stripped
    at configuration load time; specifically, update the README section that
    contains the example lines "apiUrl": "https://<your-url>", and "apiKey": "nmem_..." to include a short note (e.g., “Note: Trailing slashes in apiUrl are
    automatically removed during configuration loading.”) immediately after the
    example so users know the normalization behavior.
  • Around line 406-408: The fenced code block in README.md is missing a language
    tag causing lint warnings; update the triple-backtick fence for the snippet
    "openclaw.json (legacy) > OpenClaw dashboard > env vars > defaults" to include a
    language specifier (use text or plaintext) so the block becomes text ...
    (or plaintext ... ). Locate the code block in README.md and add the
    language token immediately after the opening backticks to satisfy the static
    analysis rule.
  • Around line 411-413: The fenced code block in README.md is missing a language
    hint; update the block that currently contains "openclaw.json (legacy) >
    OpenClaw dashboard > config.json (shared) > env vars > defaults" to use a
    plaintext language specifier (e.g., change totext) so the line renders
    correctly; locate the exact fenced block in the README and add the language
    token immediately after the opening backticks.

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `8c1f8f81-e2bc-4f6d-af3b-49b722ecd7d8`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ec604911e40fceb715fcbdfe16c5b8307c711291 and ba7534391e1b07935260e7f57f2d786663ebfa0f.

</details>

<details>
<summary>📒 Files selected for processing (13)</summary>

* `nowledge-mem-bub-plugin/CHANGELOG.md`
* `nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py`
* `nowledge-mem-claude-code-plugin/CHANGELOG.md`
* `nowledge-mem-claude-code-plugin/skills/distill-memory/SKILL.md`
* `nowledge-mem-claude-code-plugin/skills/save-thread/SKILL.md`
* `nowledge-mem-claude-code-plugin/skills/search-memory/SKILL.md`
* `nowledge-mem-openclaw-plugin/CHANGELOG.md`
* `nowledge-mem-openclaw-plugin/CLAUDE.md`
* `nowledge-mem-openclaw-plugin/README.md`
* `nowledge-mem-openclaw-plugin/openclaw.plugin.json`
* `nowledge-mem-openclaw-plugin/package.json`
* `nowledge-mem-openclaw-plugin/src/client.js`
* `nowledge-mem-openclaw-plugin/src/config.js`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py (1)

47-58: ⚠️ Potential issue | 🔴 Critical

Line 58 overwrites the type-guarded normalization and reintroduces the crash bug.

Lines 53-57 correctly guard against non-string raw_url values, but line 58 immediately overwrites self._api_url with raw_url.rstrip("/") unconditionally. If raw_url is a truthy non-string (e.g., an integer or dict from malformed config JSON), this will crash with AttributeError.

Remove the redundant line 58 — the logic in lines 53-57 already handles normalization correctly.

Proposed fix
         raw_url = (
             os.environ.get("NMEM_API_URL")
             or file_config.get("apiUrl")
             or file_config.get("api_url")
             or None
         )
         if isinstance(raw_url, str):
             normalized = raw_url.strip().rstrip("/")
             self._api_url = normalized or None
         else:
             self._api_url = None
-        self._api_url = raw_url.rstrip("/") if raw_url else None
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py` around lines 47 - 58,
The assignment at the end overwrites the earlier type-guarded normalization and
causes AttributeError for non-string raw_url; remove the redundant final
assignment (the line setting self._api_url = raw_url.rstrip("/") if raw_url else
None) so that the earlier guarded block that checks isinstance(raw_url, str),
trims and sets self._api_url (or None) remains the sole logic for normalizing
raw_url in the constructor of the client.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py`:
- Around line 47-58: The assignment at the end overwrites the earlier
type-guarded normalization and causes AttributeError for non-string raw_url;
remove the redundant final assignment (the line setting self._api_url =
raw_url.rstrip("/") if raw_url else None) so that the earlier guarded block that
checks isinstance(raw_url, str), trims and sets self._api_url (or None) remains
the sole logic for normalizing raw_url in the constructor of the client.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c9782f5-3067-46d5-af4c-958f7175c405

📥 Commits

Reviewing files that changed from the base of the PR and between ba75343 and 1795ed6.

📒 Files selected for processing (1)
  • nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py

@wey-gu wey-gu merged commit bbf0e8d into main Mar 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant