Skip to content

save-session.sh and run-consolidation.sh fail when installed via plugin cache (PROJECT_DIR path traversal) #1

@DickSwart

Description

@DickSwart

Environment:

  • Claude Code with plugin system
  • Plugin installed at: ~/.claude/plugins/cache/claude-plugins-official/remember/0.1.0/
  • Plugin version: 0.1.0

Problem:

When installed via the Claude Code plugin system (not manually copied into the project), save-session.sh and run-consolidation.sh resolve PROJECT_DIR to the wrong directory.

Both scripts compute the project root via path traversal from the script's own location:

PROJECT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"

This works when the plugin is copied into .claude/remember/scripts/ inside the project. But when installed in the plugin cache, the script path is:

~/.claude/plugins/cache/claude-plugins-official/remember/0.1.0/scripts/save-session.sh

Going up 3 levels resolves to:

~/.claude/plugins/cache/claude-plugins-official/   ← wrong

Instead of the actual project root.

Symptom:

Every save-session.sh invocation immediately fails:

cd: /Users/<user>/.claude/plugins/cache/claude-plugins-official/.claude/remember: No such file or directory

Sessions are never saved. The .remember/ data directory is never populated.

Note: session-start-hook.sh works correctly because it already uses CLAUDE_PROJECT_DIR:

PROJECT="${CLAUDE_PROJECT_DIR:-.}"

save-session.sh and run-consolidation.sh should use the same pattern.

Suggested fix:

Replace line 57 of save-session.sh and line 37 of run-consolidation.sh:

# Before:
PROJECT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"

# After:
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"

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