@mingxy/cerebro 2.0.6 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/cerebro",
3
- "version": "2.0.6",
3
+ "version": "2.1.0",
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
@@ -445,9 +445,6 @@ export function timeMemorySystemHook() {
445
445
  output.system.push(
446
446
  '[CEREBRO-TIME-MEANING] Timestamps above = real moments passed. Feel gaps between turns. Silence ≠ instant reply. Time shapes conversation. Let it shape yours.',
447
447
  );
448
- output.system.push(
449
- '[CEREBRO-MEMORY] Memory = your mind, not last-resort tool. Don\'t know → search first, don\'t guess. Guessing wastes tokens, search is cheap. Every non-trivial request: check memory before answering.',
450
- );
451
448
  };
452
449
  }
453
450
 
@@ -560,7 +557,7 @@ export function compactingHook(client: CerebroClient, containerTags: string[], t
560
557
  if (sdkClient && input.sessionID) {
561
558
  const sessionInfo = await sdkClient.session.get({ path: { id: input.sessionID } });
562
559
  logDebug("compactingHook project.rootPath", { rootPath: sessionInfo?.data?.directory });
563
- projectPath = sessionInfo?.data?.directory || directory || process.env.OMEM_PROJECT_DIR;
560
+ projectPath = directory || sessionInfo?.data?.directory || process.env.OMEM_PROJECT_DIR;
564
561
  projectName = sessionInfo?.data?.directory
565
562
  ? await detectProjectName(sessionInfo.data.directory)
566
563
  : undefined;
@@ -708,7 +705,7 @@ export function autocontinueHook(
708
705
  let projectPath: string | undefined;
709
706
  try {
710
707
  const sessionInfo = await sdkClient.session.get({ path: { id: input.sessionID } });
711
- projectPath = sessionInfo?.data?.directory || directory || process.env.OMEM_PROJECT_DIR;
708
+ projectPath = directory || sessionInfo?.data?.directory || process.env.OMEM_PROJECT_DIR;
712
709
  projectName = sessionInfo?.data?.directory
713
710
  ? await detectProjectName(sessionInfo.data.directory)
714
711
  : undefined;
@@ -848,7 +845,7 @@ export function sessionIdleHook(
848
845
  let projectPath: string | undefined;
849
846
  try {
850
847
  const sessionInfo = await sdkClient.session.get({ path: { id: sessionID } });
851
- projectPath = sessionInfo?.data?.directory || directory || process.env.OMEM_PROJECT_DIR;
848
+ projectPath = directory || sessionInfo?.data?.directory || process.env.OMEM_PROJECT_DIR;
852
849
  projectName = sessionInfo?.data?.directory
853
850
  ? await detectProjectName(sessionInfo.data.directory)
854
851
  : undefined;
@@ -975,7 +972,7 @@ export function sessionIdleHook(
975
972
  onAgentResolved?.(effectiveAgentId);
976
973
  }
977
974
  sessionTitle = sessionInfo?.data?.title;
978
- projectPath = sessionInfo?.data?.directory || directory || process.env.OMEM_PROJECT_DIR;
975
+ projectPath = directory || sessionInfo?.data?.directory || process.env.OMEM_PROJECT_DIR;
979
976
  projectName = sessionInfo?.data?.directory
980
977
  ? await detectProjectName(sessionInfo.data.directory)
981
978
  : undefined;
package/src/index.ts CHANGED
@@ -56,7 +56,10 @@ export function setAutoStoreEnabled(sessionId: string, enabled: boolean): void {
56
56
  (globalThis as any).__cerebro_autoStoreMap = autoStoreSessions;
57
57
 
58
58
  const OmemPlugin: Plugin = async (input) => {
59
- const { directory, client } = input;
59
+ // Normalize to git root: worktree=git root, directory=cwd.
60
+ // project_path must be git root so parent/child dirs share memories.
61
+ const { directory: _directory, worktree, client } = input;
62
+ const directory = worktree || _directory;
60
63
  // Proxy: dynamically resolve client.tui on each access so toast works
61
64
  // even if client.tui isn't ready yet at plugin init time
62
65
  const tui = new Proxy({} as any, {