Skip to content

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

@vince-finqub

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

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