Codex open worktree
Skill SepantaJoshani/agents-skills/skills/codex-open-worktree
Open-source agent skills for AI coding assistants
npx -y skills add SepantaJoshani/agents-skills --skill codex-open-worktreeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
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.
SKILL.md
3.7 KB, as published. Nobody here has run it
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
-
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.
-
If the user supplied a branch, worktree name, or path, run:
python3 ./scripts/open_worktree.py --repo <repo> <selector>Resolve
./scripts/open_worktree.pyrelative to thisSKILL.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.
-
If the user supplied no selector, run:
python3 ./scripts/open_worktree.py --repo <repo> --listPresent 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. -
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.
-
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 --porcelainfor 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, orgit worktree prune. - Never invoke
codex app, an installer, a package manager, or a download. Use the bundled script, which calls macOSopenwith 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.