@ephemushroom/opencode-claude-mem 0.2.2 → 0.2.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/README.md +3 -7
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -41
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -8,11 +8,10 @@ Enables OpenCode to share the same memory database as Claude Code — observatio
|
|
|
8
8
|
|
|
9
9
|
This plugin communicates with the Claude-Mem worker service (HTTP API on port 37777) to:
|
|
10
10
|
|
|
11
|
-
- **Inject memory context** — previous session context is injected into the system prompt on every LLM call
|
|
11
|
+
- **Inject memory context** — previous session context is automatically injected into the system prompt on every LLM call
|
|
12
12
|
- **Capture tool observations** — every tool execution is recorded as a structured observation
|
|
13
13
|
- **Summarize sessions** — when a session goes idle, the last user/assistant messages are sent for summarization
|
|
14
14
|
- **Search memory** — memory search is available via claude-mem's MCP server
|
|
15
|
-
- **View context on demand** — `/memory` command displays the current memory context in the chat flow
|
|
16
15
|
|
|
17
16
|
## Differences from Claude Code Version
|
|
18
17
|
|
|
@@ -25,7 +24,6 @@ This OpenCode version works differently:
|
|
|
25
24
|
| **Architecture** | Shell commands (`node script.js`) | JavaScript plugin API |
|
|
26
25
|
| **Context injection** | `SessionStart` hook stdout → system prompt (once) | `experimental.chat.system.transform` → system prompt (every LLM call, session-level cache) |
|
|
27
26
|
| **Context freshness** | Snapshot at session start | Cached once per session (same as Claude Code) |
|
|
28
|
-
| **User-visible context** | Displayed in TUI automatically | `/memory` command to view on demand |
|
|
29
27
|
| **Session init** | `UserPromptSubmit` hook | `chat.message` hook with real user prompt |
|
|
30
28
|
| **Observations** | `PostToolUse` hook | `tool.execute.after` hook (with circular memory protection) |
|
|
31
29
|
| **Summarization** | `Stop` hook | `session.idle` event |
|
|
@@ -78,14 +76,12 @@ curl -s http://127.0.0.1:37777/api/health
|
|
|
78
76
|
|
|
79
77
|
Once installed, the plugin works automatically:
|
|
80
78
|
|
|
81
|
-
- **System prompt injection** — memory context is injected into every LLM call via `experimental.chat.system.transform`. The LLM sees your project's observation history, past decisions, and session summaries. Context is cached once per session to avoid redundant worker calls.
|
|
79
|
+
- **System prompt injection** — memory context is automatically injected into every LLM call via `experimental.chat.system.transform`. The LLM sees your project's observation history, past decisions, and session summaries. Context is cached once per session to avoid redundant worker calls.
|
|
82
80
|
- **Tool observation capture** — every tool execution (file reads, edits, searches, etc.) is recorded as an observation in the memory database. Claude-mem's own MCP tools are automatically filtered to prevent circular memory.
|
|
83
81
|
- **Session summarization** — when a session goes idle, the last user/assistant exchange is summarized and stored.
|
|
84
82
|
- **Toast notification** — on session start, a "Memory active · {project}" toast confirms the plugin is connected to the worker.
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Type `/memory` in the chat to display the current memory context inline. This shows you exactly what the LLM sees in its system prompt — the observation index, token economics, and session history.
|
|
84
|
+
**Note**: Memory context is injected transparently into every conversation. You don't need to run any commands — the plugin works automatically in the background.
|
|
89
85
|
|
|
90
86
|
### Memory Search
|
|
91
87
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,13 @@ import { type Plugin } from '@opencode-ai/plugin';
|
|
|
3
3
|
* OpenCode Plugin for Claude-Mem
|
|
4
4
|
*
|
|
5
5
|
* Hooks used:
|
|
6
|
-
* - `config` — register /memory command
|
|
7
|
-
* - `command.execute.before` — handle /memory command
|
|
8
6
|
* - `event` — session lifecycle (session.created, session.idle)
|
|
9
7
|
* - `tool.execute.after` — capture tool observations
|
|
10
8
|
* - `experimental.chat.system.transform` — inject memory context into system prompt
|
|
11
9
|
* - `chat.message` — session init with real user prompt
|
|
12
10
|
*
|
|
13
|
-
*
|
|
11
|
+
* Memory context is automatically injected into every conversation via system prompt.
|
|
12
|
+
* No manual commands needed - the plugin works transparently in the background.
|
|
14
13
|
*/
|
|
15
14
|
export declare const ClaudeMemPlugin: Plugin;
|
|
16
15
|
declare const _default: {
|
package/dist/index.js
CHANGED
|
@@ -109,19 +109,6 @@ var ClaudeMemPlugin = async (ctx) => {
|
|
|
109
109
|
});
|
|
110
110
|
} catch {}
|
|
111
111
|
}
|
|
112
|
-
async function sendStatusMessage(sessionId, text) {
|
|
113
|
-
try {
|
|
114
|
-
await client.session.prompt({
|
|
115
|
-
path: { id: sessionId },
|
|
116
|
-
body: {
|
|
117
|
-
noReply: true,
|
|
118
|
-
parts: [{ type: "text", text, ignored: true }]
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
} catch {
|
|
122
|
-
await toast(text.slice(0, 200), "info");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
112
|
let contextCache = undefined;
|
|
126
113
|
async function getCachedContext() {
|
|
127
114
|
if (contextCache !== undefined) {
|
|
@@ -174,34 +161,6 @@ var ClaudeMemPlugin = async (ctx) => {
|
|
|
174
161
|
`).trim();
|
|
175
162
|
}
|
|
176
163
|
return {
|
|
177
|
-
config: async (input) => {
|
|
178
|
-
input.command ??= {};
|
|
179
|
-
input.command["memory"] = {
|
|
180
|
-
template: "/memory",
|
|
181
|
-
description: "Show memory context from Claude-Mem"
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
|
-
"command.execute.before": async (input) => {
|
|
185
|
-
if (input.command !== "memory") {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const sessionId = input.sessionID || currentSessionId;
|
|
189
|
-
if (!sessionId) {
|
|
190
|
-
throw new Error("__MEMORY_NO_SESSION__");
|
|
191
|
-
}
|
|
192
|
-
const isHealthy = await checkWorkerAndToast();
|
|
193
|
-
if (!isHealthy) {
|
|
194
|
-
await sendStatusMessage(sessionId, "\u26A0 Claude-Mem worker is offline");
|
|
195
|
-
throw new Error("__MEMORY_HANDLED__");
|
|
196
|
-
}
|
|
197
|
-
const context = await getCachedContext();
|
|
198
|
-
if (context) {
|
|
199
|
-
await sendStatusMessage(sessionId, context);
|
|
200
|
-
} else {
|
|
201
|
-
await sendStatusMessage(sessionId, `No memory context available for ${projectName}`);
|
|
202
|
-
}
|
|
203
|
-
throw new Error("__MEMORY_HANDLED__");
|
|
204
|
-
},
|
|
205
164
|
event: async ({ event }) => {
|
|
206
165
|
if (event.type === "session.created") {
|
|
207
166
|
const sessionId = event.properties?.info?.id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ephemushroom/opencode-claude-mem",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "OpenCode plugin for Claude-Mem persistent memory system",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -48,10 +48,8 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@opencode-ai/plugin": "^1.3.0"
|
|
53
|
-
},
|
|
54
51
|
"devDependencies": {
|
|
52
|
+
"@opencode-ai/plugin": "^1.3.0",
|
|
55
53
|
"@types/bun": "latest",
|
|
56
54
|
"oxfmt": "^0.33.0",
|
|
57
55
|
"oxlint": "^1.48.0",
|