jiunbae avatar

context-worktree

새 작업 요청 시 기존 작업과의 맥락 유사성을 판단하고, 비유사한 경우 자동으로 git worktree를 생성하여 새 브랜치에서 작업합니다. 작업 시작, 새 기능 구현, 다른 이슈

提供方 jiunbae|开源

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)

# 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

# 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 WorkNew RequestAction
Feature ABug in Feature AContinue
Feature AFeature BNew worktree
Feature AHotfixNew worktree
NoneAnyContinue

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
context-worktree - 适用于 Claude Code 与 Cursor 的 AI 智能体 Skill | Agent Skills