Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Run automatically on Claude Code events. Claude doesn't decide.
1 caution to review before installing
A hook runs when Claude uses the Bash tool
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Bare-container worktree lifecycle hooks. Claude does its file-modifying work in
bare containers under ~/wt, never in the human's original clones.
On EnterWorktree, derives the repo from the most-recent cd-intent (recorded
by cwd_tracker.py before the harness can snap the cwd back), most-recent first:
cd ~/wt/<repo> intent names the repo by path — it reuses the existing bare
container's origin, or (no container yet) infers a clone URL from the origins of
sibling containers under the base and clones on demand. This is the universal
entry point: it works with no human clone present. When the URL can't be
inferred (no container, no clear sibling org), it errors asking for the clone
URL rather than guessing.cd into a human clone uses that clone's origin remote.Falls back to the current dir's origin when no intent resolves. On a cwd/intent
origin mismatch it prints a non-fatal stale-cwd note to stderr — the worktree
still lands in the intended repo, making a pin-trapped session recoverable with
one cd. It then bootstraps a bare container at ~/wt/<repo>/ if absent and
creates (or reuses) a worktree at ~/wt/<repo>/<name>. Base dir is
$CLAUDE_WORKTREE_BASE or ~/wt.
Cleans up a bare-container worktree on removal.
Non-blocking warning on Read/Grep/Glob when reading a human clone instead of
a fresh tree. Two cases:
~/wt worktree container for the repo already exists — a worktree is
available, but the clone is being read anyway.~/wt workflow is in use here (the base holds
other bare containers) — the first research read of a repo, before any
worktree. Deduped once per repo per session (cache in /tmp) so a multi-file
exploration warns once, not per read.The clone may sit on a stale branch or be behind origin, so files look missing or
wrong. The hook never denies — it only ever approves, optionally with a
systemMessage. Container-path derivation is shared with worktree_create.py, so
the "does a worktree exist?" check lines up exactly with where EnterWorktree
would have placed it. No org/host/personal path is baked in — the workflow-in-use
gate is inferred from the base.
Silent (no warning) when: the target has no resolvable path, is not in a git repo,
is already under the ~/wt base, has no origin remote, or (case 2) the ~/wt
workflow is not in use here.
Two independent checks, both fail-open:
EnterWorktree(path: …) is denied only when the cwd is not inside a git
repository. The path: form is handled by the builtin (it does not route
through WorktreeCreate) and requires a git-repo cwd, so after ExitWorktree
— when the harness resets the cwd to a non-git fallback dir — it fails with an
opaque "the current directory is not in a git repository". This hook turns
that dead end into an actionable redirect: re-enter with
EnterWorktree(name: <branch>), which routes through worktree_create.py and
reuses the existing worktree from any cwd. A path: switch from inside a git
repo is left untouched.EnterWorktree(name: …) is denied outright when the repo it would resolve to
(via the same cd-intent logic worktree_create.py uses) matches a
worktree_guard_allowlist entry — a repo meant to never be worktree'd at all
(e.g. a direct-commit thoughts/docs repo with no branches or PRs). The model
is told to edit that repo's shared clone directly instead.~/.config/claude-hooks/config.json:
{
"read_clone_warn": false,
"worktree_guard_allowlist": ["~/code/docs-repo"]
}
read_clone_warn — set to false to disable the read-clone warning. Defaults
to enabled when the key is absent.worktree_guard_allowlist — clone paths (shared with file-protection's
worktree_check.py) that are exempt from the ~/wt worktree workflow.
enter_worktree_guard.py denies EnterWorktree(name:) for any of these repos
so a worktree is never created for them in the first place.CLAUDE_WORKTREE_BASE (env) — overrides the ~/wt base dir for containers;
the warning hook uses the same base when checking for an existing worktree.Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub steeef/claude-hooks --plugin git-worktree-hooksPlugins from other owners that cover similar ground