@mingxy/cerebro 2.0.5 → 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.5",
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
@@ -443,10 +443,7 @@ export function timeMemorySystemHook() {
443
443
 
444
444
  output.system.push(`[CEREBRO-TIME] ${timeStr}`);
445
445
  output.system.push(
446
- '[CEREBRO-TIME-MEANING] This is your current ground-truth anchor. Use it to: (1) verify "earlier/yesterday/last time" claims against memory, (2) detect when your own time sense drifts, (3) question implausible durations.',
447
- );
448
- output.system.push(
449
- '[CEREBRO-MEMORY] Before answering or acting on non-trivial requests: if you lack specific knowledge about this user, project, or topic — search memory first. Search is cheap; guessing is expensive. Treat memory as your own mind, not a last-resort tool.',
446
+ '[CEREBRO-TIME-MEANING] Timestamps above = real moments passed. Feel gaps between turns. Silence instant reply. Time shapes conversation. Let it shape yours.',
450
447
  );
451
448
  };
452
449
  }
@@ -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, {