Summary
On Windows (Git Bash / MINGW64), auto_memory_project_key() in _lib.sh generates a project key that does not match Claude Code's actual ~/.claude/projects/<key>/ directory name. This causes Pensieve to create a duplicate project directory and write MEMORY.md to the wrong location.
Environment
- OS: Windows 10/11 (MINGW64_NT)
- Shell: Git Bash (MSYS2)
- Pensieve version: 0.5.16
Root Cause
auto_memory_project_key() (line 69 of tools/loop/scripts/_lib.sh) calls to_posix_path() before encoding, which:
- Lowercases the drive letter:
D: → /d (Claude Code preserves original case)
- Only replaces
/ with -: misses _ → - replacement
Current code
auto_memory_project_key() {
local pr
pr="$(to_posix_path "$(project_root)")" # Bug: converts to POSIX first
...
encoded="${pr//\//-}" # Bug: only replaces /
...
}
Result comparison (example path D:\my_project\app)
|
Key generated |
Correct? |
| Claude Code |
D--my-project-app |
✅ |
| Pensieve |
-d-my_project-app |
❌ |
This creates a duplicate directory under ~/.claude/projects/, and MEMORY.md is written to the wrong one — making it invisible to Claude Code.
Fix
Replace the POSIX-based encoding with direct character substitution that matches Claude Code's algorithm:
auto_memory_project_key() {
local pr
pr="$(project_root)" # Use raw path, do NOT convert to POSIX
[[ -n "$pr" ]] || {
echo ""
return 0
}
local encoded
# Match Claude Code's project key encoding:
# Replace : / \ with -
encoded="${pr//[:\/\]/-}"
# Replace _ with -
encoded="${encoded//_/-}"
echo "$encoded"
}
Verified
After applying the fix, the generated key matches Claude Code's actual directory name. scan-structure.sh passes with Status: aligned, MUST_FIX: 0.
Summary
On Windows (Git Bash / MINGW64),
auto_memory_project_key()in_lib.shgenerates a project key that does not match Claude Code's actual~/.claude/projects/<key>/directory name. This causes Pensieve to create a duplicate project directory and writeMEMORY.mdto the wrong location.Environment
Root Cause
auto_memory_project_key()(line 69 oftools/loop/scripts/_lib.sh) callsto_posix_path()before encoding, which:D:→/d(Claude Code preserves original case)/with-: misses_→-replacementCurrent code
Result comparison (example path
D:\my_project\app)D--my-project-app-d-my_project-appThis creates a duplicate directory under
~/.claude/projects/, andMEMORY.mdis written to the wrong one — making it invisible to Claude Code.Fix
Replace the POSIX-based encoding with direct character substitution that matches Claude Code's algorithm:
Verified
After applying the fix, the generated key matches Claude Code's actual directory name.
scan-structure.shpasses withStatus: aligned, MUST_FIX: 0.