[BUG] relative hook paths not resolved absolute when cwd changes they fail to run.

Resolved 💬 5 comments Opened Jul 15, 2025 by LiamKarlMitchell Closed Jul 28, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [x] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: <!-- output of claude --version -->

1.0.52 (Claude Code)

  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->

macOS 15.5

  • Terminal: <!-- e.g. iTerm2, Terminal App -->

Vs Code terminal running claude.
Zsh
Omzsh

Bug Description

<!-- A clear and concise description of the bug -->
When I have a hook using a relative path e.g. To root of project, but claude cli changes directory, it does not run the hool relative to location it started from.

It needs to realise if a relative path for my project is set in settings for the hook, and if so put the correct absolute path its self.
And use that as the working dir for the hook execution.

Steps to Reproduce

  1. Add a hook script relative e.g. node ./.claude/hooks/node/write.js
  2. When claude cd's into another child directory to write a file and run commands in that dir e.g. A sub project in a npm workspace,
  3. The path it attempts to run hook from is not roor of project where claude was executed from.

Expected Behavior

<!-- What you expected to happen -->
Run the hook

Actual Behavior

<!-- What actually happened -->
Does not run the hook

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
Keep right cwd and resolve relative hook paths into absolute ones.

Wanting to have hooks checked into repo, and not all devs use same path so a relative path to hooks is ideal.

The hook does spawn processes to stylelint, lint, prettier etc, but this should not be changing working directory that claude runs hooks from...

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗