You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
save-session.sh: PROJECT_DIR and PIPELINE_DIR miscalculated when installed as global plugin cache #9
When installed via the Claude Code plugin marketplace (global cache at ~/.claude/plugins/cache/), save-session.sh silently fails on every invocation. No session history is ever written.
Root Cause
save-session.sh calculates PROJECT_DIR by walking 3 levels up from its own script path:
This assumes the script lives at $PROJECT_ROOT/.claude/remember/scripts/save-session.sh — which is correct for a local install, but wrong when installed to the global plugin cache.
When installed via the marketplace, the script is at:
cd: /Users/.../.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory
This error appears in every log file under .remember/logs/autonomous/.
Evidence
post-tool-hook.sh correctly sets PROJECT_DIR from $CLAUDE_PROJECT_DIR and PLUGIN_ROOT from $CLAUDE_PLUGIN_ROOT — but these are not exported to the backgrounded save-session.sh subprocess, and save-session.sh unconditionally overwrites PROJECT_DIR anyway.
Suggested Fix
In post-tool-hook.sh, export PROJECT_DIR before the nohup call:
Can confirm — seeing identical symptoms on macOS (CLI v2.1.91, plugin v0.1.0).
Our .remember/logs/autonomous/save-*.log files contain the same error:
save-session.sh: line 135: cd: /Users/.../.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory
Interesting data point: the bug is project-dependent. For one project (foam), CLAUDE_PROJECT_DIR reaches the backgrounded save-session.sh and extraction works. For another project (logos-app), it does not — same error as described here. Both are plugin-mode installs from the marketplace.
The current save-session.sh:57 has the CLAUDE_PROJECT_DIR fallback from the #8 fix:
But as you noted, post-tool-hook.sh doesn't export PROJECT_DIR before the nohup call, and CLAUDE_PROJECT_DIR propagation from Claude Code seems inconsistent across projects. Your suggested fix (export in post-tool-hook.sh + respect in save-session.sh) matches what we'd recommend.
Separately, we found an additional bug: even when extraction succeeds, _parse_response() in pipeline/haiku.py can't parse the CLI v2+ --output-format json output (expects dict, gets array). Filing that as a separate issue.
Thanks for the detailed report — this is the kind of analysis that actually helps.
Fixed in v0.3.0 (just pushed). The inline ../../.. path traversal has been replaced with a centralized resolve-paths.sh that all scripts source. Marketplace installs without CLAUDE_PROJECT_DIR now fail with a clear FATAL error instead of silently computing wrong paths. All hooks now log their resolved paths to .remember/logs/ and stderr is captured to .remember/logs/hook-errors.log.
To update:/plugin → find "remember" → update (marketplace plugins are pinned at install time, they don't auto-update).
One question: was the failure consistent (every project, every time) or intermittent (some projects worked, others didn't)? We're trying to understand whether Claude Code sometimes doesn't set CLAUDE_PROJECT_DIR for marketplace plugins, or if there's a race condition with nohup subprocesses. Your insight from seeing it work in one project but not another would really help narrow it down.
Activity
ryan6416 commentedon Apr 3, 2026
Can confirm — seeing identical symptoms on macOS (CLI v2.1.91, plugin v0.1.0).
Our
.remember/logs/autonomous/save-*.logfiles contain the same error:Interesting data point: the bug is project-dependent. For one project (foam),
CLAUDE_PROJECT_DIRreaches the backgroundedsave-session.shand extraction works. For another project (logos-app), it does not — same error as described here. Both are plugin-mode installs from the marketplace.The current
save-session.sh:57has theCLAUDE_PROJECT_DIRfallback from the #8 fix:PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "$0")/../../.." && pwd)}"But as you noted,
post-tool-hook.shdoesn'texport PROJECT_DIRbefore thenohupcall, andCLAUDE_PROJECT_DIRpropagation from Claude Code seems inconsistent across projects. Your suggested fix (export in post-tool-hook.sh + respect in save-session.sh) matches what we'd recommend.Separately, we found an additional bug: even when extraction succeeds,
_parse_response()inpipeline/haiku.pycan't parse the CLI v2+--output-format jsonoutput (expects dict, gets array). Filing that as a separate issue.fdaviddpt commentedon Apr 3, 2026
Thanks for the detailed report — this is the kind of analysis that actually helps.
Fixed in v0.3.0 (just pushed). The inline
../../..path traversal has been replaced with a centralizedresolve-paths.shthat all scripts source. Marketplace installs withoutCLAUDE_PROJECT_DIRnow fail with a clearFATALerror instead of silently computing wrong paths. All hooks now log their resolved paths to.remember/logs/and stderr is captured to.remember/logs/hook-errors.log.To update:
/plugin→ find "remember" → update (marketplace plugins are pinned at install time, they don't auto-update).One question: was the failure consistent (every project, every time) or intermittent (some projects worked, others didn't)? We're trying to understand whether Claude Code sometimes doesn't set
CLAUDE_PROJECT_DIRfor marketplace plugins, or if there's a race condition withnohupsubprocesses. Your insight from seeing it work in one project but not another would really help narrow it down.