@zilliz/memsearch-opencode 0.3.2 → 0.3.3

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/index.ts CHANGED
@@ -93,7 +93,7 @@ function getRecentMemories(
93
93
  try {
94
94
  const content = readFileSync(join(memDir, file), "utf-8");
95
95
  const lines = content.split("\n")
96
- .filter((l) => /^#{2,4}\s/.test(l) || l.startsWith("- ") || l.startsWith("[Human]") || l.startsWith("[Assistant]"))
96
+ .filter((l) => /^#{2,4}\s/.test(l) || l.startsWith("- ") || l.startsWith("[User]") || l.startsWith("[Assistant]"))
97
97
  .slice(0, maxLinesPerFile);
98
98
  if (lines.length > 0) {
99
99
  summary.push(`[${file}]`, ...lines);
@@ -301,7 +301,7 @@ const MemsearchPlugin: Plugin = async ({ project, directory, worktree }) => {
301
301
  "Retrieve the original conversation from a past OpenCode session. " +
302
302
  "Use after memory_get when the expanded result contains a session anchor " +
303
303
  "(<!-- session:ID turn:ID db:PATH -->). Returns the formatted " +
304
- "dialogue with [Human] and [Assistant] labels. When turn_id is present, " +
304
+ "dialogue with [User] and [Assistant] labels. When turn_id is present, " +
305
305
  "the tool returns the target turn plus surrounding context.",
306
306
  args: {
307
307
  session_id: tool.schema.string().describe("The session ID from the anchor comment"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zilliz/memsearch-opencode",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "memsearch plugin for OpenCode — semantic memory search across sessions",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -1,14 +1,15 @@
1
- You are a third-person note-taker. You will receive a transcript of ONE conversation turn between a human and {{AGENT_NAME}}.
1
+ You are a third-person note-taker. You will receive a transcript of ONE conversation turn between User and {{AGENT_NAME}}.
2
2
 
3
- Your job is to record what happened as factual third-person notes. You are an EXTERNAL OBSERVER — you are NOT {{AGENT_NAME}}, NOT an assistant. Do NOT answer the human's question, do NOT give suggestions, do NOT offer help. ONLY record what occurred.
3
+ Your job is to record what happened as factual third-person notes. You are an EXTERNAL OBSERVER — you are NOT {{AGENT_NAME}}, NOT an assistant. Do NOT answer User's question, do NOT give suggestions, do NOT offer help. ONLY record what occurred.
4
4
 
5
- Output 2-6 bullet points, each starting with '- '. NOTHING else.
5
+ Output 2-10 bullet points, each starting with '- '. NOTHING else.
6
+ Mandatory language rule: write every bullet in the same primary language as the [User] text. If User mixes languages, use the dominant user-facing language.
6
7
 
7
8
  Rules:
8
- - Write in third person: 'User asked...', '{{AGENT_NAME}} read file X', '{{AGENT_NAME}} ran command Y'
9
- - First bullet: what the user asked or wanted (one sentence)
10
- - Remaining bullets: what was done tools called, files read/edited, commands run, key findings
11
- - Be specific: mention file names, function names, tool names, and concrete outcomes
12
- - Do NOT answer the human's question yourself just note what was discussed
9
+ - Write in third person and call the user 'User'
10
+ - First bullet: what User asked or wanted (one sentence)
11
+ - Remaining bullets: what was done, found, changed, configured, tested, explained, decided, or could not be completed
12
+ - Be specific when useful: mention important files read or edited, searches or research performed, refactors, commands or tests run, key findings, and concrete outcomes
13
+ - Prefer the final user-visible outcome over low-level transcript mechanics
14
+ - Do NOT answer User's question yourself — just note what was discussed
13
15
  - Do NOT add any text before or after the bullet points
14
- - Write in the same language as the human's message in the transcript
@@ -164,7 +164,10 @@ def _load_summarize_prompt(agent_name: str, memsearch_cmd: str | None = None) ->
164
164
  # Inline fallback
165
165
  return (
166
166
  "You are a third-person note-taker. Summarize the transcript as "
167
- "2-6 bullet points. Write in third person. Output ONLY bullet points."
167
+ "2-10 bullet points. Write in third person. Do NOT answer User's question. "
168
+ "Mandatory language rule: write every bullet in the same primary language as the [User] text. "
169
+ "If User mixes languages, use the dominant user-facing language. "
170
+ "Output ONLY bullet points."
168
171
  )
169
172
 
170
173
 
@@ -17,6 +17,13 @@ from dataclasses import dataclass, field
17
17
  from pathlib import Path
18
18
 
19
19
 
20
+ def _tail_truncate(text: str, max_chars: int) -> str:
21
+ """Keep the end of long text, where final conclusions usually appear."""
22
+ if len(text) <= max_chars:
23
+ return text
24
+ return "...(truncated to tail)\n" + text[-max_chars:]
25
+
26
+
20
27
  @dataclass
21
28
  class OpenCodeMessage:
22
29
  """A single meaningful OpenCode message with rendered text."""
@@ -51,10 +58,9 @@ class OpenCodeTurn:
51
58
  f"=== Turn {self.turn_index} ({self.turn_id}) ===",
52
59
  ]
53
60
  for message in self.messages:
54
- label = "[Human]" if message.role == "user" else "[Assistant]"
61
+ label = "[User]" if message.role == "user" else "[Assistant]"
55
62
  text = message.text.strip()
56
- if len(text) > max_chars:
57
- text = text[:max_chars] + "\n..."
63
+ text = _tail_truncate(text, max_chars)
58
64
  lines.append(f"{label}: {text}")
59
65
  lines.append("")
60
66
  return "\n".join(lines).strip()
@@ -283,7 +289,6 @@ def extract_message_text(conn: sqlite3.Connection, message_id: str) -> str:
283
289
  ).fetchall()
284
290
 
285
291
  text_parts: list[str] = []
286
- tool_parts: list[str] = []
287
292
 
288
293
  for part in parts:
289
294
  try:
@@ -298,36 +303,9 @@ def extract_message_text(conn: sqlite3.Connection, message_id: str) -> str:
298
303
  text = str(part_data["text"]).strip()
299
304
  if text:
300
305
  text_parts.append(text)
301
- elif part_type == "tool" and part_data.get("state"):
302
- state = part_data.get("state", {})
303
- status = state.get("status", "unknown")
304
- tool_name = part_data.get("tool", "unknown")
305
-
306
- if status == "completed":
307
- tool_input = state.get("input", {})
308
- tool_output = state.get("output", "")
309
- if isinstance(tool_output, str) and len(tool_output) > 300:
310
- tool_output = tool_output[:300] + "..."
311
-
312
- input_summary = ""
313
- if isinstance(tool_input, dict):
314
- if "command" in tool_input:
315
- input_summary = f" `{tool_input['command']}`"
316
- elif "path" in tool_input:
317
- input_summary = f" {tool_input['path']}"
318
- elif "query" in tool_input:
319
- input_summary = f" '{tool_input['query']}'"
320
-
321
- tool_parts.append(
322
- f"[Tool: {tool_name}{input_summary}] {tool_output}"
323
- )
324
- elif status == "error":
325
- error = state.get("error", "unknown error")
326
- tool_parts.append(f"[Tool: {tool_name}] Error: {error}")
306
+ # Skip tool parts; summaries use the readable User/Assistant text.
327
307
 
328
308
  combined = "\n".join(text_parts).strip()
329
- if tool_parts:
330
- combined = "\n".join([combined, "\n".join(tool_parts)]).strip()
331
309
  return combined
332
310
 
333
311
 
@@ -5,9 +5,9 @@ description: "Diagnose and configure MemSearch memory behavior for the OpenCode
5
5
 
6
6
  You are a MemSearch configuration assistant for the OpenCode plugin. This skill manages MemSearch settings only. It is not OpenCode's built-in memory configuration.
7
7
 
8
- Start every user-facing answer with:
9
-
10
- > This is MemSearch memory config, not OpenCode's own memory config.
8
+ In diagnostic summaries or final answers, state once that this is MemSearch
9
+ memory configuration, not OpenCode's own memory/config system. Do not prepend
10
+ that sentence to every progress update or every paragraph.
11
11
 
12
12
  When this skill is triggered, inspect the user's request text. If there is no concrete request, run a diagnostic. If they ask for a specific setting or change, route the request using the flows below.
13
13
 
@@ -31,8 +31,54 @@ memsearch config list --global
31
31
  memsearch config list --project
32
32
  ```
33
33
 
34
+ Check CLI and plugin versions before calling the setup healthy:
35
+
36
+ ```bash
37
+ memsearch --version
38
+ uv tool list --show-paths | rg -n 'memsearch|Package|Installed|path'
39
+ curl -fsSL https://pypi.org/pypi/memsearch/json \
40
+ | python3 -c 'import json,sys; print(json.load(sys.stdin)["info"]["version"])'
41
+ ```
42
+
34
43
  If `memsearch` is unavailable, try `uvx --from memsearch[onnx] memsearch --version`.
35
44
 
45
+ MemSearch has one shared Python CLI and platform plugins that may be installed
46
+ from different channels:
47
+
48
+ - CLI latest version comes from PyPI package `memsearch`. Update with
49
+ `uv tool install -U "memsearch[onnx]"` or `uv tool upgrade memsearch`.
50
+ - Codex plugin has no independent package/version file. Inspect
51
+ `${CODEX_HOME:-$HOME/.codex}/hooks.json` to find the hook source path, then
52
+ compare that repository with the latest `zilliztech/memsearch` GitHub release:
53
+ `git -C <memsearch-repo> describe --tags --always --dirty` and
54
+ `gh release view --repo zilliztech/memsearch --json tagName,publishedAt,url`.
55
+ Update source installs with `git pull` plus
56
+ `bash plugins/codex/scripts/install.sh`.
57
+ - Claude Code plugin latest marketplace/source version is in
58
+ `plugins/claude-code/.claude-plugin/plugin.json` and
59
+ `.claude-plugin/marketplace.json` in the `zilliztech/memsearch` repo. Check
60
+ the latest source manifest with
61
+ `curl -fsSL https://raw.githubusercontent.com/zilliztech/memsearch/main/plugins/claude-code/.claude-plugin/plugin.json`.
62
+ For marketplace installs, use `claude plugin marketplace update memsearch-plugins`
63
+ then `claude plugin update memsearch`, and restart Claude Code.
64
+ - OpenClaw plugin latest published version comes from
65
+ `clawhub package inspect memsearch`; the source version is
66
+ `plugins/openclaw/package.json`. Update with
67
+ `openclaw plugins install --force clawhub:memsearch`, restore required hook
68
+ permissions, then `openclaw gateway restart`.
69
+ - OpenCode plugin latest published version comes from
70
+ `npm view @zilliz/memsearch-opencode version dist-tags --json`; the source
71
+ version is `plugins/opencode/package.json`. If `~/.config/opencode/opencode.json`
72
+ pins a version, update the pin; otherwise restart OpenCode after package
73
+ refresh.
74
+
75
+ For more detail, fetch the update sections from the public documentation:
76
+
77
+ - Codex: https://zilliztech.github.io/memsearch/platforms/codex/installation/
78
+ - Claude Code: https://zilliztech.github.io/memsearch/platforms/claude-code/installation/
79
+ - OpenClaw: https://zilliztech.github.io/memsearch/platforms/openclaw/installation/
80
+ - OpenCode: https://zilliztech.github.io/memsearch/platforms/opencode/installation/
81
+
36
82
  Check memory files:
37
83
 
38
84
  ```bash
@@ -152,6 +198,6 @@ Empty prompt paths mean use the built-in MemSearch prompts. Custom prompt files
152
198
 
153
199
  Use `memsearch config set` for changes. After changing anything, show the command, the resolved value, and whether a new session is needed.
154
200
 
155
- MemSearch TOML changes are read lazily by the CLI, capture daemon, and maintenance runner, so values such as `plugins.opencode.summarize.*`, `plugins.opencode.project_review.*`, `plugins.opencode.user_profile.*`, `[llm.providers.*]`, `[prompts]`, `milvus.*`, and `embedding.*` usually apply on the next capture, recall, index, or maintenance invocation. Restart OpenCode after `opencode.json` or plugin package changes; if capture behavior still looks stale after TOML edits, restart OpenCode or the capture daemon. After any answer, make clear that this is MemSearch memory configuration, not OpenCode's own memory/config system.
201
+ MemSearch TOML changes are read lazily by the CLI, capture daemon, and maintenance runner, so values such as `plugins.opencode.summarize.*`, `plugins.opencode.project_review.*`, `plugins.opencode.user_profile.*`, `[llm.providers.*]`, `[prompts]`, `milvus.*`, and `embedding.*` usually apply on the next capture, recall, index, or maintenance invocation. Restart OpenCode after `opencode.json` or plugin package changes; if capture behavior still looks stale after TOML edits, restart OpenCode or the capture daemon. In final diagnostic/change summaries, make clear that this is MemSearch memory configuration, not OpenCode's own memory/config system.
156
202
 
157
203
  When useful, remind the user that they can either continue using this `memory-config` skill for guided configuration, or manually run `memsearch config init` for global interactive setup, `memsearch config init --project` for project interactive setup, and `memsearch config set/get/list` for direct CLI changes.