Skip to content

master-hook.sh uses relative path in .claude/settings.json — fails + silently skips dispatch chain in subdirs #22

Description

@spencerrwise

Bug

In .claude/settings.json, all 9 master-hook.sh hook entries use a
bare relative path:

"command": ".claude/hooks/master-hook.sh PreToolUse"

while every other hook in the same file uses an absolute
$CLAUDE_PROJECT_DIR/.claude/hooks/... path. When a tool runs with the
working directory inside a subdirectory (e.g. repos/private/<repo>/
during normal in-repo coding), the shell resolves the relative path
against the current directory:

/bin/sh: .claude/hooks/master-hook.sh: No such file or directory

Impact (more than cosmetic)

The visible symptom is a non-blocking PreToolUse:Read /
PostToolUse:Read hook error. The real problem: master-hook.sh is the
dispatcher for PreToolUse, PostToolUse, PreCompact, Stop,
SessionStart, UserPromptSubmit, Notification, SubagentStop,
SessionEnd. Whenever cwd ≠ HQ root (i.e. most repo work), the entire
master-hook chain silently does not run — auto-checkpoint, policy
injection, etc. fail open with only a non-blocking log line.

Affects every event (lines ~191/322/358/394/… on main). Not a
v14.1.0-beta.1 regression — the pre-beta backup has it too; long-standing.

Fix (mechanical, 9 lines)

-"command": ".claude/hooks/master-hook.sh <Event>"
+"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/master-hook.sh <Event>"

i.e. make these 9 entries match the absolute-path convention the other
36 hook entries in the same file already use. JSON validated after the
change.

Ready-to-merge branch (external PR creation is restricted on this repo,
same as #21):
spencerrwise:fix/master-hook-claude-project-dir — commit ecf50b7
(https://github.com/spencerrwise/hq-core/tree/fix/master-hook-claude-project-dir).
A maintainer can open the PR from that branch or cherry-pick.

Related: same portability family as #21 (HQ_ROOT propagation in
run-project.sh) — both are "core script invocation breaks when cwd
isn't the HQ root."

🤖 Reported via Claude Code

Activity

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