Summary
Allow users to run custom scripts on environment lifecycle events.
Hook points
~/.cac/envs/<name>/hooks/
├── pre-activate.sh # before activation
├── post-activate.sh # after activation
├── pre-deactivate.sh # before switching away
└── pre-claude.sh # before claude starts (inside wrapper)
Use cases
- Start/stop VPN on environment switch
- Switch DNS settings
- Log environment usage
- Run custom proxy health checks
- Set additional environment variables
Implementation
- Wrapper (
templates.sh) checks for hooks/pre-claude.sh and sources it
_env_cmd_activate checks for pre-activate.sh / post-activate.sh
- Hooks are optional — no hooks directory = no action
Summary
Allow users to run custom scripts on environment lifecycle events.
Hook points
Use cases
Implementation
templates.sh) checks forhooks/pre-claude.shand sources it_env_cmd_activatechecks forpre-activate.sh/post-activate.sh