[BUG] hooks don't seem to work per-project
Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 6 comments · opened Jul 6, 2025 · closed Jul 7, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.43
- Operating System: Ubuntu in WSL
- Terminal: VS Code Terminal
Bug Description
https://docs.anthropic.com/en/docs/claude-code/hooks#configuration describes hooks as being per-project, but claude code does not seem to pick up this config.
Steps to Reproduce
but I have this in my .claude/settings.json:
{
"hooks": [
{
"matcher": {
"tool": ["Edit", "MultiEdit", "Write"],
"pathGlob": "**/*.rs"
},
"events": {
"PostToolUse": "cargo +nightly fmt"
}
},
Expected Behavior
I expect the hook to run/
Actual Behavior
yet claude --debug shows:
● Update(foo.rs)
⎿ Updated foo.rs with 1 addition and 1 removal
36 /// Request to foo a bar
37 #[derive(Clone)]
38 pub struct Foo {
39 - pub role: String,
39 + pub role: String,pub timestamp:Option<String>,
40 }
41
42 /// Request to baz a bar
[DEBUG] Executing hooks for PostToolUse:Edit
[DEBUG] Getting matching hook commands for PostToolUse with query: Edit
[DEBUG] Found 0 hook matchers in settings
[DEBUG] Matched 0 hooks for query "Edit"
[DEBUG] Found 0 hook commands to execute
Additional Context
This is my first time using hooks so I may have just made a very basic mistake here.
6 Comments
What you have does not match what we expect per the documentation. Instead of
You should have something like
Hilarious and slightly embarrassing: that's what I get for trusting Claude to read the docs for me. Confirmed that this does actually work. Thank you, and sorry for the noise: I'm very excited about this feature.
@dicksontsai is there a way to make changes to the Claude Documentation, I believe it is a little skimpy on the orientation. Could use a slightly more context.
@jackstine You can write a blog post and link it here, and we'll see what we should upstream to our official documentation. The community's been great at exploring/teaching these features, honestly better than we can since our focus is on improving Claude Code itself.
@dicksontsai I should be able to in a few days, since my main focus is around Claude Code hooks at the moment.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.