Hey, thanks for the feedback. This is a known issue. The agent can lose its binding to the current worktree and switch to another one for no clear reason. You’re not the first user to report this.
A few similar threads for context:
- Lost edits - IDE agent worktree and canonical path diverge: Lost edits / work - IDE agent worktree and canonical (project)path diverge
- Agent modifies git internal files outside workspace, corrupting worktree references: Agent modifies git internal files outside workspace, corrupting worktree references
- Cursor glass - branch + worktree support: Cursor glass - branch + worktree support
Worktree support is being actively reworked. The team knows the current implementation isn’t reliable, especially around keeping the agent tied to a specific worktree. What you’re describing, explicit and persistent binding, is part of what’s planned. There’s no timeline yet, but your report helps us prioritize it.
For now, the workaround is to keep an eye on which worktree the agent is using. If it switches, tell it in your prompt to go back to the right worktree and branch.
Let me know if you have any questions.