Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
everyinc avatar

Ce Worktree

  • 2.3k installs
  • 23.9k repo stars
  • Updated August 5, 2026
  • everyinc/compound-engineering-plugin

ce-worktree is an agent skill that Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option;.

About

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 detect that first and do not create a redundant one Order of operations detect existing isolation prefer a native worktree tool fall back to plain git Never create a worktree the harness cannot see Before creating anything check whether the current directory is already a linked worktree Compare the resolved absolute git dir against the resolved absolute common git dir resolve each to an absolute path first and compare those not the raw git rev parse output 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 bash git rev parse absolute git dir absolute git dir for this worktree cd git rev

  • description: Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a wor
  • Ensure the current work happens in an isolated workspace, without disturbing the user's main checkout. Most coding harne
  • Order of operations: **detect existing isolation -> prefer a native worktree tool -> fall back to plain git.** Never cre
  • Follow ce-worktree SKILL.md steps and documented constraints.
  • Follow ce-worktree SKILL.md steps and documented constraints.

Ce Worktree by the numbers

  • 2,271 all-time installs (skills.sh)
  • +68 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #464 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

ce-worktree capabilities & compatibility

Capabilities
description: set up isolated git worktrees. use · ensure the current work happens in an isolated w · order of operations: **detect existing isolation · follow ce worktree skill.md steps and documented
Use cases
orchestration
From the docs

What ce-worktree says it does

description: Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option; detect existing isolation first.
SKILL.md
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 th
SKILL.md
Order of operations: **detect existing isolation -> prefer a native worktree tool -> fall back to plain git.** Never create a worktree the harness cannot see.
SKILL.md
npx skills add https://github.com/everyinc/compound-engineering-plugin --skill ce-worktree

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.3k
repo stars23.9k
Security audit2 / 3 scanners passed
Last updatedAugust 5, 2026
Repositoryeveryinc/compound-engineering-plugin

When should an agent use ce-worktree and what problem does it solve?

Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option; detect existing isolation first.

Who is it for?

Developers invoking ce-worktree as documented in the skill source.

Skip if: Skip when requirements fall outside ce-worktree documented scope.

When should I use this skill?

Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option; detect existing isolation first.

What you get

Outputs aligned with the ce-worktree SKILL.md workflow and stated deliverables.

  • Isolated worktree path
  • Copied environment files

By the numbers

  • Stores worktrees under `.worktrees/<branch>`
  • Copies `.env`, `.env.local`, `.env.test` while skipping `.env.example`

Files

SKILL.mdMarkdownGitHub ↗

Worktree Isolation

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 — detect that first and do not create a redundant one.

Order of operations: detect existing isolation -> prefer a native worktree tool -> fall back to plain git. Never create a worktree the harness cannot see.

Step 0: Detect existing isolation

Before creating anything, check whether the current directory is already a linked worktree. Compare the resolved absolute git dir against the resolved absolute common git dir — resolve each to an absolute path first and compare those, not the raw git rev-parse output. 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

If the two absolute paths are equal, this is a normal checkout — continue to Step 1.

If they differ, you are in a linked worktree or a submodule. Distinguish them:

git rev-parse --show-superproject-working-tree
  • Non-empty output -> you are in a submodule; treat it as a normal checkout and continue to Step 1.
  • Empty output -> you are already in an isolated worktree. Report the worktree path (git rev-parse --show-toplevel) and current branch, and work in place. Do not create another worktree — a worktree-from-worktree lands in the wrong tree and is invisible to the harness that made the current one.

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.

1. Run from the repo root. The .worktrees/ and .gitignore paths below are repo-root-relative, but the skill runs from the user's current directory, which may be a subdirectory — so move to the root first: cd "$(git rev-parse --show-toplevel)". Without this, .worktrees/<branch> and the .gitignore edit would land in the subdirectory (e.g. src/.worktrees/..., src/.gitignore) instead of at the repo root. 2. Choose a meaningful branch name from the work description (e.g. feat/login, fix/email-validation) — avoid opaque auto-generated names. Pick a base branch (default: origin's default branch, else main). 3. Ensure `.worktrees/` is gitignored before creating anything, so worktree contents are never committed: check git check-ignore -q .worktrees/with the trailing slash, so an existing directory-only .worktrees/ rule is honored even before the directory exists (git check-ignore .worktrees without the slash would miss it and dirty a correctly-configured repo). If it is not ignored, add a .worktrees/ line to .gitignore. 4. Best-effort refresh the base branch without disturbing the current checkout: git fetch origin <from-branch>. This is non-fatal — if it errors (no origin remote, a differently-named remote, or a local-only branch), do not abort; continue to the next step and use the local ref. 5. Create the worktree from the remote base when available, else the local ref: git worktree add -b <branch-name> .worktrees/<branch-name> origin/<from-branch>. If origin/<from-branch> does not exist, use the local <from-branch> ref instead. 6. Switch into it: cd .worktrees/<branch-name>.

If git worktree add fails with a sandbox or permission error, the requested isolation could not be created. This needs a blocking user decision before touching the current checkout — do not silently continue there (the user chose isolation specifically to avoid it, especially when ce-work / ce-code-review routed here for the worktree option). Report the failure and ask via 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) — offering options such as "work in the current checkout" vs "stop and resolve the permission issue". If 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. Only work in the current checkout on explicit confirmation, and do not retry alternative paths automatically.

Other worktree operations

Use git directly — no wrapper is needed:

git worktree list                          # list worktrees
git worktree remove .worktrees/<branch>    # remove a worktree
cd .worktrees/<branch>                     # switch to a worktree
cd "$(git rev-parse --show-toplevel)"      # return to the current checkout root

When to create a worktree

Create one (Step 1/2) only when you are not already isolated and you need a separate workspace:

  • Reviewing a PR while keeping the current checkout free for other work
  • Running multiple features in parallel without branch-switching overhead

Do not create a worktree for single-task work that can happen on a branch in the current checkout — and never when Step 0 shows you are already in one.

Integration

ce-work and ce-code-review offer this skill as an option. When the user selects "worktree" in those flows, run Step 0 first: if the work is already isolated, proceed in place; otherwise create one (native tool preferred) with a meaningful branch name derived from the work description.

Troubleshooting

"Worktree already exists": the path is in use. Switch to it (cd .worktrees/<branch>) or remove it (git worktree remove .worktrees/<branch>) before recreating.

"Cannot remove worktree: it is the current worktree": cd out of the worktree first, then git worktree remove.

Related skills

FAQ

What is ce-worktree?

Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option; detect existing isolation first.

When should I use ce-worktree?

Set up isolated git worktrees. Use when starting isolated work, or when ce-work/ce-code-review offers a worktree option; detect existing isolation first.

Is ce-worktree safe to install?

Review the Security Audits panel on this page before production use.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.