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
Adds a MANDATORY section warning against removing worktrees that other
sessions may be using. Removing a worktree kills any Claude session
using it as its working directory, with no recovery possible.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,19 @@
12
12
13
13
This is a hard rule with NO exceptions, even for "small" changes.
14
14
15
+
## MANDATORY: Never Remove Worktrees You Didn't Create
16
+
17
+
**NEVER run `git worktree remove` or `git worktree prune` without confirming no other sessions are using them.**
18
+
19
+
Removing a worktree that another Claude session is using as its working directory **kills that session permanently** — every command fails with "Working directory no longer exists" and the session cannot recover. Uncommitted work is lost.
20
+
21
+
Before removing ANY worktree:
22
+
1.**Ask the user** if other agents/sessions are running
23
+
2. Only remove worktrees **you created in this session**
24
+
3. Never batch-remove worktrees — each one could be another session's home
25
+
26
+
This rule also applies to `git clean`, `rm -rf` on worktree paths, and any operation that deletes directories under `.claude/worktrees/`.
27
+
15
28
### PR Titles MUST Use Conventional Commit Format
16
29
17
30
PR titles become the squash merge commit message on main. `python-semantic-release` parses these to decide version bumps. **If the PR title doesn't follow the format, no release is created.**
0 commit comments