"Create a branch-scoped git worktree and tmux workspace. Use when the user asks to start/switch an isolated branch workspace, create a worktree for a branch, or open a branch-specific tmux coding environment."
Resources
1Install
npx skillscat add samuerio/dotfiles/agent-workspace Install via the SkillsCat registry.
SKILL.md
Agent Workspace
Create an isolated workspace with git worktree + tmux.
Input
branch: optional (example:feature/ui-migration).
Preconditions
- Run inside the target git repository.
- Ensure
tmuxis available inPATH. - If a new worktree is required, current workspace must be clean (script exits on uncommitted changes).
Execute
bash ~/.agents/skills/agent-workspace/create_workspace.sh ["<branch>"]When branch is omitted:
- If there is exactly one existing agent workspace, script auto-selects it and switches.
- If there are multiple existing agent workspaces, script prints list output and exits 0.
- If there are no existing agent workspaces, script exits non-zero and asks for a branch.
To list only (no switch/create):
bash ~/.agents/skills/agent-workspace/create_workspace.sh --listSuccess Output Contract
On success, parse command output and report:
- Switch/create mode:
branch=<value>worktree_path=<value>worktree_created=<yes|no>attach=<tmux attach ...>(only when output includes it, usually outside tmux)
- List mode:
mode=listworkspace_count=<number>workspace_<i>_branch=<value>(1-based index)workspace_<i>_path=<value>(1-based index)
Caller Template (mode=list)
Use this caller flow when branch is omitted:
- Run
bash ~/.agents/skills/agent-workspace/create_workspace.sh. - Parse stdout as
key=valuepairs. - If stdout does not include
mode=list, treat it as switch/create success and continue. - If
mode=listandworkspace_count>1, prompt user to choose oneworkspace_<i>_branchand rerun with that branch.
Question template for multi-workspace choice:
- Header:
Switch workspace - Question:
Found multiple agent workspaces. Which branch do you want to switch to? - Options: each
workspace_<i>_branch(label) with matchingworkspace_<i>_path(description)
Then run:
bash ~/.agents/skills/agent-workspace/create_workspace.sh "<selected-branch>"If user asks to create a new one instead, ask for a new branch name and run the same command with that branch.
Side Effects
- May append
/.worktree/to repo.gitignore. - May create a commit for the
.gitignoreupdate. - May create a new branch when
branchdoes not exist. - May create tmux session
agent-workspaceand a new window for this branch.
Failure Handling
If command exits non-zero:
- Report exact error output.
- Stop immediately.
- Do not auto-retry.
- Do not run fallback or cleanup commands unless user explicitly asks.