worktrees
What it does
This skill manages Git worktrees as separate, isolated lanes for complex or risky coding work. It is for developers and AI orchestrators handling several tasks at once.
When to use it
- ✓When several coding tasks need to run in parallel without touching the same files.
- ✓When a risky experiment should be kept separate from the main project.
- ✓When you need to review work from separate lanes and bring it back into one branch.
Skill link
https://github.com/alvinunreal/oh-my-opencode-slim/blob/master/src/skills/worktrees/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Set up a separate worktree for this risky refactor so it does not disturb my main branch.”
5 new skills a week. 1 minute to read.
How it works
The skill places each lane in its own folder under the project's .slim directory, with its own branch and a clear owner. It tracks lane status and handles cleanup at the end.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Worktrees Orchestration Protocol
The worktrees skill provides an opinionated, safe orchestration protocol for
managing Git worktrees as isolated coding lanes. Its value is giving the Orchestrator a consistent OMO workflow for parallel agents, risky experiments, integration review, and cleanup.
Core Contract
This is an orchestrator-only workflow. Other specialists such as @fixer
or @designer can be assigned tasks inside a worktree lane, but the
Orchestrator owns lane planning, branch/path selection, file ownership,
delegation, diff validation, integration, and cleanup.
All worktrees reside under the default path:
.slim/worktrees/<slug>/
Do not create worktrees as sibling directories of the main repository.
State Tracking (.slim/worktrees.json)
Use the optional local metadata manifest .slim/worktrees.json to maintain
structural tracking:
{
"version": "1.0.0",
"updatedAt": "2026-06-14T00:00:00.000Z",
"lanes": [
{
"slug": "feature-auth-v2",
"branch": "omos/feature-auth-v2",
"path": ".slim/worktrees/feature-auth-v2",
"base": "main",
"purpose": "refactor authentication flow to use OAuth2",
"owner": "orchestrator",
"status": "active",
"areas": ["src/auth", "src/config"],
"createdAt": "2026-06-14T12:00:00.000Z"
}
]
}
If .slim/worktrees.json does not exist, create it when initializing a lane,
and keep it updated as lanes are transitioned, integrated, or pruned. Treat it
as local workflow metadata by default; ask before making it part of a committed
project convention.
Safety Guidelines
Before executing any Git mutation command, the Orchestrator must observe the following guards:
1. Pre-Flight Checklist
- Confirm the current directory is inside a Git repository.
- Check the current branch, base branch, and dirty/uncommitted state.
- Inspect the output of
git worktree listto avoid path or branch conflicts. - Ensure the branch name (e.g.
omos/<slug>or custom project convention) does not already exist locally or on remote. - Ensure
.slim/worktrees/is ignored by Git before creating nested worktrees.
2. Mandatory User Confirmation
You must seek explicit user confirmation before executing:
git worktree addorgit worktree remove- Branch creation, deletion, or renaming
- Merges, rebases, or cherry-picks
git pruneorgit worktree prune- Destructive commands (e.g.,
git reset --hard,git clean,git push --force, or removing a dirty worktree directory).
Never execute destructive commands, delete branches, remove dirty worktrees, or clean uncommitted changes without explicit user confirmation for that exact operation.
3. Ignore File Setup
Before creating or cleaning lanes, inspect existing .gitignore and .ignore.
Update the managed block in place when present; otherwise append it. Add only
the missing exact lines below, never duplicate entries or modify unrelated
rules. These blocks keep lane artifacts git-local while the .ignore allowlist
keeps them readable to OpenCode.
.gitignore:
# BEGIN oh-my-opencode-slim worktrees
.slim/worktrees/
.slim/worktrees.json
# END oh-my-opencode-slim worktrees
.ignore:
# BEGIN oh-my-opencode-slim worktrees
!.slim/
!.slim/worktrees.json
!.slim/worktrees/
!.slim/worktrees/**
# END oh-my-opencode-slim worktrees
Workflow Guide
Phase 1: Planning & Setup
- Identify the task scope and determine a short
<slug>for the worktree. - Formulate a branch name. Default to
omos/<slug>unless project/user conventions dictate otherwise. - Validate repository safety. Ask the user for confirmation to initialize the lane.
- Before creating the lane, ensure the managed ignore blocks are present using the Ignore File Setup rules above.
- Run:
git worktree add -b <branch-name> .slim/worktrees/<slug> <base-commit/branch> - Register the metadata in
.slim/worktrees.json.
Phase 2: Execution & Delegation
- Run all sub-agents with their working directory set strictly to the worktree
path, such as
.slim/worktrees/<slug>. - Do not modify the main checkout for lane work. Keep build, test, and edit operations isolated inside the lane.
- Track file or folder ownership per lane to avoid merge conflicts between parallel agents.
- Commit progress within the worktree only when the user asked for commits or approved local checkpoint commits.
FAQ
Where are the worktrees kept?
Under a .slim/worktrees folder inside the project, not beside the main repository.
Does it track the lanes?
Yes. It can keep an optional manifest file with each lane's branch, purpose and status.
Who controls the lanes?
The orchestrator owns planning, delegation, checks and cleanup, while specialists may work inside a lane.
Details
Original description by the author
Manage Git worktrees as OMO safe isolated coding lanes for complex, risky, or parallel work.
Popularity
- GitHub stars
- 10k
- Ranking position
- #12020
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
cli-review
10kLets your agent run a Greptile code review on your current branch before you open a pull request, then summarize the findings in plain terms.
ai-estimates
10kHelps your agent estimate how long work takes when a person works with AI, splitting fast AI work from human and outside delays.
clonedeps
10kLets your agent copy the source code of key project dependencies into a local folder, so it can read how those libraries work inside.
codemap
10kCreates a structured map of an unfamiliar code project, so your agent can find its main parts quickly. Best used when you ask for a codebase map.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.