Skip to content

Windows bootstrap fix + TMPDIR portability + README prereqs#28

Closed
evikzub wants to merge 3 commits intoDigital-Process-Tools:mainfrom
evikzub:fix/windows-bootstrap-and-portability
Closed

Windows bootstrap fix + TMPDIR portability + README prereqs#28
evikzub wants to merge 3 commits intoDigital-Process-Tools:mainfrom
evikzub:fix/windows-bootstrap-and-portability

Conversation

@evikzub
Copy link
Copy Markdown
Contributor

@evikzub evikzub commented Apr 23, 2026

Summary

Three small fixes surfaced while installing the plugin on Windows (Git Bash / MSYS2). Each commit is independent — feel free to cherry-pick.

  • fix(hooks) — the SessionStart and PostToolUse hook commands in hooks/hooks.json redirect stderr to .remember/logs/hook-errors.log via 2>>. Bash opens the redirect target before running the script, so on the first invocation in a fresh project (when the .remember/logs/ directory does not yet exist) the redirect fails and the hook script never runs — even though the script itself contains mkdir -p .remember/logs near the top. Classic chicken-and-egg. Prefix both commands with mkdir -p ... && so the redirect target is guaranteed to exist.

  • fix(user-prompt-hook)user-prompt-hook.sh reads /tmp/claude-ctx-pct. Works on macOS/Linux, but on Windows Git Bash the /tmp mapping may differ from what other processes that write the file expect. Honor \$TMPDIR with a /tmp fallback. No behavior change on default macOS/Linux.

  • docs(readme) — the Requirements section listed Python / bash / Claude CLI but not jq (which log.sh and session-start-hook.sh rely on). Add jq + coreutils, and a short Windows subsection documenting the supported POSIX environments (Git Bash/MSYS2, WSL) and the need to install jq / python3 alongside Git for Windows.

Reproduction

On a fresh project (Windows or Unix):

  1. Install the plugin.
  2. Start a new Claude Code session.
  3. Hook logs a "No such file or directory" warning on .remember/logs/hook-errors.log. Subsequent invocations succeed (the hook script's own mkdir -p eventually runs once something else creates the directory), but the first session's SessionStart memory injection is lost.

Test plan

  • Applied the same two code changes locally at ~/.claude/plugins/cache/claude-plugins-official/remember/0.5.0/ on Windows 11 with Git Bash + MSYS2 + jq + Python 3.11. Warning disappears on new-project startup; memory pipeline runs normally.
  • scripts/run-tests.sh — not run (Windows MSYS2 test env not set up by this contributor). Upstream test run would be appreciated.

Not changed

  • nohup usage in session-start-hook.sh / post-tool-hook.sh — on Windows MSYS2 this doesn't truly detach, but fixing it properly likely requires a platform-specific backgrounding strategy. Out of scope for this PR.

evikzub added 3 commits April 23, 2026 22:35
The SessionStart and PostToolUse hook commands redirect stderr to
.remember/logs/hook-errors.log via bash's 2>> operator. Bash opens
the redirect target before running the command, so on the first
invocation in a fresh project the redirect fails ("No such file or
directory") and the hook script never runs. That same script would
have created the directory via mkdir -p in its own body — classic
chicken-and-egg.

Prefix both hook commands with mkdir -p of the parent directory so
the redirect target is guaranteed to exist. The && gate also keeps
the original behavior: if mkdir somehow fails, the hook script does
not run.
user-prompt-hook.sh read /tmp/claude-ctx-pct directly, which works
on macOS/Linux but is not portable. Windows Git Bash / MSYS2 users
may have /tmp mapped to a different path than the producer of the
file expects.

Switch to ${TMPDIR:-/tmp}/claude-ctx-pct so the path honors the
standard POSIX TMPDIR env var, falling back to /tmp when unset.
No behavior change on macOS/Linux with default TMPDIR.
The Requirements section listed Python, Claude CLI, and bash, but
not jq — which session-start-hook.sh and log.sh call for config
reading. Also, Windows support landed in v0.2.0 but the README did
not describe the supported Windows setup paths (Git Bash / MSYS2 /
WSL) or note that jq and python3 must be on PATH separately from
Git for Windows.

Add jq and coreutils to the requirements list and a short Windows
subsection documenting the two supported POSIX environments.
@fdaviddpt
Copy link
Copy Markdown
Contributor

Closing — the three fixes in this PR have been addressed in #33:

  1. hooks.json mkdirfix: centralize .remember/ bootstrap + portability fixes (Windows, macOS, Haiku) #33 commit 1 (bootstrap-dirs.sh — more architectural fix)
  2. TMPDIR portabilityfix: centralize .remember/ bootstrap + portability fixes (Windows, macOS, Haiku) #33 commit 2 (centralized SYS_TMPDIR, cherry-picked your approach)
  3. README Windows prereqsfix: centralize .remember/ bootstrap + portability fixes (Windows, macOS, Haiku) #33 commit 3 (cherry-picked your documentation)

Thank you @evikzub for the excellent Windows work! You were the first to surface the TMPDIR issue and document the Windows prerequisites clearly. Your contributions are credited in the commit messages. We also approved your PR #29 (Python detection + slug fix) separately — that one stands on its own and is ready to merge. Looking forward to more contributions!

@fdaviddpt fdaviddpt closed this Apr 25, 2026
Bunshin-v2 pushed a commit to Bunshin-v2/claude-remember that referenced this pull request Apr 26, 2026
Hardcoded /tmp/ paths fail on Windows where /tmp doesn't exist but
$TMPDIR does (set by Git Bash/MSYS2). Centralize the fix:

- bootstrap-dirs.sh: export SYS_TMPDIR="${TMPDIR:-/tmp}" so every
  script that sources bootstrap gets it for free
- user-prompt-hook.sh: use $SYS_TMPDIR for claude-ctx-pct file,
  also source bootstrap-dirs.sh for consistent setup
- run-tests.sh: replace 7 hardcoded mktemp /tmp/ calls with $SYS_TMPDIR
- New test: guard against hardcoded /tmp/ in all production scripts

Inspired by evikzub's PR Digital-Process-Tools#28 (Windows bootstrap fix).

Co-Authored-By: Max <noreply>
Bunshin-v2 pushed a commit to Bunshin-v2/claude-remember that referenced this pull request Apr 26, 2026
Windows users need Git Bash/MSYS2 or WSL for bash scripts.
Also documents jq and coreutils dependencies that were implicit.

Based on evikzub's contribution in PR Digital-Process-Tools#28.

Co-Authored-By: Max <noreply>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants