docs / hooks
Worktree hooks
Hooks are executable scripts in your repository that VibeTree runs around the worktree lifecycle. Use them to make every new worktree ready for an agent with zero manual setup.
Locations
| Hook | Runs |
|---|---|
| .vibetree/hooks/post-create | After a worktree is created, with the new worktree as the working directory. |
| .vibetree/hooks/pre-remove | Before a worktree is removed. A failing pre-remove warns but never blocks deletion. |
Hooks must be executable (chmod +x). They exist per repository, so commit them to share with your team.
Environment
| Variable | Value |
|---|---|
| VIBETREE_HOOK | The hook name, post-create or pre-remove. |
| VIBETREE_PROJECT_PATH | The main repository path. |
| VIBETREE_WORKTREE_PATH | The worktree the hook is running for. |
| VIBETREE_BRANCH | The worktree's branch. |
Hooks time out after 120 seconds. Output is captured and shown in the app.
Example post-create
#!/bin/sh
# .vibetree/hooks/post-create: make the worktree agent-ready
pnpm install
cp "$VIBETREE_PROJECT_PATH/.env" .env