ce-worktree
everyinc/compound-engineering-plugin
격리된 git worktrees를 설정합니다. 격리된 작업을 시작할 때, 또는 ce-work/ce-code-review에서 worktree 옵션을 제공할 때 사용하며, 기존 격리 상태를 먼저 감지합니다.
...모든 것을 확장하십시오ce-worktree 소개
Worktree 격리 기능은 사용자의 주요 체크아웃을 방해하지 않고 작업을 진행할 수 있도록 격리된 git worktree를 설정합니다. 대부분의 코딩 하니스는 세션 시작 시 이미 worktree를 생성하므로, 이 스킬의 주요 역할은 중복된 작업이 생성되기 전에 기존 격리 상태를 감지하는 것입니다. 이는 엄격한 순서로 동작합니다: 기존 격리 상태를 먼저 감지하고, 네이티브 worktree 도구를 우선으로 사용하며, 둘 다 적용되지 않을 경우에만 평범한 git으로 대체합니다.
감지는 해결된 절대 git 디렉토리와 해결된 절대 공통 git 디렉토리를 비교하여 수행됩니다. git은 현재 디렉토리에 따라 절대 경로와 상대 경로 형태를 혼용하므로, 이 스킬은 잘못된 "이미 격리됨" 결과를 초래할 수 있는 원시 문자열 비교 대신, 먼저 각 경로를 절대 경로로 해결합니다. 두 경로가 다를 경우, 슈퍼프로젝트 작업 트리 확인을 통해 링크된 worktree와 하위 모듈을 구분하며, 이미 격리된 worktree 내부에 있을 경우 해당 위치에서 작업을 수행합니다. EnterWorktree 도구, /worktree 명령어, 또는 --worktree 플래그와 같은 네이티브 worktree 원시 기능이 존재할 경우, 이를 사용하고 종료합니다. 이는 백그라운드에서 git worktree add를 실행하면 하니스가 볼 수 없거나 정리할 수 없는 가상의 상태를 생성하기 때문입니다.
git 대체 기능은 리포지토리 루트에서 실행되며, 작업 설명에서 파생된 의미 있는 브랜치 이름을 선택합니다. .worktrees/가 gitignore 대상인지 확인하며(디렉토리 전용 규칙이 적용되도록 끝에 슬래시를 포함하여 확인합니다), 기본 브랜치의 비치명적 fetch를 최선의 노력으로 수행한 후, .worktrees/<브랜치 이름> 아래에 worktree를 생성하고 해당 위치로 전환합니다. 만약 샌드박스 또는 권한 오류로 인해 생성이 실패할 경우, 이 스킬은 이를 차단적인 결정으로 간주하고 플랫폼의 질문 도구를 통해 사용자에게 문의하며, 주요 체크아웃에서 조용히 작업을 수행하지 않습니다. 또한 다른 worktree 작업(목록 조회, 제거, 전환)에 대한 문서를 작성하고, 이를 worktree 옵션으로 제공하는 ce-work 및 ce-code-review 흐름과 통합합니다.
FAQ
왜 스킬은 worktree를 생성하기 전에 기존 격리 상태를 확인합니까?
대부분의 코딩 하니스는 세션 시작 시 기본적으로 worktree를 생성하므로, 일반적인 경우 격리 상태가 이미 존재합니다. 기존 worktree 내부에서 다른 worktree를 생성하면 잘못된 트리에 진입하게 되며, 현재 worktree를 생성한 하니스에는 보이지 않습니다.
감지 과정에서 어떻게 잘못된 "이미 격리됨" 결과를 피합니까?
git 디렉토리와 공통 git 디렉토리 모두를 먼저 절대 경로로 해결한 후 비교합니다. 원시 문자열 비교를 수행하지 않습니다. git은 현재 디렉토리에 따라 절대 경로와 상대 경로 형태를 혼용하여 반환하므로, 그렇지 않을 경우 위양성(false positive) 결과가 발생할 수 있습니다.
평범한 git 대신 언제 네이티브 worktree 도구를 사용해야 합니까?
하니스가 EnterWorktree/WorktreeCreate 도구, /worktree 명령어, 또는 --worktree 플래그와 같은 네이티브 원시 기능을 제공할 경우, 스킬은 이를 사용하고 종료합니다. 네이티브 도구는 worktree를 배치하고 추적하며 정리하므로 하니스가 이를 관리할 수 있습니다. 백그라운드에서 git worktree add를 실행하면 하니스가 볼 수 없는 가상의 상태가 생성됩니다.
git worktree add가 권한 또는 샌드박스 오류로 실패할 경우 어떻게 됩니까?
이 실패는 현재 체크아웃에 접근하기 전에 차단적인 사용자 결정을 필요로 합니다. 스킬은 이를 보고하여 플랫폼의 질문 도구(예: Claude Code의 AskUserQuestion)를 통해 문의하며, 현재 체크아웃에서 작업하거나 문제를 해결하기 위해 중단하는 등의 옵션을 제공합니다. 명시적인 확인이 있을 경우에만 주요 체크아웃에서 계속 진행합니다.
스킬은 worktree 내용을 커밋되지 않도록 어떻게 유지합니까?
무언가를 생성하기 전에 git check-ignore를 실행하여 .worktrees/가 gitignore 대상인지 확인합니다. 끝에 슬래시를 포함하므로 디렉토리가 존재하기 전이라도 기존 디렉토리 전용 규칙이 적용됩니다. 필요한 경우 .gitignore에 .worktrees/ 라인을 추가합니다.
Ensure the current work happens in an isolated workspace, without disturbing the user's main checkout. Most coding harnesses now create a worktree by default at session start, so the common case is that isolation already exists.
Done when: the caller is working in an isolated tree — existing or newly created — and its path and branch have been reported, or a blocker has been reported instead.
Order of operations: detect existing isolation -> prefer a native worktree tool -> fall back to plain git. Never create a worktree the harness cannot see.
Two modes, set by the caller's need:
- New work (default). No ref named — create a fresh branch from a base (trunk). This is what
ce-workandce-code-reviewuse when the user picks the worktree option. - Isolate an existing ref. The caller names a PR head, branch, or commit — attach the worktree to that ref instead of creating a new branch. A branch can be checked out in only one worktree at a time. If the named ref is already checked out anywhere (most commonly as the primary checkout's current branch), do not create a second worktree — report that it is already checked out at
<path>and let the caller act (work there in place; or, only if a clean separate tree is essential, create a detached worktree at the same commit).
Step 0: Detect existing isolation
Compare the resolved absolute git dir against the resolved absolute common git dir. Git mixes absolute and relative forms depending on the current directory (from a subdirectory of a normal checkout, --git-dir comes back absolute while --git-common-dir may be relative), so a raw string compare yields a false "already isolated":
git rev-parse --absolute-git-dir # absolute git dir for this worktree(cd "$(git rev-parse --git-common-dir)" && pwd -P) # absolute shared (common) git dir
Equal -> normal checkout; continue to Step 1.
Different -> a linked worktree or a submodule. Distinguish with git rev-parse --show-superproject-working-tree:
- Non-empty -> submodule; treat it as a normal checkout and continue to Step 1.
- Empty -> already isolated. Report the worktree path (
git rev-parse --show-toplevel) and current branch, then work in place — a worktree-from-worktree lands in the wrong tree and is invisible to the harness that made the current one. In isolate-an-existing-ref mode, check that ref out here (unless it is already current) rather than nesting a worktree.
Step 1: Prefer the harness's native worktree tool
If the harness provides a native worktree primitive — for example an EnterWorktree / WorktreeCreate tool, a /worktree command, or a --worktree flag — use it and stop. Native tools place, track, and clean up the worktree so the harness can manage it. A behind-the-back git worktree add creates phantom state the harness cannot see, navigate to, or clean up.
Step 2: Git fallback
Only when there is no native tool and Step 0 found no existing isolation.
- Run from the repo root:
cd "$(git rev-parse --show-toplevel)". The paths below are repo-root-relative, but the skill runs from the user's current directory — without this,.worktrees/<branch>and the.gitignoreedit land in a subdirectory (e.g.src/.worktrees/...). - Choose a meaningful branch name from the work description (e.g.
feat/login,fix/email-validation) — never an opaque auto-generated one. Base: origin's default branch, elsemain. - Ensure
.worktrees/is gitignored before creating anything:git check-ignore -q .worktrees/— with the trailing slash, so an existing directory-only.worktrees/rule is honored even before the directory exists (without the slash the probe misses it and dirties a correctly-configured repo). Not ignored -> add a.worktrees/line to.gitignore. - Refresh the base with
git fetch origin <from-branch>. This is non-fatal — nooriginremote, a differently-named remote, or a local-only branch is not an abort; continue with the local ref. - Create the worktree, per mode:
- New work:
git worktree add -b <branch-name> .worktrees/<branch-name> origin/<from-branch>(use the local<from-branch>ref iforigin/<from-branch>does not exist). - Existing branch or tag:
git worktree add .worktrees/<slug> <target-ref>. - PR: check it out on a local branch —
git fetch origin pull/<n>/head:pr-<n>thengit worktree add .worktrees/pr-<n> pr-<n>. Never a detachedFETCH_HEAD: that orphans the fix loop's commits instead of updating the PR. (For push-tracking back to the PR, create it detached —git worktree add --detach .worktrees/pr-<n>— thencdin and rungh pr checkout <n>, which is fork-safe.) - If git reports the ref is already checked out elsewhere, apply the one-branch-one-worktree rule above — do not force a second worktree.
- New work:
cdinto it, then report the path and branch.
If git worktree add fails with a sandbox or permission error, the requested isolation does not exist. Do not proceed in the current checkout — the user chose isolation specifically to avoid it. Report the failure and ask, offering options such as "work in the current checkout" vs "stop and resolve the permission issue", using the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded), request_user_input in Codex, ask_question in Antigravity CLI (agy), ask_user in Pi (via the pi-ask-user extension). Only when no blocking tool exists in the harness or the call errors, present the numbered options in chat and wait for the reply. Never skip the confirmation, and do not retry alternative paths automatically.
모든 파일
0개 파일ce-worktree 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉토리에 추출하세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/EveryInc/compound-engineering-plugin/blob/main/skills/ce-worktree/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
복사





집
