/clear resets working directory when inside a worktree
Resolved 💬 2 comments Opened Apr 2, 2026 by sambaek-unlearn Closed May 11, 2026
Bug Description
Running /clear while inside a git worktree (created via EnterWorktree) resets the working directory back to the project root instead of preserving the current worktree path.
Expected Behavior
/clear should reset conversation context (message history, tasks, plans) but preserve the current working directory.
Actual Behavior
/clear resets both conversation context AND the working directory — moving from the worktree back to the main project root.
Steps to Reproduce
- Enter a worktree (e.g., via
EnterWorktreeor navigating to an existing one at.claude/worktrees/<id>) - Confirm you're in the worktree directory on the feature branch
- Run
/clear - Observe the status line now shows the main project root and
mainbranch instead of the worktree path and feature branch
Screenshots
Before /clear:
- Working directory:
~/dev/atelier/.claude/worktrees/agent-<hash> - Branch:
some-branch
After /clear:
- Working directory:
~/dev/<repo> - Branch:
main
Environment
- macOS (Darwin 25.3.0)
- Claude Code CLI
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗