Skip to content
Skills Library
Programming · Tool integration

worktree-cmux-split

/worktree-cmux-split

Use when the user wants to open the git worktree they're working on as a SPLIT PANE in the CURRENT cmux workspace (e.g. "이 worktree cmux 창 분할로 띄워줘", "split the current cmux workspace into the worktree"). Asks split direction (side-by-side vs stacked) via AskUserQuestion. For a separate new workspace instead, use worktree-cmux-workspace.

Licence
MIT
Last repository change
02.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when the user wants to open the git worktree they're working on as a SPLIT PANE in the CURRENT cmux workspace (e.g. "이 worktree cmux 창 분할로 띄워줘", "split the current cmux workspace into the worktree"). Asks split direction (side-by-side vs stacked) via AskUserQuestion. For a separate new workspace instead, use worktree-cmux-workspace.

Triggers from the description

이 worktree cmux 창 분할로 띄워줘split the current cmux workspace into the worktree
Original author description

Use when the user wants to open the git worktree they're working on as a SPLIT PANE in the CURRENT cmux workspace (e.g. "이 worktree cmux 창 분할로 띄워줘", "split the current cmux workspace into the worktree"). Asks split direction (side-by-side vs stacked) via AskUserQuestion. For a separate new workspace instead, use worktree-cmux-workspace.

How it works

  1. Resolve the worktree path
  2. Capture the target pane FIRST (before any prompt)
  3. Ask the split direction (required)
  4. Open the split
  5. Related
Original SKILL.md headings · 61 lines, 581 words
SKILL.md preview
---
name: worktree-cmux-split
description: Use when the user wants to open the git worktree they're working on as a SPLIT PANE in the CURRENT cmux workspace (e.g. "이 worktree cmux 창 분할로 띄워줘", "split the current cmux workspace into the worktree"). Asks split direction (side-by-side vs stacked) via AskUserQuestion. For a separate new workspace instead, use worktree-cmux-workspace.
---

# worktree-cmux-split

Open the in-progress git worktree as a split pane inside the current cmux workspace (next to the pane Claude Code is running in).

## Resolve the worktree path

In priority order:

1. Explicit argument — a path, or a branch name (resolve via `git worktree list --porcelain`).
2. The task-specific worktree you've been editing this session.
3. If there is no task-specific worktree, open the **primary worktree** (main checkout) of the project the current task targets — the first entry of `git -C <project> worktree list`.

Do NOT fall back to `git -C "$PWD" rev-parse --show-toplevel`: `$PWD` may be an unrelated repo. Resolve the target from `git worktree list` instead — the primary worktree is the project root (main checkout), and task-specific worktrees are the linked worktrees it lists.

## Capture the target pane FIRST (before any prompt)

The target is the pane the user is **looking at when they invoke**. Capture it as the very first action — before asking the direction — so the answer prompt can't shift focus away from it:

```bash
CMUX=/Applications/cmux.app/Contents/Resources/bin/cmux
read -r FWIN FW FS < <("$CMUX" identify | python3 -c 'import json,sys;d=json.load(sys.stdin)["focused"];print(d["window_ref"],d["workspace_ref"],d["surface_ref"])')
echo "target: window=$FWIN workspace=$FW surface=$FS  ($("$CMUX" tree | grep "$FS " | grep -oE '\"[^\"]+\"' | head -1))"
```

Capture the **window ref too** (`$FWIN`): every later cmux call must carry full `--window`/`--workspace` context (see "Open the split").

Use `identify.focused` (real-time focus = what the user is looking at). Do **NOT** use `$CMUX_SURFACE_ID` / `$CMUX_WORKSPACE_ID` / `identify.caller`: under Remote Control + multiple sessions the Bash env can point to a *different* session's pane — that mis-targeting is what previously sent a `cd` into another running agent. Capturing `FW`/`FS` up front pins the target, so later focus drift (e.g. while the user answers the direction prompt) doesn't matter.

Echo the captured workspace/surface (with its title) so the user can sanity-check the target.

## Ask the split direction (required)

Use **AskUserQuestion** with these two options (concrete results, so 가로/세로 wording is never ambiguous):

- **좌우 나란히 (오른쪽에 새 pane)** → cmux direction `right`
- **위아래 (아래에 새 pane)** → cmux direction `down`

## Open the split

`new-split` has no `--cwd`, so split the **captured** focused pane (`$FW`/`$FS` from above), then `cd` the **new** pane into the worktree. Every call carries full `--window`/`--workspace` context:

```bash
ref=$("$CMUX" new-split <right|down> --window "$FWIN" --workspace "$FW" --surface "$FS" --focus true | grep -oE 'surface:[0-9]+' | tail -1)
if [ -n "$ref" ]; then
  "$CMUX" send --window "$FWIN" --workspace "$FW" --surface "$ref" "cd '<worktree-path>' && clear\n"   # \n = Enter; goes to the NEW blank split
else
  echo "ABORT: new-split returned no surface ref — not sending cd."
fi
```

**Full context is required**, not optional: the Bash caller env (`$CMUX_*`) belongs to a *different, stale* session, so `cmux send`/`read-screen` with a bare `--surface` short ref — or even a UUID — resolves in the wrong scope and fails with `invalid_params: Surface is not a terminal`. Always pass `--window "$FWIN" --workspace "$FW"` alongside `--surface`.

**Never** fall back to `cmux send` without the captured target (or to `$CMUX_SURFACE_ID`): if the split failed, that would inject the `cd` into the focused pane, which may be a running agent. The `cd` only ever goes to the freshly created split; abort if no new ref.

Echo the targeted workspace/surface, the new surface ref, the worktree path, and the direction. If the worktree path doesn't exist, stop and say so.

## Related

- **worktree-cmux-workspace** — same worktree, but as its own new workspace.

Versions

The database has no other skills named worktree-cmux-split.

Database snapshot: 13.11.2026 · package version 45e8ca4300c5 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100worktree-cmux-workspace
    Use when the user wants to open the git worktree they're working on in a NEW cmux workspace (e.g. "이 worktree cmux 새 workspace로 띄워줘", "open the worktree in a new cmux workspace"). For a split pane in the current workspace instead, use worktree-cmux-split.
  • 80cmux Workspace Orchestration
    This skill should be used when the user asks to "set up a dev environment", "create a workspace", "open a browser pane", "split terminal", "spin up frontend and backend", "use cmux", "manage cmux panes", "run commands in cmux", or mentions cmux workspaces, panes, surfaces, or…
  • 100thread
    Starts a side task as its own Claude Code session ("thread") in cmux, with its own git worktree and its own workspace in the project's sidebar group, and orchestrates the reports that threads send back. Use it when the user wants a task done in parallel, on the side or…
  • 100cmux-workspace
    Work inside the current cmux workspace and terminal. Use for cmux workspace, current workspace, caller surface, panes, surfaces, socket targeting, and non-interfering cmux automation.
  • 100cmux-workspace
    Work inside the current cmux workspace and terminal. Use for cmux workspace, current workspace, caller surface, panes, surfaces, socket targeting, and non-interfering cmux automation.
  • 100cmux-workspace
    Work inside the current cmux workspace and terminal. Use for cmux workspace, current workspace, caller terminal, panes, tabs, socket targeting, and non-interfering cmux automation.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.