@vainplex/openclaw-membrane 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.4] — 2026-03-04
4
+
5
+ ### Fixed
6
+ - **Assistant messages now captured in Membrane.** Added `agent_end` hook workaround for `message_sent` not firing from gateway delivery pipeline in OpenClaw v2026.3.x. Only captures the last assistant message per turn (avoids flooding with entire conversation history).
7
+ - **Removed `after_tool_call` hook.** Tool calls are operational logs (~95% of Membrane volume) and drown out actual conversations. Tool data is already captured in the NATS event store.
8
+
3
9
  ## [0.3.0] — 2026-02-23
4
10
 
5
11
  ### Added
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @vainplex/openclaw-membrane
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@vainplex/openclaw-membrane)](https://www.npmjs.com/package/@vainplex/openclaw-membrane)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  Membrane gRPC bridge for OpenClaw — persistent episodic memory via [GustyCube/membrane](https://github.com/GustyCube/membrane) sidecar.
4
7
 
5
8
  **What it does:** Every conversation, tool call, and decision flows into Membrane's biological memory model. Memories decay over time. Frequently accessed ones grow stronger. Your agent remembers what matters and forgets what doesn't.
package/dist/index.js CHANGED
@@ -166,6 +166,34 @@ const plugin = {
166
166
  api.on('message_received', hookHandler('message_received'));
167
167
  api.on('message_sent', hookHandler('message_sent'));
168
168
  api.on('message_sending', hookHandler('message_sending'));
169
+ // Workaround: message_sent hook doesn't fire from gateway delivery pipeline
170
+ // in OpenClaw v2026.3.x. Use agent_end to capture assistant messages instead.
171
+ // Only captures the LAST assistant message to avoid flooding with entire history.
172
+ // TODO: Remove when upstream fixes plugin hook bridging. PR: openclaw/openclaw#XXX
173
+ api.on('agent_end', (event, ctx) => {
174
+ const e = event;
175
+ if (!e.success || !e.messages)
176
+ return;
177
+ const messages = e.messages;
178
+ // Find the LAST assistant message only (not entire history)
179
+ for (let i = messages.length - 1; i >= 0; i--) {
180
+ const msg = messages[i];
181
+ if (msg.role !== 'assistant')
182
+ continue;
183
+ const content = typeof msg.content === 'string'
184
+ ? msg.content
185
+ : Array.isArray(msg.content)
186
+ ? msg.content
187
+ .filter((b) => b.type === 'text' && typeof b.text === 'string')
188
+ .map((b) => b.text)
189
+ .join('\n')
190
+ : '';
191
+ if (!content || content.length < 10)
192
+ break;
193
+ handleEvent({ type: 'message_sent', payload: { content }, context: ctx }, config, reliability, logger);
194
+ break; // Only the last one
195
+ }
196
+ });
169
197
  // after_tool_call removed — tool calls are operational logs, not memories.
170
198
  // They flood Membrane (~95% of volume) and drown out actual conversations.
171
199
  // Tool data is already captured in NATS event store.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vainplex/openclaw-membrane",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "description": "Membrane gRPC bridge for OpenClaw — episodic memory ingestion, search tool, and auto-context injection via Membrane sidecar",
6
6
  "main": "dist/index.js",