Conversation
added 3 commits
April 25, 2026 16:46
… redirect The SessionStart and PostToolUse hook commands in hooks.json redirected stderr to .remember/logs/hook-errors.log via 2>>. Bash opens the redirect target before running the script, so on fresh projects where .remember/logs/ does not exist, the redirect fails and the hook script never executes. Four independent users reported this (issues #23, #27, #31, #32). Fix: introduce scripts/bootstrap-dirs.sh as the single source of truth for the .remember/ directory layout. Every hook script sources it after resolve-paths.sh. It creates tmp/, logs/, logs/autonomous/, .gitignore, and redirects stderr via exec 2>> (guarded by -d check for read-only filesystems). hooks.json commands are now clean one-liners with no inline redirects. - New: scripts/bootstrap-dirs.sh (dir creation + stderr redirect) - session-start-hook.sh: source bootstrap-dirs.sh, remove duplicate mkdir - post-tool-hook.sh: source bootstrap-dirs.sh - hooks.json: remove 2>> redirects from both commands - 17 new tests covering: bug reproduction, fresh project, partial state, spaces/unicode in paths, read-only filesystem, idempotency, git worktrees, concurrent sessions, source ordering Closes #23, #27, #31, #32 Supersedes #21 Co-Authored-By: Max <noreply>
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 #28 (Windows bootstrap fix).
Co-Authored-By: Max <noreply>
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 #28. Co-Authored-By: Max <noreply>
2 tasks
added 2 commits
April 25, 2026 17:05
BSD mktemp (macOS) treats characters after XXXXXX as literal — it creates a file named exactly 'foo-XXXXXX.txt' with no randomization. The first call succeeds silently, the second fails with 'File exists'. This is both a collision bug and a security issue (predictable names). Remove .txt/.json/.md extensions from all 11 mktemp calls in save-session.sh (5) and run-tests.sh (6). Added tests: BSD mktemp reproduction, guard against future extensions in scripts. Inspired by josemoreno801-netizen's PR #30. Closes #30 scope. Co-Authored-By: Max <noreply>
…er guard
Two related issues in the save-session pipeline:
1. When a previous entry's header showed 'unknown' (e.g., from git
rev-parse in a non-repo cwd), Haiku occasionally mimicked that
header instead of using the {{TIME}} | {{BRANCH}} values.
Fix: explicit prompt instruction to copy header verbatim and
never invent 'unknown | unknown'.
2. The placeholder guard only checked the first line (head -1) for
{{TIME}} and {{BRANCH}}. If body placeholders ({{LAST_ENTRY}},
{{EXTRACT}}) were unsubstituted, the broken prompt was sent to
Haiku anyway.
Fix: grep the entire prompt file for all 4 placeholders.
Tests: prompt content assertions, guard coverage check, head -1 guard.
Inspired by cyanprot's PR #22. Closes #24.
Co-Authored-By: Max <noreply>
This was referenced Apr 25, 2026
Closed
This was referenced May 2, 2026
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.
Summary
Five independent fixes shipped as separate commits, addressing portability bugs reported by the community. Each commit is self-contained with its own tests.
Commit 1: Centralize .remember/ directory bootstrap
Problem: hooks.json redirected stderr via 2>> to .remember/logs/hook-errors.log. Bash opens the redirect target before the script runs, so on fresh projects where .remember/logs/ doesn't exist, the redirect fails and the hook never executes. Four users reported this (#23, #27, #31, #32).
Fix: New scripts/bootstrap-dirs.sh — single source of truth for the .remember/ directory layout. Every hook script sources it after resolve-paths.sh. Creates tmp/, logs/, logs/autonomous/, .gitignore, and redirects stderr via exec 2>> (guarded for read-only filesystems). hooks.json commands are now clean one-liners.
17 new tests: bug reproduction, fresh project, partial state, spaces/unicode in paths, read-only filesystem, idempotency, git worktrees, concurrent sessions, source ordering.
Closes #23, #27, #31, #32 — Supersedes #21
Commit 2: Centralize SYS_TMPDIR for Windows portability
Hardcoded /tmp/ fails on Windows (Git Bash). bootstrap-dirs.sh now exports SYS_TMPDIR. Fixed user-prompt-hook.sh and 7 mktemp calls in run-tests.sh. Guard test prevents future regressions.
Inspired by @evikzub PR #28.
Commit 3: README Windows prerequisites
Documents Git Bash/MSYS2/WSL requirements and jq/coreutils dependencies. Based on @evikzub PR #28.
Commit 4: BSD mktemp compatibility (macOS)
BSD mktemp treats chars after XXXXXX as literal — creates a file with no randomization. Removed extensions from all 11 mktemp calls. Guard test prevents regressions.
Inspired by @josemoreno801-netizen PR #30. Closes #30 scope.
Commit 5: Prevent Haiku from inventing unknown header
When previous entries showed unknown, Haiku mimicked that instead of using computed TIME/BRANCH values. Added explicit prompt instruction + expanded placeholder guard to full-file grep.
Inspired by @cyanprot PR #22. Closes #24.
Test coverage
24 new tests across 3 test classes. Full suite: 210 passed, 0 failed.
Related PRs