1# Local Review
2
3You are tasked with setting up a local review environment for a colleague's branch. This involves creating a worktree, setting up dependencies, and launching a new Claude Code session.
4
5## Process
6
7When invoked with a parameter like `gh_username:branchName`:
8
91. **Parse the input**:
10 - Extract GitHub username and branch name from the format `username:branchname`
11 - If no parameter provided, ask for it in the format: `gh_username:branchName`
12
132. **Extract ticket information**:
14 - Look for ticket numbers in the branch name (e.g., `eng-1696`, `ENG-1696`)
15 - Use this to create a short worktree directory name
16 - If no ticket found, use a sanitized version of the branch name
17
183. **Set up the remote and worktree**:
19 - Check if the remote already exists using `git remote -v`
20 - If not, add it: `git remote add USERNAME git@github.com:USERNAME/humanlayer`
21 - Fetch from the remote: `git fetch USERNAME`
22 - Create worktree: `git worktree add -b BRANCHNAME ~/wt/humanlayer/SHORT_NAME USERNAME/BRANCHNAME`
23
244. **Configure the worktree**:
25 - Copy Claude settings: `cp .claude/settings.local.json WORKTREE/.claude/`
26 - Run setup: `make -C WORKTREE setup`
27 - Initialize thoughts: `cd WORKTREE && npx humanlayer thoughts init --directory humanlayer`
28
29## Error Handling
30
31- If worktree already exists, inform the user they need to remove it first
32- If remote fetch fails, check if the username/repo exists
33- If setup fails, provide the error but continue with the launch
34
35## Example Usage
36
37```
38/local_review samdickson22:sam/eng-1696-hotkey-for-yolo-mode
39```
40
41This will:
42- Add 'samdickson22' as a remote
43- Create worktree at `~/wt/humanlayer/eng-1696`
44- Set up the environment