From 4e6822fa8dcd1c8d237a8a227d08ce0df80c65ac Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 13 May 2026 09:36:53 -0400 Subject: [PATCH] fix(memory-import): resolve Win32 cwd to Claude Code's slug (#1939) (#1962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `memory_import_claude({ allProjects: false })` couldn't find the current project's memory directory on a pure Win32+Win32 install, because the slug candidates in `resolveProjectMemoryDir()` only replaced forward slashes — never the drive-colon, backslash, or whitespace that a Win32 cwd contains. Example: - cwd: `C:\Users\tobia\OneDrive\Desktop\Claude Stuff` - Claude Code's on-disk slug: `C--Users-tobia-OneDrive-Desktop-Claude-Stuff` - Before this fix: no candidate matched, importer reported `imported: 0, "No Claude memory files found"`. Add a Win32-specific candidate gated on `/^[A-Za-z]:[\\/]/` that does the full normalization (`:` / `\` / `/` / whitespace → `-`). The other four candidates (legacy POSIX, WSL `/mnt//`, leading-dash strip, space rule) are unchanged, so no regression for the other setup classes. Verified the new candidate emits `C--Users-tobia-OneDrive-Desktop-Claude-Stuff` for the reporter's path. Build verified clean (tsc). Resolves #1939. Co-authored-by: Reuven --- v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts index 7cdd42fa2d..f7fd3f6d55 100644 --- a/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts +++ b/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts @@ -135,6 +135,16 @@ function resolveProjectMemoryDir(claudeProjectsDir: string, projectPathOverride? // Candidate 4: spaces replaced with dashes (Claude Code's space rule) candidates.add(source.replace(/\//g, '-').replace(/ /g, '-')); + + // Candidate 5 (#1939): native Win32 path on a Win32 Claude Code install. + // `C:\Users\tobia\OneDrive\Desktop\Claude Stuff` → + // `C--Users-tobia-OneDrive-Desktop-Claude-Stuff`. Claude Code's on-disk + // slug replaces drive-colon AND backslashes AND whitespace with `-`. + // The earlier candidates only handled forward slashes, so a Win32+Win32 + // setup never matched. + if (/^[A-Za-z]:[\\/]/.test(source)) { + candidates.add(source.replace(/[:\\/]/g, '-').replace(/\s+/g, '-')); + } } for (const projectHash of candidates) {