@ephemushroom/opencode-claude-mem 0.3.2 → 0.4.0
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 +43 -18
- package/dist/index.js +12451 -4
- package/dist/tui.d.ts +32 -0
- package/dist/tui.js +488 -0
- package/dist/worker-client.d.ts +31 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -39,9 +39,13 @@ into new OpenCode sessions automatically.
|
|
|
39
39
|
compaction so long conversations keep their historical context.
|
|
40
40
|
- **Observation Capture** — Sends tool observations to Claude-Mem for future
|
|
41
41
|
retrieval and summarization.
|
|
42
|
-
- **Native Memory
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
- **Native Memory Tools** — Exposes `mem-search`, `mem-timeline`, and
|
|
43
|
+
`mem-get-observations` OpenCode tools backed by the Claude-Mem worker API,
|
|
44
|
+
covering the full search → timeline → details workflow without the Claude
|
|
45
|
+
Code compatibility bridge or an MCP server.
|
|
46
|
+
- **Sidebar Status** — Registers a TUI sidebar panel ("Memory") showing worker
|
|
47
|
+
health, project, observation/summary/session counts, and processing queue
|
|
48
|
+
depth, refreshed every few seconds.
|
|
45
49
|
- **Observation Hardening** — Skips low-value meta tools, strips
|
|
46
50
|
`<claude-mem-context>` and `<private>` tags before storage, and truncates
|
|
47
51
|
oversized observation payloads by UTF-8 byte size.
|
|
@@ -91,7 +95,9 @@ The worker endpoint is resolved in this order: `CLAUDE_MEM_WORKER_HOST` /
|
|
|
91
95
|
| `SessionStart` | `experimental.session.compacting` | Preserve memory during compaction |
|
|
92
96
|
| `UserPromptSubmit` | `chat.message` | Initialize session with real user prompt |
|
|
93
97
|
| `PostToolUse` | `tool.execute.after` | Capture tool observations |
|
|
94
|
-
| Claude-Mem MCP | `tool` (`mem-search`) | Search memory from OpenCode |
|
|
98
|
+
| Claude-Mem MCP `search` | `tool` (`mem-search`) | Search memory from OpenCode |
|
|
99
|
+
| Claude-Mem MCP `timeline` | `tool` (`mem-timeline`) | Chronological context around an observation |
|
|
100
|
+
| Claude-Mem MCP `get_observations` | `tool` (`mem-get-observations`) | Fetch full observation details by ID |
|
|
95
101
|
| _(streaming)_ | `event` (`message.updated`) | Capture assistant text (debounced) |
|
|
96
102
|
| _(streaming)_ | `event` (`file.edited`) | Record file edit observations |
|
|
97
103
|
| _(compaction)_ | `event` (`session.compacted`) | Summarize after OpenCode compacts |
|
|
@@ -109,6 +115,9 @@ The worker endpoint is resolved in this order: `CLAUDE_MEM_WORKER_HOST` /
|
|
|
109
115
|
| `POST` | `/api/sessions/summarize` | Trigger summarization |
|
|
110
116
|
| `POST` | `/api/sessions/complete` | Complete session |
|
|
111
117
|
| `GET` | `/api/search?query={query}&project={name}` | Search memory |
|
|
118
|
+
| `GET` | `/api/timeline?project={name}&anchor={id}` | Chronological context around an observation |
|
|
119
|
+
| `POST` | `/api/observations/batch` | Fetch full observation details by ID |
|
|
120
|
+
| `GET` | `/api/stats` + `/api/processing-status` | Sidebar status panel |
|
|
112
121
|
|
|
113
122
|
Session and observation writes include `platformSource: "opencode"` so
|
|
114
123
|
Claude-Mem can attribute new OpenCode memories separately from Claude Code,
|
|
@@ -181,23 +190,38 @@ Once installed, the plugin works automatically:
|
|
|
181
190
|
accumulating stale `pending_messages` (the "queueDepth never decreases"
|
|
182
191
|
failure mode).
|
|
183
192
|
|
|
184
|
-
## Memory
|
|
193
|
+
## Memory Tools
|
|
185
194
|
|
|
186
|
-
This plugin provides
|
|
187
|
-
|
|
188
|
-
the
|
|
195
|
+
This plugin provides three native OpenCode tools backed by the Claude-Mem
|
|
196
|
+
worker's HTTP API. They cover the same search → timeline → details workflow as
|
|
197
|
+
the upstream Claude-Mem MCP server, without requiring an MCP server or the
|
|
198
|
+
Claude Code compatibility bridge:
|
|
199
|
+
|
|
200
|
+
- **`mem-search`** — `GET /api/search`. Returns a formatted index of matching
|
|
201
|
+
observations (with IDs) for the current project.
|
|
202
|
+
- **`mem-timeline`** — `GET /api/timeline`. Given an observation ID as `anchor`
|
|
203
|
+
(or a `query` to locate one), returns the chronological records around it.
|
|
204
|
+
- **`mem-get-observations`** — `POST /api/observations/batch`. Fetches full
|
|
205
|
+
observation details for a list of IDs (e.g. IDs surfaced in the injected
|
|
206
|
+
memory context or by `mem-search`).
|
|
189
207
|
|
|
190
208
|
Claude Code's claude-mem plugin also registers an MCP server through its own
|
|
191
209
|
`.mcp.json`. OpenCode does not automatically load Claude Code plugin MCP
|
|
192
210
|
servers. If you previously saw Claude-Mem MCP tools in OpenCode, they were most
|
|
193
211
|
likely supplied by a Claude Code compatibility bridge such as oh-my-openagent.
|
|
194
212
|
Disabling that bridge for `claude-mem@thedotmack` removes those bridged MCP
|
|
195
|
-
tools; `mem
|
|
213
|
+
tools; the three `mem-*` tools above are the native replacements inside this
|
|
214
|
+
plugin, so a separately configured MCP server is not required.
|
|
215
|
+
|
|
216
|
+
## Sidebar Status
|
|
196
217
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
218
|
+
When running in the OpenCode TUI, the plugin registers a sidebar panel titled
|
|
219
|
+
**Memory** via its `./tui` export. It polls `/api/stats` and
|
|
220
|
+
`/api/processing-status` every few seconds and shows worker health, the current
|
|
221
|
+
project, observation/summary/session counts, and the processing queue depth. The
|
|
222
|
+
panel fails open — if the worker is offline it simply shows `worker offline` and
|
|
223
|
+
never blocks the TUI. Requires OpenCode's `@opentui/solid` runtime; if that is
|
|
224
|
+
unavailable the panel is skipped silently.
|
|
201
225
|
|
|
202
226
|
## Key Implementation Details
|
|
203
227
|
|
|
@@ -281,12 +305,13 @@ plugin load. If that toast still appears:
|
|
|
281
305
|
design.
|
|
282
306
|
- Very large tool outputs are truncated before storage.
|
|
283
307
|
|
|
284
|
-
### Memory
|
|
308
|
+
### Memory tools are unavailable
|
|
285
309
|
|
|
286
|
-
- Use the built-in `mem-search`
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
310
|
+
- Use the built-in `mem-search`, `mem-timeline`, and `mem-get-observations`
|
|
311
|
+
tools exposed by this plugin — they cover the full Claude-Mem search workflow
|
|
312
|
+
natively, so a separate MCP server is not required.
|
|
313
|
+
- If the tools return `worker is offline`, confirm the worker health endpoint
|
|
314
|
+
responds (see above).
|
|
290
315
|
|
|
291
316
|
## Development
|
|
292
317
|
|