Skip to content

feat(hookify): load rules from ~/.claude global location#54749

Open
watarus wants to merge 1 commit intoanthropics:mainfrom
watarus:hookify-global-rules
Open

feat(hookify): load rules from ~/.claude global location#54749
watarus wants to merge 1 commit intoanthropics:mainfrom
watarus:hookify-global-rules

Conversation

@watarus
Copy link
Copy Markdown

@watarus watarus commented Apr 29, 2026

Summary

  • hookify currently only loads rules from <cwd>/.claude/hookify.*.local.md, so a rule has to be re-created in every project.
  • This PR also reads ~/.claude/hookify.*.local.md so a rule can be defined once and apply across every project.
  • Same-named rules: project-local overrides global, so a project can still override a global rule. Existing project-only setups are unaffected (the new path is purely additive).

Behavior

  • New search order: ~/.claude/hookify.*.local.md (global) merged with <cwd>/.claude/hookify.*.local.md (project-local).
  • Dedupe is by name field, project-local last-write-wins.
  • When cwd == $HOME the two globs hit the same files; those are filtered via os.path.abspath so each file is only loaded once.
  • All existing error handling / event filtering / enabled filtering is preserved.

Test plan

  • Smoke test: global-only rule, project-only rule, and same-named rule in both → project-local wins, no duplicates
  • Smoke test: cwd == $HOME → no double-loading
  • Existing project-only setups continue to behave unchanged (no global file present)

🤖 Generated with Claude Code

Rules in ~/.claude/hookify.*.local.md now apply across every project, in
addition to the existing <cwd>/.claude/hookify.*.local.md project-local
rules. When the same rule name exists in both, project-local wins so a
project can override a global rule. Existing project-only setups are
unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant