Hooks
Use this guide after arashi init when your workspace needs setup or cleanup automation around create and remove.
Create Hooks
.arashi/hooks/pre-create.sh.arashi/hooks/post-create.sh.arashi/hooks/pre-create.<repo>.sh.arashi/hooks/post-create.<repo>.sh
Remove Hooks
repos/<repo>/.arashi/hooks/pre-remove.shrepos/<repo>/.arashi/hooks/post-remove.sh.arashi/hooks/pre-remove.sh.arashi/hooks/post-remove.sh~/.arashi/hooks/<repo>/pre-remove.sh~/.arashi/hooks/<repo>/post-remove.sh~/.arashi/hooks/pre-remove.sh~/.arashi/hooks/post-remove.sh
Typical uses:
- run repository bootstrap after worktree creation
- stop tmux sessions before worktree removal
- clear generated files after branch cleanup
- apply repository-specific setup without hard-coding it into every workflow command
post-create Examples
Create hooks are useful when every new worktree needs the same local setup. Make the hook executable with chmod +x after you create it.
Useful create-hook variables include:
ARASHI_WORKTREE_PATHfor the new worktree pathARASHI_MAIN_REPO_PATHfor the main workspace pathARASHI_BRANCHfor the new branch nameARASHI_BASE_BRANCHfor the base branch used to create the worktree
Install Node Dependencies With pnpm
Use a repo-specific hook when only one child repo needs package install.
File: .arashi/hooks/post-create.web.sh
#!/bin/shset -eu
cd "$ARASHI_WORKTREE_PATH"pnpm install --frozen-lockfileCreate a Python Virtual Environment With uv
File: .arashi/hooks/post-create.api.sh
#!/bin/shset -eu
cd "$ARASHI_WORKTREE_PATH"uv venvuv syncCreate a Python Virtual Environment With pip
File: .arashi/hooks/post-create.api.sh
#!/bin/shset -eu
cd "$ARASHI_WORKTREE_PATH"python3 -m venv .venv. .venv/bin/activatepip install -r requirements.txtCopy a Local .env File From the Main Worktree
This is useful when your team keeps uncommitted local environment files in the main worktree and wants each new worktree to start with the same local config.
File: .arashi/hooks/post-create.web.sh
#!/bin/shset -eu
MAIN_ENV="$ARASHI_MAIN_REPO_PATH/repos/web/.env"WORKTREE_ENV="$ARASHI_WORKTREE_PATH/.env"
if [ -f "$MAIN_ENV" ] && [ ! -f "$WORKTREE_ENV" ]; then cp "$MAIN_ENV" "$WORKTREE_ENV"fiIf you want one shared hook for multiple child repos, use .arashi/hooks/post-create.sh and branch inside the script based on the target repository or the files present in ARASHI_WORKTREE_PATH.
Suggested Setup Sequence
- Confirm the create and remove flow you want first.
- Add workspace-level hooks only after you know which steps should be automatic.
- Add repository-scoped or global hooks only for trusted scripts and narrow use cases.
- Keep hooks focused on environment setup and cleanup, not on core project behavior.