@mathew-cf/opencode-memory 1.0.0 → 1.1.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 CHANGED
@@ -25,7 +25,7 @@ LLM agents forget everything between sessions. That means rediscovering the same
25
25
  ```jsonc
26
26
  // opencode.jsonc
27
27
  {
28
- "plugin": ["@mathew-cf/opencode-memory@1.0.0"]
28
+ "plugin": ["@mathew-cf/opencode-memory@1.1.0"]
29
29
  }
30
30
  ```
31
31
 
package/dist/config.d.ts CHANGED
@@ -21,8 +21,22 @@
21
21
  export declare function buildMemoryPromptAppendix(memoryDir?: string): string;
22
22
  export declare const MEMORY_PROMPT_APPENDIX: string;
23
23
  /**
24
- * Subagents that should get the memory prompt appendix. These are the
25
- * built-in subagent names used by OpenCode custom agents are left alone.
24
+ * OpenCode's real built-in subagents. These are NOT present in the raw
25
+ * config object at config-hook time, so we create entries for them in order
26
+ * to attach the memory prompt. Keep this list in sync with OpenCode core
27
+ * (`packages/opencode/src/agent/agent.ts` — built-in subagents are `general`
28
+ * and `explore`; `build`/`plan` are primary and are intentionally excluded).
29
+ */
30
+ export declare const BUILTIN_SUBAGENTS: readonly ["general", "explore"];
31
+ /**
32
+ * Subagents that should get the memory prompt appendix.
33
+ *
34
+ * Built-ins (see {@link BUILTIN_SUBAGENTS}) are always targeted. Any other
35
+ * name here is only touched when the user has *already defined* an agent with
36
+ * that name — we never fabricate an agent that doesn't exist. This is what
37
+ * keeps `research`/`review`/`investigator` from being conjured into the
38
+ * config (and showing up as phantom entries in the Task tool's agent list)
39
+ * on installs that never defined them.
26
40
  */
27
41
  export declare const TARGET_AGENTS: readonly ["general", "explore", "research", "review", "investigator"];
28
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,SA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CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC/C,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;QACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;KACvD,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsEzG"}
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare const _default: {
24
24
  server: Plugin;
25
25
  };
26
26
  export default _default;
27
- export { applyConfig, MEMORY_PROMPT_APPENDIX, TARGET_AGENTS } from "./config";
27
+ export { applyConfig, BUILTIN_SUBAGENTS, MEMORY_PROMPT_APPENDIX, TARGET_AGENTS } from "./config";
28
28
  export { afterToolUpdate, buildCompactionContext, createGuardHooks, makeInitialState, matchesToolName, type SessionState, } from "./hooks/guard";
29
29
  export * as memoryTools from "./tools/memory";
30
30
  export * as sessionTools from "./tools/session";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAgElD;;;;;;;;;;GAUG;;;;;AACH,wBAGE;AAGF,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAgElD;;;;;;;;;;GAUG;;;;;AACH,wBAGE;AAGF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACjG,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -125,6 +125,7 @@ End with: a clear conclusion (recommendation, diagnosis, or finding), your confi
125
125
  Flag anything > 1 year old as potentially stale.`;
126
126
  }
127
127
  var MEMORY_PROMPT_APPENDIX = buildMemoryPromptAppendix();
128
+ var BUILTIN_SUBAGENTS = ["general", "explore"];
128
129
  var TARGET_AGENTS = ["general", "explore", "research", "review", "investigator"];
129
130
  var EXPLORE_PERMISSIONS = {
130
131
  memory_search: "allow",
@@ -159,7 +160,11 @@ function applyConfig(config, options) {
159
160
  }
160
161
  config.agent = config.agent || {};
161
162
  const prefix = buildMemoryPromptAppendix(memoryDir);
163
+ const builtins = BUILTIN_SUBAGENTS;
162
164
  for (const name of TARGET_AGENTS) {
165
+ const alreadyDefined = Object.prototype.hasOwnProperty.call(config.agent, name);
166
+ if (!alreadyDefined && !builtins.includes(name))
167
+ continue;
163
168
  const existing = config.agent[name] || {};
164
169
  if (!existing.prompt) {
165
170
  existing.prompt = prefix;
@@ -13647,5 +13652,6 @@ export {
13647
13652
  applyConfig,
13648
13653
  afterToolUpdate,
13649
13654
  TARGET_AGENTS,
13650
- MEMORY_PROMPT_APPENDIX
13655
+ MEMORY_PROMPT_APPENDIX,
13656
+ BUILTIN_SUBAGENTS
13651
13657
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mathew-cf/opencode-memory",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Persistent cross-session memory for OpenCode — a hybrid keyword + semantic search layer over a local markdown knowledge base, plus session history tools and guardrails that nudge agents to use them.",
5
5
  "author": "mat",
6
6
  "license": "Apache-2.0",
@@ -46,7 +46,7 @@
46
46
  "persistence"
47
47
  ],
48
48
  "dependencies": {
49
- "@mathew-cf/rag-cli": "^0.4.0",
49
+ "@mathew-cf/rag-cli": "^1.1.0",
50
50
  "@vscode/ripgrep": "^1.17.1",
51
51
  "zod": "^3.25.0"
52
52
  },