Skip to content

0916: grok build support and Hermes stale plugin issue - #310

Merged
wey-gu merged 5 commits into
mainfrom
dev_0916
Jun 18, 2026
Merged

0916: grok build support and Hermes stale plugin issue#310
wey-gu merged 5 commits into
mainfrom
dev_0916

Conversation

@wey-gu

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

Copy link
Copy Markdown
Member

Note

Medium Risk
Grok hook routing changes how sessions are labeled and captured in Mem; incorrect detection could still mis-tag threads. Hermes changes are mostly install/diagnostic but affect which API path users run after updates.

Overview
Grok Build is now a first-class integration on the same nowledge-mem-claude-code-plugin package (bumped to 0.7.11). Registry, README, marketplace, and user-override docs describe install via grok plugin install … and Grok-specific nmem usage.

The shared hooks resolve GROK_PLUGIN_ROOT ahead of CLAUDE_PLUGIN_ROOT, detect Grok from GROK_SESSION_ID / GROK_HOOK_EVENT / GROK_WORKSPACE_ROOT, and route Context Bundle reads with --source-app grok and transcript capture with nmem t save --from grok (plus Grok session/workspace env for ids and project paths). That fixes Grok sessions being stored as Claude Code. Skills, slash-command docs, and hook tests cover the Grok path.

Hermes (0.5.18): setup.sh prints installed version and thread import endpoint from the files it wrote, overwrites stale copies (e.g. old client.py still pointing at /threads), and tests assert reinstall behavior. npx-skills check-integration documents verifying Thread import endpoint: /threads/import and the correct HERMES_HOME.

Reviewed by Cursor Bugbot for commit 90285a1. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features
    • Added Grok integration support alongside Claude Code for session management, working memory reads, and save/import flows.
    • Expanded integration registry and lifecycle hook routing to recognize Grok runtime signals.
  • Bug Fixes
    • Prevented Grok sessions from being mislabeled as Claude Code.
    • Improved Hermes installer robustness by overwriting stale local provider files and verifying the import endpoint.
  • Documentation
    • Updated plugin, skills, and setup/verification guides for Grok (plus integration and override guidance), and refreshed Docker image/tag verification instructions.
  • Tests
    • Added Grok hook read/save test coverage and strengthened Hermes installer verification tests.
  • Chores
    • Bumped plugin versions (Claude Code/Grok plugin to 0.7.12, Hermes to 0.5.18).

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a3c1d8a0-0ba4-4152-bd13-a315a9a34eed

📥 Commits

Reviewing files that changed from the base of the PR and between 90285a1 and 820e263.

📒 Files selected for processing (14)
  • .claude-plugin/marketplace.json
  • docker/README.md
  • docker/compose.yaml
  • integrations.json
  • nowledge-mem-claude-code-plugin/.claude-plugin/plugin.json
  • nowledge-mem-claude-code-plugin/CHANGELOG.md
  • nowledge-mem-claude-code-plugin/README.md
  • nowledge-mem-claude-code-plugin/commands/save.md
  • nowledge-mem-claude-code-plugin/scripts/nmem-hook-read.sh
  • nowledge-mem-claude-code-plugin/scripts/nmem-hook-save.py
  • nowledge-mem-claude-code-plugin/skills/read-working-memory/SKILL.md
  • nowledge-mem-claude-code-plugin/skills/save-thread/SKILL.md
  • nowledge-mem-claude-code-plugin/tests/test_nmem_hook_read.py
  • nowledge-mem-claude-code-plugin/tests/test_nmem_hook_save.py

📝 Walkthrough

Walkthrough

The PR adds Grok as a supported runtime alongside Claude Code in the nowledge-mem plugin. Hook scripts now detect Grok from environment variables and route --source-app grok / --from grok accordingly. The integrations registry gains a full Grok entry, manifests bump to 0.7.12, and all docs/skills are updated. Separately, the Hermes setup.sh gains two helper functions that print the installed plugin version and thread import endpoint after installation. Docker image tag references are updated to use :latest or a newer pinned version.

Changes

Grok Integration for nowledge-mem Plugin

Layer / File(s) Summary
Integration registry and plugin manifests
integrations.json, nowledge-mem-claude-code-plugin/.claude-plugin/plugin.json, .claude-plugin/marketplace.json
integrations.json adds "grok" to connect.appliesTo, inserts a full id: "grok" integration object (version 0.7.12, CLI transport, thread-save/sync commands, skills/slash wiring), bumps claude-code to 0.7.12 and hermes to 0.5.18. Plugin manifests update description to include Grok and increment version to 0.7.12.
Hook runtime detection and script routing
nowledge-mem-claude-code-plugin/hooks/hooks.json, nowledge-mem-claude-code-plugin/scripts/nmem-hook-read.sh, nowledge-mem-claude-code-plugin/scripts/nmem-hook-save.py
All four lifecycle hooks derive ROOT from GROK_PLUGIN_ROOT falling back to CLAUDE_PLUGIN_ROOT. nmem-hook-read.sh sets SOURCE_APP from Grok env vars and passes it as --source-app. nmem-hook-save.py adds _host_runtime/_runtime_label helpers, extends session_id/cwd fallbacks for Grok, and passes --from <runtime> dynamically.
Tests for Grok-aware hook behavior
nowledge-mem-claude-code-plugin/tests/test_nmem_hook_read.py, nowledge-mem-claude-code-plugin/tests/test_nmem_hook_save.py
New tests verify --source-app grok is selected when Grok env vars are present. New tests verify _build_command produces --from grok, uses GROK_SESSION_ID, and uses GROK_WORKSPACE_ROOT for --project even when payload is empty.
Skill and command documentation for Grok
nowledge-mem-claude-code-plugin/skills/*/SKILL.md, nowledge-mem-claude-code-plugin/commands/save.md
read-working-memory and save-thread skill docs add Grok command examples, dual --from flows, grok-{session_id} thread ID format, and cross-tool continuity step. save.md adds Grok usage, -s/-m all examples, and Grok session auto-detection output path.
Plugin README, changelogs, and cross-tool docs
nowledge-mem-claude-code-plugin/README.md, nowledge-mem-claude-code-plugin/CHANGELOG.md, README.md, docs/USER_OVERRIDE_GUIDE.md, nowledge-mem-npx-skills/skills/*, nowledge-mem-npx-skills/CHANGELOG.md
Plugin README adds Grok install snippet, lifecycle hook distinctions, and import commands. Root README adds Grok row to integrations table. USER_OVERRIDE_GUIDE adds Grok override-surfaces row. npx-skills check-integration adds Grok connector entry and Hermes endpoint verification step. 0.7.12 changelog entry recorded.

Hermes Installer Version and Endpoint Reporting

Layer / File(s) Summary
setup.sh helper functions and completion output
nowledge-mem-hermes/setup.sh, nowledge-mem-hermes/plugin.yaml
Adds plugin_version_for_dir (reads version: from plugin.yaml) and thread_endpoint_for_dir (greps client.py for route strings). Post-install output now prints both values; legacy copy installation prints them too. plugin.yaml bumped to 0.5.18.
Hermes tests, README, and changelog
nowledge-mem-hermes/tests/test_setup.sh, nowledge-mem-hermes/README.md, nowledge-mem-hermes/CHANGELOG.md
Test script derives EXPECTED_VERSION from plugin.yaml and asserts installer output includes version and /threads/import. New regression test verifies stale client.py is overwritten on reinstall. README gains troubleshooting item and Update section with sample output and HERMES_HOME guidance. 0.5.18 changelog entry added.

Docker Configuration and Documentation Tag Updates

Layer / File(s) Summary
Docker image tag and compose configuration updates
docker/README.md, docker/compose.yaml
README updates cosign verify and docker pull examples from pinned 0.9.15 to :latest tag. compose.yaml updates cosign verification comment example to :latest and bumps default NMEM_IMAGE_TAG fallback from 0.9.15 to 0.9.16.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • nowledge-co/community#141: Both PRs modify integrations.json to extend the integration registry with new entries and updated connect.appliesTo/integrations[] content.
  • nowledge-co/community#220: Both PRs touch scripts/nmem-hook-save.py command-building logic — this PR extends it to select --from grok, while PR #220 refactored the --from claude-code retry and legacy fallback flow.
  • nowledge-co/community#231: This PR builds directly on the hook-read refactor from PR #231, reusing the centralized nmem-hook-read.sh wiring and extending it with Grok env-var detection for --source-app grok.

Poem

🐇 Hippity-hop, a new tool in the warren!
Grok and Claude Code now share the same burrow,
--source-app grok sniffed out from the env,
Hooks know their runtime, no mislabeling then.
Setup.sh prints the version and endpoint with flair —
This rabbit's quite proud of the changes in there! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main objectives: adding Grok build support across multiple integrations and addressing the Hermes stale plugin detection issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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_0916

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.

The headless image default must track the release so fresh / NAS-app
installs pull this version (the preflight guard enforces it). Switch the
cosign-verify and docker-pull example commands to :latest so they no
longer need a per-release bump.

Co-Authored-By: Wey Gu <weyl.gu@gmail.com>
@wey-gu
wey-gu requested a review from Copilot June 18, 2026 02:44

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 90285a1. Configure here.

or os.environ.get("GROK_WORKSPACE_ROOT")
):
return "grok"
return "claude-code"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Runtime detection ignores plugin root

Medium Severity

Hook commands resolve scripts via GROK_PLUGIN_ROOT, but _host_runtime() and SOURCE_APP only flip to Grok when GROK_SESSION_ID, GROK_HOOK_EVENT, or GROK_WORKSPACE_ROOT are set. A Grok hook run that exports the plugin root without those three vars would still call nmem with --from claude-code and --source-app claude-code, mislabeling sessions again.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 90285a1. Configure here.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 90285a1ea6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@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.

🧹 Nitpick comments (1)
nowledge-mem-hermes/setup.sh (1)

141-161: ⚡ Quick win

Harden helper parsing to avoid blank/false-unknown diagnostics.

On Line 147 and Lines 152/156, the parser is brittle: version can print empty, and endpoint detection depends on double quotes only. A tiny fallback makes post-install diagnostics more reliable.

Suggested patch
 plugin_version_for_dir() {
   local target_dir="$1"
   if [ ! -f "$target_dir/plugin.yaml" ]; then
     printf 'unknown'
     return
   fi
-  sed -n "s/^version:[[:space:]]*//p" "$target_dir/plugin.yaml" | head -n 1 | tr -d "\"'"
+  local v
+  v="$(sed -n "s/^version:[[:space:]]*//p" "$target_dir/plugin.yaml" | head -n 1 | tr -d "\"'")"
+  if [ -n "$v" ]; then
+    printf '%s' "$v"
+  else
+    printf 'unknown'
+  fi
 }
 
 thread_endpoint_for_dir() {
   local target_dir="$1"
-  if grep -qF '"/threads/import"' "$target_dir/client.py" 2>/dev/null; then
+  if grep -qE '["'"'"']/threads/import["'"'"']' "$target_dir/client.py" 2>/dev/null; then
     printf '/threads/import'
     return
   fi
-  if grep -qF '"/threads"' "$target_dir/client.py" 2>/dev/null; then
+  if grep -qE '["'"'"']/threads["'"'"']' "$target_dir/client.py" 2>/dev/null; then
     printf '/threads'
     return
   fi
   printf 'unknown'
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nowledge-mem-hermes/setup.sh` around lines 141 - 161, The
plugin_version_for_dir function and thread_endpoint_for_dir function have
brittle parsing logic that can produce empty or unreliable results. In
plugin_version_for_dir, the sed pipeline may extract an empty version string
instead of defaulting to "unknown". Add a fallback check after the version
extraction to ensure that if the extracted version is empty, "unknown" is output
instead. In thread_endpoint_for_dir, the grep patterns are overly strict and
depend only on double-quote formatting, making endpoint detection fragile. Make
the grep patterns more flexible to handle variations (such as single quotes or
no quotes) in the client.py file, or add additional fallback grep patterns to
check for alternative endpoint formats before defaulting to "unknown".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@nowledge-mem-hermes/setup.sh`:
- Around line 141-161: The plugin_version_for_dir function and
thread_endpoint_for_dir function have brittle parsing logic that can produce
empty or unreliable results. In plugin_version_for_dir, the sed pipeline may
extract an empty version string instead of defaulting to "unknown". Add a
fallback check after the version extraction to ensure that if the extracted
version is empty, "unknown" is output instead. In thread_endpoint_for_dir, the
grep patterns are overly strict and depend only on double-quote formatting,
making endpoint detection fragile. Make the grep patterns more flexible to
handle variations (such as single quotes or no quotes) in the client.py file, or
add additional fallback grep patterns to check for alternative endpoint formats
before defaulting to "unknown".

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d364aba0-c8f4-48c5-a49c-a7fa79631f67

📥 Commits

Reviewing files that changed from the base of the PR and between e42d91d and 90285a1.

📒 Files selected for processing (23)
  • .claude-plugin/marketplace.json
  • README.md
  • docs/USER_OVERRIDE_GUIDE.md
  • integrations.json
  • nowledge-mem-claude-code-plugin/.claude-plugin/plugin.json
  • nowledge-mem-claude-code-plugin/CHANGELOG.md
  • nowledge-mem-claude-code-plugin/README.md
  • nowledge-mem-claude-code-plugin/commands/save.md
  • nowledge-mem-claude-code-plugin/hooks/hooks.json
  • nowledge-mem-claude-code-plugin/scripts/nmem-hook-read.sh
  • nowledge-mem-claude-code-plugin/scripts/nmem-hook-save.py
  • nowledge-mem-claude-code-plugin/skills/read-working-memory/SKILL.md
  • nowledge-mem-claude-code-plugin/skills/save-thread/SKILL.md
  • nowledge-mem-claude-code-plugin/tests/test_nmem_hook_read.py
  • nowledge-mem-claude-code-plugin/tests/test_nmem_hook_save.py
  • nowledge-mem-hermes/CHANGELOG.md
  • nowledge-mem-hermes/README.md
  • nowledge-mem-hermes/plugin.yaml
  • nowledge-mem-hermes/setup.sh
  • nowledge-mem-hermes/tests/test_setup.sh
  • nowledge-mem-npx-skills/CHANGELOG.md
  • nowledge-mem-npx-skills/skills/check-integration/SKILL.md
  • nowledge-mem-npx-skills/skills/read-working-memory/SKILL.md

@wey-gu
wey-gu merged commit 82686b9 into main Jun 18, 2026
1 check was pending
@wey-gu
wey-gu deleted the dev_0916 branch June 18, 2026 03: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.

2 participants