Skip to content

Bug: hooks fail silently when .remember/logs/ directory doesn't exist #41

@frinsen

Description

@frinsen

Description

The SessionStart and PostToolUse hooks both redirect stderr to .remember/logs/hook-errors.log:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/session-start-hook.sh" 2>> "${CLAUDE_PROJECT_DIR:-.}/.remember/logs/hook-errors.log"
bash "${CLAUDE_PLUGIN_ROOT}/scripts/post-tool-hook.sh" 2>> "${CLAUDE_PROJECT_DIR:-.}/.remember/logs/hook-errors.log"

If the .remember/logs/ directory doesn't exist (e.g. in a fresh project that has never used the plugin), the >> redirect fails with:

/path/to/project/.remember/logs/hook-errors.log: No such file or directory
PostToolUse hook error

Expected behaviour

The hooks should work on first use in any project directory without requiring manual setup.

Suggested fix

Add a mkdir -p before (or inline with) the redirect:

mkdir -p "${CLAUDE_PROJECT_DIR:-.}/.remember/logs" && bash "${CLAUDE_PLUGIN_ROOT}/scripts/session-start-hook.sh" 2>> "${CLAUDE_PROJECT_DIR:-.}/.remember/logs/hook-errors.log"

Or handle directory creation in the plugin's install/activation step.

Environment

  • Plugin version: 0.5.0
  • Triggered on: first use in a project directory that had never previously used the plugin

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