@mingxy/cerebro 1.18.17 โ†’ 1.18.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/cerebro",
3
- "version": "1.18.17",
3
+ "version": "1.18.19",
4
4
  "description": "Cerebro persistent memory plugin for OpenCode โ€” auto-recall, auto-capture, 9 memory tools with clustering, project-scoped memory isolation",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/hooks.ts CHANGED
@@ -231,16 +231,16 @@ export async function buildMemoryInjection(
231
231
  const [profile, projectMemories, searchResults] = await Promise.all([
232
232
  Promise.race([
233
233
  client.getInjection(),
234
- new Promise<null>((resolve) => setTimeout(() => resolve(null), 3000)),
234
+ new Promise<null>((resolve) => setTimeout(() => resolve(null), 1000)),
235
235
  ]).catch(() => null),
236
236
  Promise.race([
237
237
  client.listRecent(5, projectPath),
238
- new Promise<never[]>((resolve) => setTimeout(() => resolve([]), 2000)),
238
+ new Promise<never[]>((resolve) => setTimeout(() => resolve([]), 1000)),
239
239
  ]).catch(() => []),
240
240
  query
241
241
  ? Promise.race([
242
242
  client.searchMemories(query, 10, undefined, undefined, projectPath),
243
- new Promise<never[]>((resolve) => setTimeout(() => resolve([]), 3000)),
243
+ new Promise<never[]>((resolve) => setTimeout(() => resolve([]), 1500)),
244
244
  ]).catch(() => [])
245
245
  : Promise.resolve([]),
246
246
  ]);
@@ -350,6 +350,21 @@ export function chatMessageRecallHook(
350
350
  showToast(tui, "๐Ÿง  Memory Injected",
351
351
  `${injection.profileCount} prefs ยท ${injection.projectMemoryCount} project ยท ${injection.memoryCount} relevant`,
352
352
  "success");
353
+
354
+ client.createRecallEvent({
355
+ session_id: input.sessionID,
356
+ recall_type: "auto",
357
+ query_text: query,
358
+ max_score: 0,
359
+ llm_confidence: 0,
360
+ profile_injected: injection.profileCount > 0,
361
+ kept_count: injection.projectMemoryCount + injection.memoryCount,
362
+ discarded_count: 0,
363
+ injected_count: injection.projectMemoryCount + injection.memoryCount,
364
+ injected_content: injection.text,
365
+ }).catch((e: unknown) => {
366
+ logErr("chatMessageRecallHook createRecallEvent failed", { error: String(e) });
367
+ });
353
368
  } else if (!hasContent) {
354
369
  logDebug("chatMessageRecallHook: no content available, will retry next turn", {
355
370
  sessionId: input.sessionID,
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import type { Server } from "node:http";
7
7
  import { CerebroClient } from "./client.js";
8
8
  import { chatMessageRecallHook, autocontinueHook, compactingHook, sessionIdleHook, showToast as hooksShowToast, sessionMessages, firstMessages } from "./hooks.js";
9
- import { detectSaveKeyword, detectRecallKeyword, KEYWORD_NUDGE, RECALL_NUDGE } from "./keywords.js";
9
+ import { detectSaveKeyword, detectRecallKeyword } from "./keywords.js";
10
10
  import { getUserTag, getProjectTag } from "./tags.js";
11
11
  import { buildTools } from "./tools.js";
12
12
  import { logInfo, logDebug, logError } from "./logger.js";
@@ -163,20 +163,12 @@ const OmemPlugin: Plugin = async (input) => {
163
163
  firstMessages.set(input.sessionID, textContent);
164
164
  }
165
165
  if (detectSaveKeyword(textContent)) {
166
- output.parts.push({
167
- type: "text",
168
- text: KEYWORD_NUDGE,
169
- synthetic: true,
170
- } as any);
171
- logDebug("keyword nudge pushed via parts.push", { sessionId: input.sessionID });
166
+ hooksShowToast(tui, "๐Ÿ’ก Memory Save Detected", "Auto-capture will save this on session idle", "info");
167
+ logDebug("save keyword detected", { sessionId: input.sessionID });
172
168
  }
173
169
  if (detectRecallKeyword(textContent)) {
174
- output.parts.push({
175
- type: "text",
176
- text: RECALL_NUDGE,
177
- synthetic: true,
178
- } as any);
179
- logDebug("recall nudge pushed via parts.push", { sessionId: input.sessionID });
170
+ hooksShowToast(tui, "๐Ÿ” Recall Detected", "Consider using memory_search for context", "info");
171
+ logDebug("recall keyword detected", { sessionId: input.sessionID });
180
172
  }
181
173
  const policy = resolveAgentPolicy(agentId, config);
182
174
  if (policy !== "none") {