⌨️CwdChanged Hook
Also known as CwdChanged
The event when Claude moves to a new folder with cd.
Think of it like
It is like a light that turns on. It does so when you walk into a room.
Example
Emma's repo has two apps with their own settings. Her CwdChanged hook loads the right ones each time Claude moves between them.
Why it matters
Without it, Claude keeps the old folder's settings after a cd.
Definition
Example code
bash
#!/bin/bash
# load the new folder's direnv settings
direnv export bash >> "$CLAUDE_ENV_FILE"Common mistake
Key takeaways
- 1When the folder changes. After cd.
- 2No matcher. Every time.
- 3Can set variables. Until next move.