Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .agents/skills/new-session/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ Set up a worktree with everything needed to run the dev server: env files, `node
```
If the path is inside `.claude/worktrees/`, you're in a worktree (created externally, e.g. by Claude Code desktop). Skip to step 3.

If you're in the main repo, use the `EnterWorktree` tool to create one. Let it generate a name, or use one the user provides.
If you're in the main repo, **first inspect existing worktrees** before creating a new one:
```bash
git worktree list
```
If a clean worktree with no branch-only commits exists and could serve as the target, prefer reusing it (fast-forward its branch to the target and update `launch.json`) over adding new workspace sprawl.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enter the reused worktree before setup

When this reuse path is taken, the agent has only run git worktree list from the main repo, so its CWD is still the main checkout. Step 3 then runs the setup script from the wrong directory; the script explicitly expects a non-main worktree and exits when WORKTREE equals MAIN_REPO. In any session with a suitable existing worktree, this makes the new-session flow fail instead of reusing it, so the instructions should include an explicit cd <worktree> or equivalent before continuing.

Useful? React with 👍 / 👎.


Only if no suitable worktree exists: use the `EnterWorktree` tool to create one. Let it generate a name, or use one the user provides.

2. **Identify the worktree directory** (it should now be your CWD).

Expand Down