Fix silent save failures on Windows + Git Bash (path slug mismatch)#44
Merged
fdaviddpt merged 2 commits intoDigital-Process-Tools:mainfrom May 2, 2026
Merged
Conversation
On Windows with Git Bash (the default shell Claude Code uses for hooks on Windows), the plugin's PostToolUse hook fires but never saves anything. .remember/ accumulates only logs/ — no now.md, today-*.md, or tmp/last-save.json — and no errors are printed. Root cause: Claude Code stores sessions under a slug computed from the Win32 path (e.g. C:\Users\dev\project → C--Users-dev-project), but Git Bash exposes $CLAUDE_PROJECT_DIR as a POSIX-style path (/c/Users/dev/project → -c-Users-dev-project). The two slugs never match, so post-tool-hook.sh exits at the LATEST_JSONL emptiness check and save-session.sh is never invoked. Fix: in scripts/resolve-paths.sh, detect Git Bash / MSYS / Cygwin via $OSTYPE and convert /c/Users/... → C:\Users\... before validation. All downstream slug computations (3 shell sites + Python _session_dir) then align with Claude Code's storage path. Pure-bash regex (no cygpath dependency for CI portability). Linux/macOS shells where $OSTYPE is "linux-gnu" / "darwin*" are unaffected. Tests: three new cases under TestWindowsCompatIssue11 - test_resolve_paths_normalizes_msys_posix_path: /c/Users/... → C:\Users\... - test_resolve_paths_leaves_unix_paths_unchanged: Win32 + Linux/macOS pass through - test_normalized_msys_path_yields_windows_slug: end-to-end slug match - test_resolve_paths_has_msys_normalization_block: structural guard Verified end-to-end on Windows 11 + Git Bash with v0.5.0 cached install: the plugin now writes now.md and runs NDC compression as designed.
Contributor
|
Thanks @kanelavish-a11y — solid diagnosis, the POSIX form was a real gap left by #29. Fix and tests look good. One blocker before merge:
Could you swap _drive=$(printf '%s' "${BASH_REMATCH[1]}" | tr '[:lower:]' '[:upper:]')or pure-bash: _drive="${BASH_REMATCH[1]}"
case "$_drive" in
[a-z]) _drive=$(printf '\\%o' "'$_drive" | xargs printf '%b' | tr '[:lower:]' '[:upper:]') ;;
esac
|
macOS bash 3.2 doesn't support ${var^^}. The OSTYPE-gated production
block was harmless on macOS at runtime (block skipped), but the test
forces OSTYPE=msys and reaches the unsupported syntax, breaking the
suite on any macOS dev machine using system bash.
Swap to tr '[:lower:]' '[:upper:]' — POSIX, works on bash 3.2+.
Apply same swap to the test's inlined helper.
Co-Authored-By: Max <noreply>
fdaviddpt
pushed a commit
that referenced
this pull request
May 2, 2026
Two Windows portability fixes since v0.7.0: - #39 detach SessionStart hook children (libuv assertion) - #44 normalize Git Bash POSIX paths to Win32 (silent save failures) Also: gitignore .DS_Store, remove tracked .DS_Store and stale .github-org-profile/ (belongs in the org profile repo, not here). Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows with Git Bash (the default shell Claude Code uses for hooks on Windows), the plugin silently never saves anything.
.remember/accumulateslogs/memory-YYYY-MM-DD.logshowing[hook] post-toollines, but nonow.md,today-*.md, ortmp/last-save.jsonis ever created. There are no error messages — the hook just exits cleanly.Root cause
Claude Code stores session JSONL files at
~/.claude/projects/<slug>/, where<slug>is the project root path with non-alphanumerics replaced by-. On Windows, Claude Code computes the slug from the Win32-native path:The plugin computes the slug from
CLAUDE_PROJECT_DIR, which Git Bash/MSYS exposes as a POSIX-style path:post-tool-hook.sh:46does:— so on Windows it always exits early.
save-session.shis never invoked, no Haiku call, nonow.md. The existingtest_session_dir_windows_backslashcoversD:\Users\dev\projectbut not the/d/Users/dev/projectform that Git Bash actually produces.Fix
Normalize
CLAUDE_PROJECT_DIRto its Win32 form insideresolve-paths.shso all downstream slug computations (3 shell sites + Python_session_dir) match Claude Code's storage path.Pure-bash regex (no
cygpathdependency for CI portability); upper-cases the drive letter and converts forward slashes to backslashes before the existing path-existence validation. On Linux/macOS bash\$OSTYPEislinux-gnuordarwin*, so thecasenever matches andPROJECT_DIRis left untouched.Verification
End-to-end verified on Windows 11 + Git Bash with the v0.5.0 cached install:
.remember/now.md,today-2026-05-02.md, andtmp/last-save.jsonall created as expected.Tests
Four new cases under
TestWindowsCompatIssue11:test_resolve_paths_normalizes_msys_posix_path—/c/Users/dev/project→C:\Users\dev\project, including drive-letter casing and paths with spacestest_resolve_paths_leaves_unix_paths_unchanged— Win32 paths, Linux home, macOS home all pass through unchangedtest_normalized_msys_path_yields_windows_slug— end-to-end: post-normalization slug equals the slug Claude Code uses to store sessionstest_resolve_paths_has_msys_normalization_block— structural guard against the block being removedThe transformation is exercised via a temp script file (not
bash -c) so bash parses backslashes the same way it does in the production script.Notes
\$OSTYPEismsyson Git Bash for Windows and MSYS2,cygwinon Cygwin. Both produce/c/...paths.cygpath -wwas an alternative implementation — chose pure-bash regex for portability/CI test simplicity (Linux CI doesn't shipcygpath).test_session_dir_windows_backslashandtest_session_dir_windows_coloncover Win32-style input but never the POSIX-style input that Git Bash actually delivers, which is why the bug went undetected.