# Context Worktree

> Evaluates context similarity between new and existing work, automatically creating git worktree on a new branch when tasks differ. Activates on task start, new feature implementation, or switching to different issues.

- Skill: `jiunbae/context-worktree` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add jiunbae/context-worktree`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jiunbae/context-worktree/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: jiunbae (https://skillmd.com/u/jiunbae)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/jiunbae/context-worktree

---


# Context Worktree

Auto-separate unrelated work into git worktrees.

## When to Activate

- Starting new feature while another is in progress
- Switching to different issue/task
- Requested work differs from current branch context

## Workflow

### Step 1: Evaluate Similarity

Compare new request against current branch:
- File paths involved
- Feature/module overlap
- Related issues/PRs

**Similar**: Continue on current branch
**Different**: Create new worktree

### Step 2: Create Worktree (if different)

```bash
# Create worktree with new branch
git worktree add ../project-feature feature/new-feature

# Switch to worktree
cd ../project-feature
```

### Step 3: Work in Isolation

- Changes in worktree don't affect main workspace
- Can switch back anytime: `cd ../project-main`

## Commands

```bash
# List worktrees
git worktree list

# Add worktree
git worktree add <path> <branch>

# Remove worktree
git worktree remove <path>

# Prune stale worktrees
git worktree prune
```

## Decision Matrix

| Current Work | New Request | Action |
|--------------|-------------|--------|
| Feature A | Bug in Feature A | Continue |
| Feature A | Feature B | New worktree |
| Feature A | Hotfix | New worktree |
| None | Any | Continue |

## Best Practices

**DO:**
- Use descriptive worktree paths: `../project-{feature}`
- Clean up finished worktrees

**DON'T:**
- Create worktree for tiny tasks
- Forget to push before removing worktree

