Skip to content

Hook redirection fails in projects without pre-existing .remember/logs/ directory #32

Closed

Description

@Raymond-Noosh

Summary

Both hooks in hooks/hooks.json redirect stderr to .remember/logs/hook-errors.log, but nothing creates that directory before the redirect is opened. In any project that doesn't already have .remember/logs/ on disk, bash itself fails the redirection before the hook script runs, and the script never gets a chance to create the directory — a chicken-and-egg bug.

Users see errors like:

PostToolUse:Skill hook error
Failed with non-blocking status code:
/usr/bin/bash: line 1: /c/Code/React/<project>/.remember/logs/hook-errors.log: No such file or directory

on every PostToolUse:Skill (and SessionStart) invocation in affected projects.

Reproduction

  1. cd into any project that has never been touched by the remember plugin (no .remember/ directory).
  2. Start a Claude Code session and invoke any skill.
  3. Observe the hook error above on every tool call.

Root cause

hooks/hooks.json (both SessionStart and PostToolUse):

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

Bash opens the 2>> target before running the command. If .remember/logs/ does not exist, the open fails, bash prints its own error, and the script body — which presumably would mkdir -p the directory itself — never executes.

Suggested fix

Wrap the command in bash -c '…' so mkdir -p runs before the inner bash's redirection is set up:

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

Same shape for the PostToolUse entry. I've applied this locally and confirmed it resolves the error.

Version

  • Plugin: remember@claude-plugins-official v0.5.0
  • Tag v0.5.0 (914445a) and current main both still contain the buggy form.

Activity

  1. fdaviddpt commented on Apr 25, 2026

    @fdaviddpt
    Contributor

    Fixed in #33 — bootstrap-dirs.sh now creates the .remember/logs/ directory before any stderr redirect. hooks.json no longer contains inline 2>> redirects.

    Thank you @Raymond-Noosh for reporting this! With 20k installs, every fresh-project bug report helps us catch what our own testing missed. The fix includes 17 tests covering fresh projects, partial state, git worktrees, read-only filesystems, and more — so this class of bug shouldn't come back.

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