Skip to content

save-session.sh derives PROJECT_DIR from script path — fails when installed as plugin #19

Closed

Description

@vince-finqub

Bug

When the remember plugin is installed via the Claude Code plugin marketplace, save-session.sh fails silently because it derives PROJECT_DIR from its own file path:

# Line 57 of scripts/save-session.sh
PROJECT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"

This resolves to ~/.claude/plugins/cache/claude-plugins-official/ — not the user's actual project directory. As a result:

  • PIPELINE_DIR ($PROJECT_DIR/.claude/remember) points to a nonexistent path → Python pipeline fails
  • REMEMBER_DATA ($PROJECT_DIR/.remember) points to the wrong .remember/ → no output is ever written
  • REMEMBER_CONFIG and REMEMBER_HOOKS_DIR in log.sh also resolve incorrectly

The post-tool-hook.sh correctly uses $CLAUDE_PROJECT_DIR (set by Claude Code), but save-session.sh ignores it.

Symptoms

  • now.md and remember.md are always empty
  • logs/autonomous/ fills up with hundreds of failed log files containing:
    cd: /Users/.../.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory
    

Fix

Three files need patching:

1. scripts/save-session.sh (lines 57-58)

Before:

PROJECT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
PIPELINE_DIR="${PROJECT_DIR}/.claude/remember"

After:

PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "$0")/../../.." && pwd)}"
PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PIPELINE_DIR="${PLUGIN_ROOT}"

2. scripts/log.sh (line 119)

Before:

REMEMBER_CONFIG="${PROJECT_DIR:-.}/.claude/remember/config.json"

After:

REMEMBER_CONFIG="${PLUGIN_ROOT:-${PROJECT_DIR:-.}/.claude/remember}/config.json"

3. scripts/log.sh (line 145)

Before:

REMEMBER_HOOKS_DIR="${PROJECT_DIR:-.}/.claude/remember/hooks.d"

After:

REMEMBER_HOOKS_DIR="${PLUGIN_ROOT:-${PROJECT_DIR:-.}/.claude/remember}/hooks.d"

4. scripts/post-tool-hook.sh (line 90)

Before:

nohup "$SAVE_SCRIPT" "$SESSION_ID" > ...

After:

CLAUDE_PROJECT_DIR="$PROJECT" nohup "$SAVE_SCRIPT" "$SESSION_ID" > ...

Root Cause

The script assumes it lives inside the project tree (e.g., $PROJECT/.claude/remember/scripts/), but when installed as a Claude Code plugin it lives in ~/.claude/plugins/cache/. The ../../.. traversal lands in the wrong directory.

Environment

  • Claude Code (VS Code extension)
  • Plugin installed via marketplace (remember@claude-plugins-official)
  • macOS Darwin 24.6.0

Activity

  1. gaurav18115 commented on Apr 18, 2026

    @gaurav18115

    Hitting the same bug in v0.1.0 plugin cache. Confirmed:

    • now.md and daily logs never populated
    • logs/autonomous/ accumulating empty files (375+ on my machine) from cd: /Users/.../.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory
    • post-tool-hook.sh also leaks save-session.pid files because stale PIDs never get cleaned

    The fix in main (switching to resolve-paths.sh + $CLAUDE_PROJECT_DIR) looks right — I've verified locally by patching v0.1.0 with the equivalent change and saves now work end-to-end (now.md writing, daily compression running, zero warnings).

    The blocker for users is that the merged fixes (PRs #2, #3, #18) haven't been tagged as a release, so the plugin marketplace still ships the broken v0.1.0. Could you cut a v0.2.0 (or v0.1.1) release? That would unblock everyone without requiring manual patches to the plugin cache (which get overwritten on update anyway).

  2. fdaviddpt commented on Apr 25, 2026

    @fdaviddpt
    Contributor

    Fixed in #35 — log.sh now uses PIPELINE_DIR (from resolve-paths.sh) for config.json and hooks.d paths, with fallback to the old PROJECT_DIR-based path for local installs.

    Thank you @vince-finqub for the excellent bug report! The exact line numbers, before/after diffs, and root cause analysis made this a 2-line fix with confidence. That's the gold standard for issue reports. Much appreciated!

  3. added a commit that references this issue on Apr 26, 2026
    a3110c4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions