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.
By smacfiggenv1.0.1MITIn 1 marketplace
Place agent worktrees outside <repo>/.claude/worktrees, where the CLI's compiled-in sandbox deny prefix blocks writes
Run automatically on Claude Code events. Claude doesn't decide.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
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.
Puts agent worktrees outside the repo, where the sandbox can actually write to them.
Part of annex. Claude Code only.
Claude Code creates agent worktrees in <repo>/.claude/worktrees/. Its Bash sandbox refuses to
write there.
The sandbox makes /home, /root, /tmp, /var, /opt, /run and /mnt writable, then
subtracts a denyWrite list containing ${originalCwd}/.claude. So /home is broadly writable,
and the one thing carving a hole out of it for agent worktrees is that deny prefix.
You cannot configure your way out of it. The deny prefix is a compiled-in constant, not a
setting, and Edit(...) / Write(...) allow rules do not override it — sandbox.filesystem.allowWrite
is merged with those rules rather than replacing the deny.
A WorktreeCreate hook replaces the CLI's git worktree logic outright, which moves the
worktree out of the deny prefix entirely. That is what this plugin is.
First match wins:
<repo>/.worktreeroot — this repository's worktree directory, used verbatim (no repo
slug appended). Must be an absolute path. ~ and $HOME are expanded, but the file is never
eval'd.$CLAUDE_WORKTREE_ROOT — a shared root for all repositories; the repo slug is
appended.~/worktrees/<repo-slug>/ — the default.So the shared root answers "where do my worktrees live," and .worktreeroot answers "where does
this repo's worktrees live."
The slug is derived from the main checkout, so a single setting namespaces every repository with no per-repo configuration.
Configuring a WorktreeCreate hook replaces the built-in logic entirely, so four behaviours
become the script's job:
worktree.baseRef resolutionworktree- prefixed branch naming.worktreeinclude copyingCleanup is deliberately not hooked. With no WorktreeRemove hook, the CLI falls back to
git worktree remove, which handles an out-of-tree worktree correctly on its own.
If git or jq is missing, the hook exits non-zero and worktree creation is cancelled with a
diagnostic.
That is the honest outcome. The hook's stdout is the worktree path, so there is no such thing
as partial success. Degrading would hand control back to the CLI's built-in logic, which would
silently recreate worktrees in <repo>/.claude/worktrees/ — the exact placement this plugin
exists to avoid. A loud failure beats a silent regression.
(handoff-state deliberately does the opposite, and degrades. Its hooks fire while the user is
losing context and is least able to react to a broken hook.)
The published hooks reference does not document the WorktreeCreate payload. Measured against
the binary:
name. There is no worktree_path, base_ref or
new_branch — which is why the hook has to own the four behaviours above.Does not port. Codex exposes no worktree lifecycle event — its hook events are PreToolUse,
PermissionRequest, PostToolUse, PreCompact, PostCompact, SessionStart, SessionEnd,
SubagentStart and SubagentStop — so there is nothing to intercept. Installing it under Codex
is harmless but does nothing.
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 smacfiggen/agent-annex --plugin worktree-placementPlugins from other owners that cover similar ground