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

HookRuns
.vibetree/hooks/post-createAfter a worktree is created, with the new worktree as the working directory.
.vibetree/hooks/pre-removeBefore 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

VariableValue
VIBETREE_HOOKThe hook name, post-create or pre-remove.
VIBETREE_PROJECT_PATHThe main repository path.
VIBETREE_WORKTREE_PATHThe worktree the hook is running for.
VIBETREE_BRANCHThe 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