Wt Switch Create logo

Wt Switch Create

CommunityPopular
max-sixty
wt-switch-create

Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.

Overview

Publishermax-sixty
Repositoryworktrunk
Skill namewt-switch-create
Stars
8.6K
Forks
304
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by max-sixty on GitHub. Read the source before you install it.

Installation

Install the Wt Switch Create AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/max-sixty/worktrunk/tree/main/plugins/worktrunk/skills/wt-switch-create
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/max-sixty/worktrunk.git /tmp/worktrunk
mkdir -p .claude/skills
cp -r /tmp/worktrunk/plugins/worktrunk/skills/wt-switch-create .claude/skills/wt-switch-create
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Wt Switch Create in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Wt Switch Create on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Wt Switch Create is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Arguments: $ARGUMENTS. Grammar: [<branch>] [<repo>] [-- <task>].

  • branch — optional; the branch name for the new worktree. When omitted, pick one (step 1 below).
  • repo — optional path or name; create the worktree in this repo instead of the session's current one.
  • task — optional; what to do inside the new worktree. No task means enter the worktree and wait.

Tokens before the -- are the branch and/or repo. A path-shaped token (starting with /, ~, ./, or ../) is the repo. A bare name can be either, so make an informed guess. It is the branch when the current repo already has a branch by that name, as it is for wt switch itself. Otherwise it is the repo when a git repository by that name exists where the user keeps repos (beside the current repo, or in a workspace directory like ~/workspace), and the branch when none does (docs is a branch, not the current repo's docs/ directory). A name read as the repo carries its absolute path forward: that path, not the bare token, is the <repo> in step 3. Two tokens that both read as branches don't fit the grammar — ask. Without a --, judge where the task starts: leading tokens that read as a branch name (fix-auth) or a repo are consumed as such, and the rest is the task; otherwise the whole input is the task (fix the parser bug has no branch-shaped lead — all task).

/wt-switch-create my-feature -- fix the parser bug
/wt-switch-create -- fix the parser bug
/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug
/wt-switch-create my-feature

What to do

Creating the worktree comes first on every invocation, before any other work. The invocation is itself the explicit request to create it; a research or read-only task gets one all the same.

  1. Pick the branch name if none was given: short, from the task and consistent with existing worktree names, or, mid-session, from the work being moved; with nothing to derive from, ask.

  2. With no repo argument, create and enter in one call: EnterWorktree({name: "<branch>"}). Worktrunk's WorktreeCreate hook runs wt switch --create, so the result is an ordinary wt worktree in the default layout, and the user sees no confirmation prompt. On success, do the task (or, with no task text, confirm it's ready and wait).

    Mid-session, carry uncommitted work across: git stash push -u before the EnterWorktree call, then git stash pop after — the call re-roots the session into the new worktree, and the stash is shared across worktrees.

  3. Otherwise create it with wt and enter by path. Two cases reach here: a repo argument, which step 2 can't target, and a failed step 2, whose error says which — ✗ Branch <branch> already exists, or Already in a worktree session. Create with a Bash call (omit -C <repo> for this repo):

    wt -C <repo> switch --create <branch> --no-cd --format=json

    Stdout is JSON whose path field is the worktree's absolute path (status lines go to stderr). On Branch <branch> already exists: if the user named the branch, rerun without --create (it enters the branch, creating its worktree if missing); if step 1 picked the name, pick another and rerun. Any other failure (not a git repo, invalid name): report it and stop.

    With a repo argument, cd <repo> next, in its own Bash call. EnterWorktree re-roots only within the repository the cwd is in, and worktrunk's PermissionRequest hook answers the confirmation that call asks for only for a wt worktree of that same repository. If the cd reports Shell cwd was reset, the repo is unreachable: skip the entry and hand back as in Unreachable below.

    Then call EnterWorktree({path: "<path from the JSON>"}).

    • Accepted → the session is re-rooted in the worktree. Do the task (or, with no task text, confirm it's ready and wait).
    • Tool error — the tool ran and returned an error (Cannot enter worktree: …) → graceful; nothing moved, and one recovery covers them all. The common cause is a session already rooted in a worktree (or a pinned agent), which limits entry to the current repo's .claude/worktrees/ and excludes even a same-repo wt sibling. The recovery test is whether you can cd into the worktree, which works when it's inside an allowed directory. So cd <path> and read the result:
      • no Shell cwd was reset notice → it stuck; the worktree is reachable. Work there, but a bare cd is not a tracked re-root, so the cwd can revert to the session's launch worktree across turns (and in spawned subagents); pin commands with git -C <path> / wt -C <path> rather than trusting the cd to persist.
      • Shell cwd was reset → Unreachable. Stop and ask the user to make the directory whose cd reset reachable: add a parent that holds both the repo and its worktrees, like ~/workspace, to permissions.additionalDirectories (durable, every session), or run /add-dir on it (this session). Then continue from that cd. Don't grind through absolute paths with cd resetting on every command.
    • Denied — the call itself was refused, with no tool error → however the denial is worded, it is the user's answer to the confirmation Claude Code shows for entering a worktree outside .claude/worktrees/, unless there was no user to ask (the denial says the session couldn't prompt), which decides nothing — take the recovery above. On the user's answer: the worktree wt just created still exists; only the entry didn't happen. cd back out of the repo you moved into, if any, then report the worktree's path and ask how to proceed, since reaching it through cd would override that answer.

Cleanup

The worktree is a normal worktrunk worktree: it shows up in wt list and is merged or removed with wt merge / wt remove <branch> like any other. Don't remove it unprompted.

A worktree from step 2 that the session never touched — no changed files, no commits — is cleaned up when the session ends, branch included; anything written into it keeps it. A worktree from step 3 always stays. If the user asks to leave mid-session, ExitWorktree({action: "keep"}) returns the session to its original directory; ExitWorktree cannot remove a worktree entered by path, so removing one of those is always wt remove <branch>.

Scope

The command's mandate is ONE worktree (in the named repo, if one was given) and the requested task inside it. Commits, pushes, and merges still each require explicit user permission.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Wt Switch Create AI skill do?

Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.

Why use Wt Switch Create on TypingMind?

Because you install it once and use it with any model. Wt Switch Create is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Wt Switch Create in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/max-sixty/worktrunk/tree/main/plugins/worktrunk/skills/wt-switch-create. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Wt Switch Create?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Wt Switch Create?

As many as you like. As long as a model supports skills, you can use Wt Switch Create with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Wt Switch Create AI skill free?

It is published on GitHub by max-sixty. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇