Skip to content

feat(Droid): Add native Droid plugin for Nowledge Mem#120

Merged
wey-gu merged 9 commits into
mainfrom
dev_0611
Mar 15, 2026
Merged

feat(Droid): Add native Droid plugin for Nowledge Mem#120
wey-gu merged 9 commits into
mainfrom
dev_0611

Conversation

@wey-gu

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

Copy link
Copy Markdown
Member

fix(plugins): align CLI flags after t show -m → -n normalization

  • bub client.py: t show -m → -n, t search --limit → -n
  • openclaw CLAUDE.md: t show --limit → -n in CLI surface table
  • alma skill + main.js: t show/t search --limit → -n in CLI playbook

Add native Droid plugin for Nowledge Mem

Summary by CodeRabbit

  • New Features

    • Added a Droid integration with lifecycle hooks for session bootstrap, memory read, prompts, and resumable handoff guidance.
    • Published a Nowledge plugin marketplace entry for easier install.
  • Documentation

    • Added comprehensive docs, changelogs, skills, commands, and release guidance.
    • Updated CLI examples to use the short -n flag for thread search/show limits and clarified system-prompt placement for runtime guidance.
  • Chores

    • Added a plugin validation script and bumped the minimum OpenClaw runtime version.

- bub client.py: t show -m → -n, t search --limit → -n
- openclaw CLAUDE.md: t show --limit → -n in CLI surface table
- alma skill + main.js: t show/t search --limit → -n in CLI playbook

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

coderabbitai Bot commented Mar 13, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Droid Nowledge Mem plugin (manifests, docs, hooks, skills, validation script, marketplace manifest), migrates OpenClaw client to runtime-based async CLI execution with constructor/signature changes, and standardizes thread CLI flags from --limit to -n across plugins and docs.

Changes

Cohort / File(s) Summary
CLI flag updates
nowledge-mem-alma-plugin/alma-skill-nowledge-mem.md, nowledge-mem-alma-plugin/main.js, nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py, nowledge-mem-openclaw-plugin/CLAUDE.md
Replaced long --limit (and -m) with short -n in examples and client argument construction for thread search/show; semantics and clamping unchanged.
OpenClaw client & runtime changes
nowledge-mem-openclaw-plugin/src/client.js, nowledge-mem-openclaw-plugin/src/spawn-env.js, nowledge-mem-openclaw-plugin/src/commands/slash.js, nowledge-mem-openclaw-plugin/src/hooks/behavioral.js, nowledge-mem-openclaw-plugin/src/tools/*, nowledge-mem-openclaw-plugin/src/index.js, nowledge-mem-openclaw-plugin/package.json, nowledge-mem-openclaw-plugin/openclaw.plugin.json, nowledge-mem-openclaw-plugin/CLAUDE.md, nowledge-mem-openclaw-plugin/CHANGELOG.md, nowledge-mem-openclaw-plugin/README.md
Introduces async runtimeSystem-based CLI execution, adds spawn-env builder, changes NowledgeMemClient constructor/signatures (accepts system), converts many exec calls to async with API fallbacks, updates behavioral hook to append system context, and bumps peer OpenClaw version and package metadata.
Droid plugin manifests & marketplace
nowledge-mem-droid-plugin/.factory-plugin/plugin.json, .factory-plugin/marketplace.json
Adds Droid plugin manifest and repository marketplace manifest describing the nowledge-mem Droid plugin.
Droid plugin docs & metadata
nowledge-mem-droid-plugin/README.md, nowledge-mem-droid-plugin/CHANGELOG.md, nowledge-mem-droid-plugin/RELEASING.md, README.md
Adds comprehensive README, changelog, releasing guide for the Droid plugin and adds an integrations row in the repo README.
Droid plugin commands & skills
nowledge-mem-droid-plugin/commands/*, nowledge-mem-droid-plugin/skills/*
Adds command and skill documentation (distill-memory, read-working-memory, save-handoff, search-memory, status) with usage examples, formats, and guidance.
Droid plugin hooks & validation script
nowledge-mem-droid-plugin/hooks/hooks.json, nowledge-mem-droid-plugin/scripts/validate-plugin.mjs
Adds SessionStart and UserPromptSubmit hooks (nmem detection, cross-platform fallbacks, compaction/read templates) and a validation script enforcing plugin shape/content rules.
Misc packaging & supporting docs
nowledge-mem-droid-plugin/*.md, nowledge-mem-droid-plugin/.factory-plugin/*, .factory-plugin/marketplace.json
Multiple supporting docs, changelogs, packaging manifests, and marketplace metadata added for the Droid plugin.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant DroidHook as "Droid Hook"
  participant Runtime as "OpenClaw Runtime"
  participant Nmem as "nmem CLI"
  participant FS as "Filesystem"

  User->>DroidHook: SessionStart
  DroidHook->>Runtime: runCommandWithTimeout("nmem --json wm read")
  alt nmem available
    Runtime-->>DroidHook: JSON briefing
    DroidHook-->>User: present Working Memory briefing
  else nmem missing or fails
    DroidHook->>FS: read ~/ai-now/memory.md
    alt file exists
      FS-->>DroidHook: memory.md content
      DroidHook-->>User: present fallback briefing
    else
      DroidHook-->>User: indicate no briefing available
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰
I nibble flags from long to small,
through hooks and docs I bound and sprawl.
I tuck a -n beneath my paw,
fetch briefings neat — then hop once more.
A merry hop, a tidy call.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary addition: a native Droid plugin for Nowledge Mem with CLI flag normalization across related plugins.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev_0611
📝 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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nowledge-mem-alma-plugin/main.js`:
- Around line 409-410: searchThreads and showThread use the long flag "--limit"
while documentation and examples use the short "-n"; update both runtime methods
(searchThreads and showThread) to accept and emit the short flag "-n" instead of
"--limit" so the CLI flag style matches the playbook/CLAUDE.md, and ensure any
parsing or help text references (e.g., flag registration or yargs/commander
setup within those functions) are changed accordingly to "-n" so behavior and
docs stay in sync.

In `@nowledge-mem-openclaw-plugin/CLAUDE.md`:
- Around line 124-125: The CLI docs show inconsistent flags for thread
pagination: `nmem --json t search <q> --limit N` vs `nmem --json t show <id> -n
N --offset O`; pick one canonical flag name (either `--limit N` or `-n N`) and
update the table entry for `nmem --json t search` to use the chosen flag so both
`client.searchThreadsFull()` and `client.fetchThread()` rows present the same
pagination flag; ensure the rest of the docs use that same flag for
thread-related commands.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35fe6365-5655-4ff8-8097-942a4117361d

📥 Commits

Reviewing files that changed from the base of the PR and between 58b78ef and 25f89c8.

📒 Files selected for processing (4)
  • nowledge-mem-alma-plugin/alma-skill-nowledge-mem.md
  • nowledge-mem-alma-plugin/main.js
  • nowledge-mem-bub-plugin/src/nowledge_mem_bub/client.py
  • nowledge-mem-openclaw-plugin/CLAUDE.md

Comment thread nowledge-mem-alma-plugin/main.js
Comment thread nowledge-mem-openclaw-plugin/CLAUDE.md Outdated
@wey-gu wey-gu changed the title fix(plugins): align CLI flags after t show -m → -n normalization feat(Droid): Add native Droid plugin for Nowledge Mem Mar 13, 2026

@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: 3

🧹 Nitpick comments (2)
nowledge-mem-droid-plugin/scripts/validate-plugin.mjs (1)

107-135: Make the runtime-surface checks pattern-based.

The current includes(...) checks are too literal: they would miss nmem --json t save --from droid, and they don't catch the stale t search/show --limit examples that already slipped into the new Droid docs/hooks. Regex checks here would make the validator enforce the CLI contract instead of just spot-checking phrases.

Suggested change
-if (pluginText.includes("nmem t save --from droid")) {
+if (/\bnmem(?:\s+--json)?\s+t\s+save\s+--from\s+droid\b/.test(pluginText)) {
   fail("plugin must not claim unsupported nmem t save --from droid behavior");
 } else {
   ok("no fake Droid transcript importer claim");
 }
 
 if (pluginText.includes("python3")) {
   fail("plugin should not require python3 just to load Working Memory");
 } else {
   ok("no python3 dependency in plugin runtime surfaces");
 }
+
+if (/\bnmem\s+--json\s+t\s+(?:search|show)\b[^\n]*\s--limit\b/.test(pluginText)) {
+  fail("plugin runtime surfaces must use -n for nmem t search/show pagination");
+} else {
+  ok("thread pagination flags are normalized to -n");
+}

Based on learnings: Keep validator script and documentation in sync when tool contracts or lifecycle behavior changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nowledge-mem-droid-plugin/scripts/validate-plugin.mjs` around lines 107 -
135, Replace the literal string checks on pluginText with regex-based tests:
instead of pluginText.includes("nmem t save --from droid") add a RegExp test
(with i and s flags) that matches the nmem CLI save pattern in any flag order,
e.g. something like new
RegExp("\\bnmem\\b.*\\b(t\\s+)?save\\b.*--from\\s+droid","is") to catch variants
like "nmem --json t save --from droid"; add another regex to detect stale t
search/show examples with limits, e.g. /\bt\b.*\b(search|show)\b.*--limit\b/i;
and replace the python3 literal check with a regex like /\bpython3\b/i (or
/\bpython3(?:\\.\\d+)?\b/i for versions) — update the pluginText.includes(...)
usages and corresponding fail/ok branches to use these RegExp.test(pluginText)
checks while keeping the same fail messages and symbols runtimeSurfaceFiles and
pluginText to locate the code.
nowledge-mem-droid-plugin/skills/distill-memory/SKILL.md (1)

36-38: Add --json to the m update example for consistency with downstream parsing requirements.

Line 28 uses nmem --json m add while line 37 uses nmem m update without the flag. For tool-driven workflows that depend on parseable JSON output, both commands should follow the same pattern.

🔧 Suggested doc patch
- nmem m update <id> -t "Updated title"
+ nmem --json m update <id> -t "Updated title"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nowledge-mem-droid-plugin/skills/distill-memory/SKILL.md` around lines 36 -
38, The example for the "m update" command in SKILL.md is missing the --json
flag and should be changed to match the parseable output used elsewhere; update
the example line containing `nmem m update <id> -t "Updated title"` to include
`--json` (so it mirrors the `nmem --json m add` pattern) so downstream tooling
receives JSON output.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nowledge-mem-droid-plugin/hooks/hooks.json`:
- Around line 10-19: Replace the bare "nmem wm read 2>/dev/null || cat
~/ai-now/memory.md" pattern in both SessionStart hooks with an explicit JSON
read and exists-check using "nmem --json wm read"; call "nmem --json wm read",
parse the JSON response to verify the briefing actually contains content (e.g.,
non-empty field or array) and only when that check fails fall back to "cat
~/ai-now/memory.md"; ensure errors from the nmem command
(server/auth/connection) are not treated as "no briefing" so they surface rather
than silently loading the local file, and keep the surrounding compact hook's
trailing printf intact.

In `@nowledge-mem-droid-plugin/README.md`:
- Around line 146-150: The README's "Validate Locally" section runs "node
scripts/validate-plugin.mjs" but doesn't state the required working directory;
update the README (Validate Locally block) to make the cwd explicit by
prepending a step to change into the nowledge-mem-droid-plugin directory (e.g.,
add "cd nowledge-mem-droid-plugin" before running node
scripts/validate-plugin.mjs) so the command is copy/paste safe and works from
the documented checkout flow.

In `@nowledge-mem-droid-plugin/scripts/validate-plugin.mjs`:
- Around line 3-8: The code uses process.cwd() to set pluginRoot/repoRoot which
breaks when the script is run from elsewhere; change path resolution to be
relative to the script file using import.meta.url (e.g., compute the scriptDir
via fileURLToPath(new URL(import.meta.url)) / path.dirname) and then set
pluginRoot = path.resolve(scriptDir) and repoRoot = path.resolve(pluginRoot,
".."); update the top imports to include fileURLToPath from 'url' if needed and
replace references to pluginRoot/repoRoot accordingly (look for the pluginRoot
and repoRoot variables).

---

Nitpick comments:
In `@nowledge-mem-droid-plugin/scripts/validate-plugin.mjs`:
- Around line 107-135: Replace the literal string checks on pluginText with
regex-based tests: instead of pluginText.includes("nmem t save --from droid")
add a RegExp test (with i and s flags) that matches the nmem CLI save pattern in
any flag order, e.g. something like new
RegExp("\\bnmem\\b.*\\b(t\\s+)?save\\b.*--from\\s+droid","is") to catch variants
like "nmem --json t save --from droid"; add another regex to detect stale t
search/show examples with limits, e.g. /\bt\b.*\b(search|show)\b.*--limit\b/i;
and replace the python3 literal check with a regex like /\bpython3\b/i (or
/\bpython3(?:\\.\\d+)?\b/i for versions) — update the pluginText.includes(...)
usages and corresponding fail/ok branches to use these RegExp.test(pluginText)
checks while keeping the same fail messages and symbols runtimeSurfaceFiles and
pluginText to locate the code.

In `@nowledge-mem-droid-plugin/skills/distill-memory/SKILL.md`:
- Around line 36-38: The example for the "m update" command in SKILL.md is
missing the --json flag and should be changed to match the parseable output used
elsewhere; update the example line containing `nmem m update <id> -t "Updated
title"` to include `--json` (so it mirrors the `nmem --json m add` pattern) so
downstream tooling receives JSON output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f77d299b-4cf7-450a-b1bc-5f28200a31f8

📥 Commits

Reviewing files that changed from the base of the PR and between 25f89c8 and 7c4a846.

📒 Files selected for processing (19)
  • .factory-plugin/marketplace.json
  • README.md
  • nowledge-mem-alma-plugin/main.js
  • nowledge-mem-droid-plugin/.factory-plugin/plugin.json
  • nowledge-mem-droid-plugin/CHANGELOG.md
  • nowledge-mem-droid-plugin/README.md
  • nowledge-mem-droid-plugin/RELEASING.md
  • nowledge-mem-droid-plugin/commands/nowledge-distill-memory.md
  • nowledge-mem-droid-plugin/commands/nowledge-read-working-memory.md
  • nowledge-mem-droid-plugin/commands/nowledge-save-handoff.md
  • nowledge-mem-droid-plugin/commands/nowledge-search-memory.md
  • nowledge-mem-droid-plugin/commands/nowledge-status.md
  • nowledge-mem-droid-plugin/hooks/hooks.json
  • nowledge-mem-droid-plugin/scripts/validate-plugin.mjs
  • nowledge-mem-droid-plugin/skills/distill-memory/SKILL.md
  • nowledge-mem-droid-plugin/skills/read-working-memory/SKILL.md
  • nowledge-mem-droid-plugin/skills/save-handoff/SKILL.md
  • nowledge-mem-droid-plugin/skills/search-memory/SKILL.md
  • nowledge-mem-openclaw-plugin/CLAUDE.md
✅ Files skipped from review due to trivial changes (8)
  • nowledge-mem-droid-plugin/commands/nowledge-distill-memory.md
  • nowledge-mem-droid-plugin/skills/save-handoff/SKILL.md
  • nowledge-mem-droid-plugin/.factory-plugin/plugin.json
  • nowledge-mem-droid-plugin/skills/search-memory/SKILL.md
  • nowledge-mem-droid-plugin/commands/nowledge-status.md
  • nowledge-mem-droid-plugin/RELEASING.md
  • nowledge-mem-droid-plugin/CHANGELOG.md
  • nowledge-mem-droid-plugin/commands/nowledge-save-handoff.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • nowledge-mem-alma-plugin/main.js

Comment thread nowledge-mem-droid-plugin/hooks/hooks.json Outdated
Comment thread nowledge-mem-droid-plugin/README.md
Comment thread nowledge-mem-droid-plugin/scripts/validate-plugin.mjs

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nowledge-mem-openclaw-plugin/src/client.js`:
- Around line 203-230: The exec method currently logs the full argv on error
which may contain sensitive message content; update exec (function exec,
variable argv) to avoid emitting raw arguments by producing a redacted
representation before logging (e.g., keep argv[0] and any flag-like strings,
replace non-flag args with "<redacted>" or log only the args count), then call
this.logger.error with the sanitized string instead of argv.join(" "). Ensure
the redaction is applied after resolveCommand/_apiUrlArgs() and before the
logger.error line that reports failures from runtimeSystem.runCommandWithTimeout
so no raw payloads are written to logs.
- Around line 910-913: The checkHealth() method currently calls
this.exec(["status"]) without the required --json flag; update the call in
checkHealth() to include the "--json" argument so it becomes
this.exec(["status", "--json"]) (preserving existing error handling and return
true) to adhere to the parseable-output contract for all nmem commands.

In `@nowledge-mem-openclaw-plugin/src/spawn-env.js`:
- Around line 7-15: buildNmemSpawnEnv currently clones process.env which allows
inherited NMEM_API_URL/NMEM_API_KEY to survive and override resolved plugin
config; modify buildNmemSpawnEnv to start from a fresh env object that
explicitly clears NMEM_API_URL and NMEM_API_KEY (do not copy them from
process.env), then overlay values from plugin config: if apiUrl is set and not
equal to LOCAL_API_URL set NMEM_API_URL, and if apiKey set NMEM_API_KEY; ensure
process.env values are only used if neither pluginConfig nor user config provide
them (i.e., consult process.env as a fallback rather than the initial source).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a54af957-18c3-4c50-aca4-c89094405b82

📥 Commits

Reviewing files that changed from the base of the PR and between 4bad112 and f50cacf.

⛔ Files ignored due to path filters (1)
  • nowledge-mem-openclaw-plugin/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • 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/commands/slash.js
  • nowledge-mem-openclaw-plugin/src/hooks/behavioral.js
  • nowledge-mem-openclaw-plugin/src/index.js
  • nowledge-mem-openclaw-plugin/src/spawn-env.js
  • nowledge-mem-openclaw-plugin/src/tools/forget.js
  • nowledge-mem-openclaw-plugin/src/tools/save.js
  • nowledge-mem-openclaw-plugin/src/tools/status.js
✅ Files skipped from review due to trivial changes (1)
  • nowledge-mem-openclaw-plugin/openclaw.plugin.json

Comment thread nowledge-mem-openclaw-plugin/src/client.js
Comment thread nowledge-mem-openclaw-plugin/src/client.js
Comment thread nowledge-mem-openclaw-plugin/src/spawn-env.js
@wey-gu wey-gu merged commit 69b63d3 into main Mar 15, 2026
1 check passed
@wey-gu wey-gu deleted the dev_0611 branch March 15, 2026 10:20
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