Bug
save-session.sh never successfully saves memory when the plugin is installed through Claude Code's official plugin system. Every invocation fails with:
save-session.sh: line 135: cd: ~/.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory
save-session.sh: line 140: [: : integer expression expected
save-session.sh: line 142: [: : integer expression expected
save-session.sh: line 164: cd: ~/.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory
Root Cause
save-session.sh lines 57-58 compute PROJECT_DIR by walking 3 directories up from $0:
PROJECT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
PIPELINE_DIR="${PROJECT_DIR}/.claude/remember"
When installed via Claude Code's plugin cache at ~/.claude/plugins/cache/claude-plugins-official/remember/<version>/scripts/, going up 3 levels resolves to ~/.claude/plugins/cache/claude-plugins-official/ — not the actual project directory.
The other two hook scripts (post-tool-hook.sh line 31-32, session-start-hook.sh line 40-41) already correctly use CLAUDE_PROJECT_DIR and CLAUDE_PLUGIN_ROOT env vars. save-session.sh is the only script that ignores these and does its own (broken) path calculation.
Impact
now.md, today-*.md, recent.md, archive.md, core-memories.md are never created
- The
.remember/logs/autonomous/ directory fills up with hundreds of error/empty log files
- The session-start hook prints the
=== REMEMBER === banner, making it look like the plugin is working, but no memory is ever saved or loaded
Suggested Fix
Replace lines 57-58 in save-session.sh:
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "$0")/../../.." && pwd)}"
PIPELINE_DIR="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
These env vars are set by Claude Code for hook scripts and inherited by the background nohup process that launches save-session.sh. The fallback preserves the original behavior for manual invocation.
Environment
- Claude Code plugin system (installed via
claude-plugins-official)
- macOS / zsh
- Plugin version: 0.1.0
Bug
save-session.shnever successfully saves memory when the plugin is installed through Claude Code's official plugin system. Every invocation fails with:Root Cause
save-session.shlines 57-58 computePROJECT_DIRby walking 3 directories up from$0:When installed via Claude Code's plugin cache at
~/.claude/plugins/cache/claude-plugins-official/remember/<version>/scripts/, going up 3 levels resolves to~/.claude/plugins/cache/claude-plugins-official/— not the actual project directory.The other two hook scripts (
post-tool-hook.shline 31-32,session-start-hook.shline 40-41) already correctly useCLAUDE_PROJECT_DIRandCLAUDE_PLUGIN_ROOTenv vars.save-session.shis the only script that ignores these and does its own (broken) path calculation.Impact
now.md,today-*.md,recent.md,archive.md,core-memories.mdare never created.remember/logs/autonomous/directory fills up with hundreds of error/empty log files=== REMEMBER ===banner, making it look like the plugin is working, but no memory is ever saved or loadedSuggested Fix
Replace lines 57-58 in
save-session.sh:These env vars are set by Claude Code for hook scripts and inherited by the background
nohupprocess that launchessave-session.sh. The fallback preserves the original behavior for manual invocation.Environment
claude-plugins-official)