mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 22:28:10 +09:00
`memory_import_claude --allProjects=true` was indexing the same memory file content under multiple `project_id` prefixes (e.g. `claude:-home-matheus:`, `claude:-home-mathe:`, `claude:-home-atheus-ssali:`), producing 5-8x duplication on long-lived homes. The reporter measured 2648 entries from 456 files on an 8-project home (vs 331 entries from 57 files with `--allProjects=false` — the natural 8x reduction). Root cause: Claude Code's `~/.claude/projects/` accumulates historical project_id directories (truncated forms, sandbox cwds, renamed workspaces). Each contains its own copy of the same memory files. The previous import walked all of them and stored every copy. Fix: track a `Set<string>` of SHA-256 prefix hashes of each file's raw content. When iterating, skip any file whose content hash we've already imported under a different project_id directory. Surface the new `duplicatesSkipped` count in the response so users can see how much dedupe happened. This preserves the FIRST project_id seen for each unique content (a deterministic-enough behavior given readdir's sort order). Real behavioral differences between projects' versions of "the same" memory file would, of course, hash differently and import normally. Closes #1791 (sub-bug 8).