opencode-codex-memory 0.9.0 → 0.9.2

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 CHANGED
@@ -35,7 +35,7 @@ to your existing global `~/.config/opencode/opencode.jsonc` or `opencode.json`
35
35
  {
36
36
  "$schema": "https://opencode.ai/config.json",
37
37
  "plugins": [
38
- { "package": "opencode-codex-memory@0.9.0" }
38
+ { "package": "opencode-codex-memory@0.9.2" }
39
39
  ]
40
40
  }
41
41
  ```
@@ -45,7 +45,7 @@ to your existing global `~/.config/opencode/opencode.jsonc` or `opencode.json`
45
45
  ```json
46
46
  {
47
47
  "$schema": "https://opencode.ai/config.json",
48
- "plugin": ["opencode-codex-memory@0.9.0"]
48
+ "plugin": ["opencode-codex-memory@0.9.2"]
49
49
  }
50
50
  ```
51
51
 
@@ -18,7 +18,8 @@ const SEARCH_STEP_TOOLS = `2. Search {{ base_path }}/MEMORY.md for those keyword
18
18
  pass \`since\`/\`until\` to \`memory_search\` — with a query it searches only that
19
19
  period's sessions/notes; without a query it lists them chronologically.`;
20
20
  const SEARCH_STEP_FILES = `2. Search {{ base_path }}/MEMORY.md using those keywords.`;
21
- const SEARCH_STEP_TOOLS_V2 = `Search {{ base_path }}/rollout_summaries/ with the \`memory_search\`
21
+ const SEARCH_STEP_TOOLS_V2 = `Call \`memory_search\`, \`memory_read\`, \`memory_list\`, and \`memory_add_note\` directly. They are normal tools in this chat, not tools inside \`execute\`.
22
+ Search {{ base_path }}/rollout_summaries/ with the \`memory_search\`
22
23
  tool, or read a recap with \`memory_read\`, when extra evidence, wording,
23
24
  chronology, or uncertainty could change your answer.
24
25
  - For time-scoped recall ("what was I working on last week / around date X"),
@@ -14,6 +14,15 @@ interface V2ToolDefinition {
14
14
  name: string;
15
15
  description: string;
16
16
  input: z.ZodTypeAny;
17
+ /**
18
+ * OpenCode 2 defaults plugin tools into Code Mode (`execute`). The read-path
19
+ * prompt tells the model to call these by name. Leaving the default hides
20
+ * them from the native tool list; models then search `execute` for a
21
+ * `memory` namespace, miss, and skip memory.
22
+ */
23
+ options: {
24
+ codemode: false;
25
+ };
17
26
  execute: (input: any, ctx: {
18
27
  sessionID: string;
19
28
  messageID: string;
@@ -19,6 +19,7 @@ function adaptTool(name, v1) {
19
19
  name,
20
20
  description: v1.description,
21
21
  input: z.object(v1.args),
22
+ options: { codemode: false },
22
23
  async execute(input, tctx) {
23
24
  const v1ctx = {
24
25
  sessionID: tctx.sessionID,
@@ -36,19 +37,25 @@ function adaptTool(name, v1) {
36
37
  const res = await v1.execute(input, v1ctx);
37
38
  if (typeof res === "string")
38
39
  return { content: res };
40
+ let content = res.output ?? "";
41
+ let metadata = res.metadata;
39
42
  if (name === "memory_inspect") {
40
43
  const discovery = getV2DiscoveryStatus();
41
- return {
42
- content: [
43
- `v2_discovery_source: ${discovery?.source ?? "not_checked"}`,
44
- ...(discovery?.warning ? [`v2_discovery_warning: ${discovery.warning}`] : []),
45
- "",
46
- res.output ?? "",
47
- ].join("\n"),
48
- metadata: { ...(res.metadata && typeof res.metadata === "object" ? res.metadata : {}), v2_discovery: discovery },
49
- };
44
+ content = [
45
+ `v2_discovery_source: ${discovery?.source ?? "not_checked"}`,
46
+ ...(discovery?.warning ? [`v2_discovery_warning: ${discovery.warning}`] : []),
47
+ "",
48
+ content,
49
+ ].join("\n");
50
+ metadata = { ...(metadata && typeof metadata === "object" ? metadata : {}), v2_discovery: discovery };
50
51
  }
51
- return { content: res.output ?? "", ...(res.metadata !== undefined ? { metadata: res.metadata } : {}) };
52
+ // V2 validates metadata as JSON before persisting Tool.Success. V1 tool
53
+ // metadata can contain undefined optional fields (search path/since/until).
54
+ // Use JSON serialization semantics here so successful calls can settle.
55
+ return {
56
+ content,
57
+ ...(metadata === undefined ? {} : { metadata: JSON.parse(JSON.stringify(metadata)) }),
58
+ };
52
59
  },
53
60
  };
54
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codex-memory",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Persistent memory plugin for opencode — ports codex's two-phase memory system (extraction → consolidation → injection → citation feedback)",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",