You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk hook claude: git refused in sessions isolated in a worktree outside .claude/worktrees/ #4634
Since #3879, rtk hook claude leaves git unrewritten when the payload's cwd is under <repo>/.claude/worktrees/<name>. Claude Code can also isolate a session somewhere else:
EnterWorktree(path: …) on a worktree made with git worktree add (Claude Code's tool description suggests exactly this)
a WorktreeCreate hook that provisions the worktree at a custom location
In both cases, every git … is still rewritten to rtk git …, and Claude Code's isolation guard refuses it with the #3864 text.
git init repo && cd repo && git commit --allow-empty -m init
git worktree add -b feat ../repo-worktrees/feat
claude -p 'EnterWorktree path=<abs>/repo-worktrees/feat, then run: git status' --settings <rtk hook claude>
# → "This session is isolated in the worktree …, but this command runs rtk with a git command among its operands … Refusing to run it"
Why cwd cannot decide it: the PreToolUse payload is identical, apart from ids, for an isolated session and a plain session in the same worktree. A plain session never meets the guard, and rtk git works there. Detecting "any linked worktree" (.git is a file, #4490) also catches those plain sessions and every submodule checkout, so git output would go unfiltered in all of them.
Options:
Claude Code exposes isolation in the hook payload. Then rtk can key on that instead of a path.
A config key listing the worktree roots to treat like .claude/worktrees/.
Workaround today: [hooks] exclude_commands = ['^git\b'] (it applies everywhere; see #3838 for git -C).
rtk's isolation guard for Claude Code only recognizes .claude/worktrees/, so EnterWorktree or WorktreeCreate-provisioned worktrees elsewhere have all git commands rewritten and then refused by the guard, blocking git entirely in those sessions.
📁 Relevant files
src/hooks/claude.rs
src/git/isolation.rs
Suggested Actions
Ask upstream whether Claude Code can expose isolation status directly in the PreToolUse payload instead of relying on c…
Consider a config key for additional worktree roots to treat like .claude/worktrees/, as proposed in the issue
Activity
rtk-wshm-sync-bot commentedon Oct 17, 2026
🔍 Automated Triage
bughighSummary
rtk's isolation guard for Claude Code only recognizes .claude/worktrees/, so EnterWorktree or WorktreeCreate-provisioned worktrees elsewhere have all git commands rewritten and then refused by the guard, blocking git entirely in those sessions.
📁 Relevant files
src/hooks/claude.rssrc/git/isolation.rsSuggested Actions
rtk …command with agit-named operand is refused #4591 and fix(hooks): detect linked worktrees by .git shape, not path convention #4490 — same isolation-guard/worktree-detection tension, may need a combined designexclude_commands = ['^git\b']) in the issue/docs until a proper fix landsTriaged automatically by wshm · This is an automated analysis, not a human review.