agentleFS
SepantaJoshaniSepantaJoshani/agents-skills/skills/codex-open-worktree/SKILL.md

codex-open-worktree

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

Open any existing Git-registered worktree as a workspace in the macOS Codex desktop app, including installations branded as ChatGPT. Use when the user asks to open, switch to, move to, or continue in an existing worktree from Codex; invokes `$codex-open-worktree`; supplies a branch name, worktree directory, or worktree path; or wants Codex to discover a repository's worktrees and ask which one to open. Works with worktrees created by Git, Claude, Codex, Supacode, or other tools at any path. Opens a workspace without creating, removing, checking out, or modifying a worktree or branch.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the user supplied a branch, worktree name, or path, run:

    line 13
  2. Distinctive:

    If the user supplied no selector, run:

    line 23
  3. Distinctive:

    If selection is ambiguous or missing, show the script's candidates and ask the user for one branch or path.

    line 31
  4. Distinctive:

    After a successful script result, report the opened branch and absolute worktree path.

    line 32
  5. Distinctive:

    Never run Git commands that mutate worktrees, branches, the index, or files.

    line 37
  6. Very specific:

    Never invoke codex app, an installer, a package manager, or a download.

    line 38
  7. Distinctive:

    Do not claim the current conversation switched.

    line 39
  8. Distinctive:

    Treat an explicit skill invocation with a unique selector as authorization to open that workspace.

    line 40
  9. Distinctive:

    Treat locked worktrees like any other registered worktree.

    line 41
  10. Very specific:

    Use --dry-run to verify resolution without opening the app:

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Codex Open Worktree

Open a registered Git worktree in the macOS desktop app without changing Git state. Treat "switch" as "open the selected worktree in another Codex workspace" because the current task cannot be rebound to a different workspace.

Workflow

  1. Resolve the repository from the current directory unless the user supplied a repository or worktree path. If neither path is inside a Git repository, ask for one; do not search the filesystem broadly.
  2. If the user supplied a branch, worktree name, or path, run:

    python3 ./scripts/open_worktree.py --repo <repo> <selector>

    Resolve ./scripts/open_worktree.py relative to this SKILL.md.

    Open immediately when the selector has one exact or unique match. An explicit invocation with a unique selector authorizes this external app action; do not ask for redundant confirmation.

  3. If the user supplied no selector, run:

    python3 ./scripts/open_worktree.py --repo <repo> --list

    Present the registered worktrees and ask which one to open. Put a clearly implied candidate first and label it (Recommended); if intent does not distinguish a candidate, ask neutrally instead of inventing a preference. Never choose silently, even when only one alternative exists.

  4. If selection is ambiguous or missing, show the script's candidates and ask the user for one branch or path. Rerun with the exact selection after they answer.
  5. After a successful script result, report the opened branch and absolute worktree path. State that the app was asked to open that workspace and the current task remains attached to its original workspace. Stop; do not begin work in either workspace.

Safety Boundaries

  • Open only an existing directory returned by git worktree list --porcelain for the selected repository.
  • Never run Git commands that mutate worktrees, branches, the index, or files. In particular, never run git switch, git checkout, git worktree add, git worktree remove, or git worktree prune.
  • Never invoke codex app, an installer, a package manager, or a download. Use the bundled script, which calls macOS open with the installed app's stable bundle identifier only.
  • Do not claim the current conversation switched. The app opens or focuses a workspace for the selected folder; this task's workspace and branch indicator do not change.
  • Treat an explicit skill invocation with a unique selector as authorization to open that workspace. With no selector, list and ask before opening anything.
  • Treat locked worktrees like any other registered worktree. A Git worktree lock affects pruning, not whether its directory can be opened.

Script Interface

Use --dry-run to verify resolution without opening the app:

python3 ./scripts/open_worktree.py --repo <repo> --dry-run <selector>

The selector accepts an exact branch name, absolute or repository-relative path, directory name, flattened branch name such as feat-example, or a unique case-insensitive substring. The script exits without opening anything when the selector is absent, ambiguous, unmatched, or resolves to a missing directory.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.