-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add OpenClaw client plugin #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+817
−0
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b01cb34
feat: add OpenClaw client plugin
07722e4
refactor: class-based plugin, add plugin tests
4eba17d
fix: address all 4 Copilot review findings
3efcd73
fix: address CodeRabbit and Copilot review findings
fbb7e79
fix: address second-round CodeRabbit review findings
c3604c9
fix: correct memory_types schema and reject invalid search filters
6d23ac3
fix: use integer type for limit parameter in plugin schema
96639fc
fix: add min/max bounds to limit and min_salience in tool schema
5fa27f6
fix: add kind field for OpenClaw memory plugin slot
2536414
fix: seal tool parameters against unknown properties
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json | ||
| language: "en-US" | ||
|
|
||
| reviews: | ||
| profile: "assertive" | ||
| high_level_summary: true | ||
| auto_review: | ||
| enabled: true | ||
| drafts: false | ||
| ignore_title_keywords: | ||
| - "wip" | ||
| - "draft" | ||
| auto_pause_after_reviewed_commits: 0 | ||
| path_filters: | ||
| - "!go.sum" | ||
| - "!**/package-lock.json" | ||
| - "!**/pnpm-lock.yaml" | ||
| - "!**/yarn.lock" | ||
| - "!**/*.snap" | ||
| - "!**/dist/**" | ||
| - "!**/build/**" | ||
| - "!**/.vitepress/dist/**" | ||
| - "!**/coverage/**" | ||
| - "!**/.next/**" | ||
| - "!**/site/**" | ||
| - "!**/docs/.vitepress/cache/**" | ||
| - "!**/*.min.js" | ||
| - "!**/*.generated.*" | ||
| - "!**/*pb.go" | ||
|
|
||
| chat: | ||
| auto_reply: true | ||
|
|
||
| knowledge_base: | ||
| code_guidelines: | ||
| enabled: true | ||
| filePatterns: | ||
| - "CONTRIBUTING.md" | ||
| - "README.md" | ||
| - "docs/**/*.md" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,3 +65,4 @@ node_modules/ | |
| # Plan files | ||
| plan.md | ||
| .claude/ | ||
| clients/openclaw/package-lock.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| node_modules/ | ||
| dist/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # OpenClaw Membrane Plugin | ||
|
|
||
| [OpenClaw](https://github.com/openclaw/openclaw) plugin that bridges to [Membrane](https://github.com/GustyCube/membrane) — giving your AI agents episodic memory. | ||
|
|
||
| ## What it does | ||
|
|
||
| - **Ingests** agent events, tool outputs, and observations into Membrane | ||
| - **Searches** episodic memory via the `membrane_search` tool | ||
| - **Auto-injects** relevant context before each agent turn | ||
| - **Reports** connection status via the `/membrane` command | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| # In your OpenClaw extensions directory | ||
| npm install @vainplex/openclaw-membrane | ||
| ``` | ||
|
|
||
| Or with [Brainplex](https://www.npmjs.com/package/brainplex): | ||
|
|
||
| ```bash | ||
| npx brainplex init # Auto-detects and configures all plugins | ||
| ``` | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - A running [Membrane](https://github.com/GustyCube/membrane) instance (the `membraned` daemon) | ||
| - OpenClaw v0.10+ | ||
|
|
||
| ## Configuration | ||
|
|
||
| In your OpenClaw config (`openclaw.yaml`), under `plugins.entries`: | ||
|
|
||
| ```yaml | ||
| plugins: | ||
| entries: | ||
| openclaw-membrane: | ||
| enabled: true | ||
| config: | ||
| grpc_endpoint: "localhost:4222" | ||
| default_sensitivity: "low" | ||
| auto_context: true | ||
| context_limit: 5 | ||
| min_salience: 0.3 | ||
| context_types: ["episodic", "semantic", "competence"] | ||
| ``` | ||
|
|
||
| | Option | Default | Description | | ||
| |--------|---------|-------------| | ||
| | `grpc_endpoint` | `localhost:4222` | Membrane gRPC address | | ||
| | `default_sensitivity` | `low` | Sensitivity for ingested events: `public`, `low`, `medium`, `high`, `hyper` | | ||
| | `auto_context` | `true` | Auto-inject memories before each agent turn | | ||
| | `context_limit` | `5` | Max memories to inject | | ||
| | `min_salience` | `0.3` | Minimum salience score for retrieval | | ||
| | `context_types` | `["episodic", "semantic", "competence"]` | Memory types: `episodic`, `working`, `semantic`, `competence`, `plan_graph` | | ||
|
|
||
|
|
||
| ## Usage | ||
|
|
||
| ### membrane_search tool | ||
|
|
||
| Your agent can search episodic memory: | ||
|
|
||
| ```javascript | ||
| membrane_search("what happened in yesterday's meeting", { limit: 10 }) | ||
| ``` | ||
|
|
||
| ### Auto-context | ||
|
|
||
| When `auto_context: true`, the plugin injects relevant memories into the agent's context before each turn. This gives agents awareness of past interactions without explicit tool calls. | ||
|
|
||
| ### /membrane command | ||
|
|
||
| Check connection status: | ||
|
|
||
| ```text | ||
| /membrane | ||
| → Membrane: connected (localhost:4222) | 1,247 records | 3 memory types | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ```text | ||
| OpenClaw Agent | ||
| │ | ||
| ├── after_agent_reply ──→ ingestEvent() | ||
| ├── after_tool_call ────→ ingestToolOutput() | ||
| ├── before_agent_start ─→ retrieve() → inject context | ||
| │ | ||
| └── membrane_search ───→ retrieve() → return results | ||
| │ | ||
| ▼ | ||
| Membrane (gRPC) | ||
| ┌─────────────┐ | ||
| │ membraned │ | ||
| │ SQLCipher │ | ||
| │ Embeddings │ | ||
| └─────────────┘ | ||
| ``` | ||
|
|
||
| ## Development | ||
|
|
||
| ```bash | ||
| cd clients/openclaw | ||
| npm install | ||
| npm run build | ||
| npm test | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| MIT — see [LICENSE](../../LICENSE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| { | ||
| "id": "openclaw-membrane", | ||
| "kind": "memory", | ||
| "name": "openclaw-membrane", | ||
| "version": "0.4.0", | ||
| "description": "Membrane episodic memory bridge — ingest events, search memories, auto-inject context", | ||
| "configSchema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "grpc_endpoint": { "type": "string", "default": "localhost:4222" }, | ||
| "default_sensitivity": { "type": "string", "enum": ["public", "low", "medium", "high", "hyper"], "default": "low" }, | ||
| "auto_context": { "type": "boolean", "default": true }, | ||
| "context_limit": { "type": "integer", "minimum": 1, "default": 5 }, | ||
| "min_salience": { "type": "number", "minimum": 0, "maximum": 1, "default": 0.3 }, | ||
| "context_types": { | ||
| "type": "array", | ||
| "items": { "type": "string", "enum": ["episodic", "working", "semantic", "competence", "plan_graph"] }, | ||
| "default": ["episodic", "semantic", "competence"] | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
| }, | ||
| "hooks": [ | ||
| "after_agent_reply", | ||
| "after_tool_call", | ||
| "before_agent_start" | ||
| ], | ||
| "tools": [ | ||
| { | ||
| "name": "membrane_search", | ||
| "description": "Search episodic memory in Membrane for relevant context", | ||
| "parameters": { | ||
| "type": "object", | ||
| "properties": { | ||
| "query": { "type": "string", "description": "Natural language query to search memories" }, | ||
| "limit": { "type": "integer", "minimum": 1, "description": "Maximum results to return (default: 5)" }, | ||
| "memory_types": { "type": "array", "items": { "type": "string", "enum": ["episodic", "working", "semantic", "competence", "plan_graph"] }, "description": "Filter by memory type: episodic, working, semantic, competence, plan_graph" }, | ||
| "min_salience": { "type": "number", "minimum": 0, "maximum": 1, "description": "Minimum salience score (0-1, default: 0.3)" } | ||
| }, | ||
| "required": ["query"], | ||
| "additionalProperties": false | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ], | ||
| "commands": [ | ||
| { | ||
| "name": "membrane", | ||
| "description": "Show Membrane connection status and memory stats" | ||
| } | ||
| ] | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "name": "@vainplex/openclaw-membrane", | ||
| "version": "0.4.0", | ||
| "description": "Membrane bridge plugin for OpenClaw — episodic memory ingestion, search, and auto-context injection", | ||
| "license": "MIT", | ||
| "author": "Vainplex <dev@vainplex.de>", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/GustyCube/membrane.git", | ||
| "directory": "clients/openclaw" | ||
| }, | ||
| "homepage": "https://github.com/GustyCube/membrane", | ||
| "bugs": { | ||
| "url": "https://github.com/GustyCube/membrane/issues" | ||
| }, | ||
| "type": "module", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.js", | ||
| "types": "./dist/index.d.ts" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "openclaw.plugin.json", | ||
| "README.md" | ||
| ], | ||
| "scripts": { | ||
| "build": "rm -rf dist && tsc", | ||
| "test": "vitest run" | ||
| }, | ||
| "dependencies": { | ||
| "@gustycube/membrane": "^0.1.4" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "^5.7.0", | ||
| "vitest": "^3.0.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.