Repository navigation
Description
Summary
The remember plugin's auto-save pipeline (PostToolUse hook -> save-session.sh -> Haiku summarization) silently fails on Windows. Four independent bugs combine to make the pipeline completely non-functional. The SessionStart hook and /remember skill work fine since they don't hit the same code paths.
Environment
- Windows 11 Pro
- Claude Code CLI (bash shell via Git Bash)
- Python 3.13
- Plugin version 0.1.0
Bugs
1. save-session.sh and run-consolidation.sh compute wrong PROJECT_DIR
Both scripts use:
PROJECT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"This resolves relative to the script's location in the plugin cache (~/.claude/plugins/cache/claude-plugins-official), not the actual project directory. The session-start-hook.sh correctly uses CLAUDE_PROJECT_DIR, but these two scripts don't.
Fix: Use CLAUDE_PROJECT_DIR (and pass it via env vars from the calling hooks since nohup background processes need it explicitly):
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
PIPELINE_DIR="${CLAUDE_PLUGIN_ROOT:-$(cd "$SCRIPT_DIR/.." && pwd)}"2. Wrong session directory slug algorithm
All three shell scripts and extract.py use tr '/' '-' (or .replace("/", "-") in Python) to generate the project slug for finding JSONL session files. On Windows, paths use backslashes and colons (C:\Users\...), so this produces C:-Users-primemate-Solutions-_General.
Claude Code actually generates slugs like C--Users-primemate-Solutions--General -- it replaces all non-alphanumeric characters (not just /) with -.
Fix (shell):
SESSION_DIR="$HOME/.claude/projects/$(echo "$PROJECT" | sed 's/[^a-zA-Z0-9-]/-/g')"Fix (Python, extract.py _session_dir):
import re
slug = re.sub(r'[^a-zA-Z0-9-]', '-', project_dir)
return os.path.expanduser("~/.claude/projects/" + slug)3. PIPELINE_DIR points to wrong location
save-session.sh and run-consolidation.sh set:
PIPELINE_DIR="${PROJECT_DIR}/.claude/remember"But the pipeline module is in the plugin cache, not in the project's .claude/remember/ directory. Should use CLAUDE_PLUGIN_ROOT.
4. Python open() calls lack UTF-8 encoding
Windows Python defaults to cp1252 encoding. The JSONL session files contain UTF-8 characters, causing UnicodeDecodeError in extract.py's count_lines(), extract_messages(), and get_last_save_line(). Multiple open() calls in shell.py and prompts.py have the same issue.
Fix: Either add encoding="utf-8" to all open() calls, or set export PYTHONUTF8=1 in the shell scripts before calling Python.
Affected files
scripts/save-session.sh(bugs 1, 3)scripts/run-consolidation.sh(bugs 1, 3)scripts/post-tool-hook.sh(bug 2, also needs to pass env vars to nohup)scripts/session-start-hook.sh(bug 2, also needs to pass env vars to background calls)pipeline/extract.py(bugs 2, 4)pipeline/shell.py(bug 4)pipeline/prompts.py(bug 4)
Result
After patching all four bugs locally, the full pipeline works: extraction, Haiku summarization, now.md creation, NDC compression to today-*.md, and position tracking via last-save.json.
Activity
fdaviddpt commentedon Mar 30, 2026
Fixed in v0.2.0 (commit 22fd949). All four bugs addressed:
PROJECT_DIR— was fixed in PR Fix PROJECT_DIR path traversal when installed via plugin cache #2 (March 23), but marketplace pins to install-time committr '/' '-'replaced withsed 's/[^a-zA-Z0-9]/-/g'across all 4 scriptsPIPELINE_DIR— was fixed in PR Fix PROJECT_DIR path traversal when installed via plugin cache #2 alongsidePROJECT_DIRencoding="utf-8"added to allopen()calls (~20 sites)To update: we've submitted the updated version to Anthropic's marketplace. Once they approve it, run
/pluginin Claude Code, find "remember", and reinstall it.In the meantime, you can install directly from the repo to get the fix now:
/pluginhttps://github.com/Digital-Process-Tools/claude-rememberinto your project's.claude/remember/directoryThanks for the thorough diagnosis — you basically wrote the fix for us.
sixside commentedon Mar 30, 2026
The v0.2.0 commit (22fd949) fixed 3 of the 4 bugs listed here but missed one.
pipeline/haiku.py:72still hascwd="/tmp"incall_haiku(). On Windows, Python'ssubprocess.run()doesn't resolve/tmpthe way Git Bash does, so it throwsNotADirectoryError: [WinError 267]. This kills the entire consolidation pipeline —recent.md,archive.md, andcore-memories.mdnever get generated.The shell scripts (
save-session.sh,run-consolidation.sh) usecd /tmp &&which works fine under Git Bash. It's only the Pythoncwd="/tmp"that breaks.Fix is one line in
haiku.py:fix: use tempfile.gettempdir() instead of hardcoded /tmp in haiku.py
fdaviddpt commentedon Mar 30, 2026
Fixed the remaining
cwd="/tmp"bug inpipeline/haiku.py(commit 618fc72). Now usestempfile.gettempdir()which returns the platform-appropriate temp directory. All Python/tmpreferences are resolved — the shell script ones work fine under Git Bash.fdaviddpt commentedon Mar 30, 2026
Thanks @sixside for the detailed report — great catch on the Python vs Git Bash distinction. Wouldn't have found this without your analysis.