From dfbf07aeaebebdcc6f5906409d03073af3d8ef9c Mon Sep 17 00:00:00 2001 From: asorry75 Date: Wed, 5 Aug 2026 12:59:35 +0800 Subject: [PATCH] fix: resolve Hermes native memory import path on Windows hermesNativeMemoryPath() hardcodes ~/.hermes/memories/MEMORY.md via os.homedir(). On Windows, Hermes stores memories under %LOCALAPPDATA%\hermes\memories (HERMES_HOME), so the import scan always reports not found and the viewer UI cannot correct it because the path is not editable. Resolve the Hermes home directory in order: 1. HERMES_HOME env var (set by Hermes at runtime) 2. Windows: %LOCALAPPDATA%\hermes 3. Other platforms: ~/.hermes (previous behavior, unchanged) Verified on Windows: import scan now locates MEMORY.md. --- apps/memos-local-plugin/server/routes/import-export.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/memos-local-plugin/server/routes/import-export.ts b/apps/memos-local-plugin/server/routes/import-export.ts index efdf16595..d49782a90 100644 --- a/apps/memos-local-plugin/server/routes/import-export.ts +++ b/apps/memos-local-plugin/server/routes/import-export.ts @@ -333,8 +333,16 @@ function parseMultipartBundle(contentType: string, body: Buffer): string | null return null; } +function hermesHome(): string { + if (process.env.HERMES_HOME) return process.env.HERMES_HOME; + if (process.platform === "win32") { + return join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "hermes"); + } + return join(homedir(), ".hermes"); +} + function hermesNativeMemoryPath(): string { - return join(homedir(), ".hermes", "memories", "MEMORY.md"); + return join(hermesHome(), "memories", "MEMORY.md"); } function openClawHome(): string {