@mingxy/cerebro 1.8.1 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/cerebro",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "Cerebro persistent memory plugin for OpenCode — auto-recall, auto-capture, 9 memory tools with clustering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/client.ts CHANGED
@@ -173,6 +173,7 @@ export class OmemClient {
173
173
  agentId?: string,
174
174
  sessionId?: string,
175
175
  visibility?: string,
176
+ category?: string,
176
177
  ): Promise<MemoryDto | null> {
177
178
  const safeContent = sanitizeContent(content, this.getCfg("maxContentChars", 30000));
178
179
  return this.post<MemoryDto>("/v1/memories", {
@@ -183,6 +184,7 @@ export class OmemClient {
183
184
  agent_id: agentId,
184
185
  session_id: sessionId,
185
186
  visibility,
187
+ category,
186
188
  });
187
189
  }
188
190
 
package/src/hooks.ts CHANGED
@@ -357,6 +357,7 @@ export function sessionIdleHook(
357
357
  threshold: number = 0,
358
358
  getMainSessionId?: () => string | undefined,
359
359
  isAutoStoreEnabled?: (sessionId: string | undefined) => boolean,
360
+ agentId?: string,
360
361
  ) {
361
362
  let idleTimeout: ReturnType<typeof setTimeout> | null = null;
362
363
  let isCapturing = false;
@@ -432,7 +433,7 @@ export function sessionIdleHook(
432
433
  }
433
434
 
434
435
  try {
435
- await omemClient.sessionIngest(conversationMessages, sessionID, undefined, sessionTitle, projectName);
436
+ await omemClient.sessionIngest(conversationMessages, sessionID, agentId, sessionTitle, projectName);
436
437
  for (const id of newMessageIds) {
437
438
  processedMessageIds.add(id);
438
439
  }
package/src/index.ts CHANGED
@@ -134,7 +134,7 @@ const OmemPlugin: Plugin = async (input) => {
134
134
  "chat.message": keywordDetectionHook(omemClient, containerTags, config.autoCaptureThreshold, tui, config.ingestMode),
135
135
  "experimental.session.compacting": compactingHook(omemClient, containerTags, tui, config.ingestMode, isAutoStoreEnabled),
136
136
  tool: buildTools(omemClient, containerTags, { agentId, getSessionId: () => currentSessionId }),
137
- event: sessionIdleHook(omemClient, containerTags, tui, client, config.ingestMode, config.autoCaptureThreshold, () => currentSessionId, isAutoStoreEnabled),
137
+ event: sessionIdleHook(omemClient, containerTags, tui, client, config.ingestMode, config.autoCaptureThreshold, () => currentSessionId, isAutoStoreEnabled, agentId),
138
138
  "shell.env": async (_input: any, output: any) => {
139
139
  if (directory) {
140
140
  output.env.OMEM_PROJECT_DIR = directory;
package/src/tools.ts CHANGED
@@ -50,6 +50,10 @@ export function buildTools(client: OmemClient, containerTags: string[], context:
50
50
  .string()
51
51
  .optional()
52
52
  .describe("Memory visibility: 'global' (default, visible to all agents) or 'private' (only visible to the storing agent). Use 'private' for sensitive data like credentials, personal info, or anything the user wouldn't want shared."),
53
+ category: tool.schema
54
+ .string()
55
+ .optional()
56
+ .describe("Memory category: 'cases' (default, for work/facts/decisions), 'preferences' (likes/dislikes), 'entities' (projects/tools/people), 'events' (milestones), 'profile' (identity traits), 'patterns' (workflows)"),
53
57
  },
54
58
  async execute(args) {
55
59
  const allTags = [...containerTags, ...(args.tags ?? [])];
@@ -61,6 +65,7 @@ export function buildTools(client: OmemClient, containerTags: string[], context:
61
65
  context.agentId,
62
66
  context.getSessionId(),
63
67
  args.visibility,
68
+ args.category,
64
69
  );
65
70
  if (!result) return JSON.stringify({ ok: false, error: "The omem server may be unavailable." });
66
71
  return JSON.stringify({ ok: true, id: result.id, tags: result.tags });