Worktree Manager
/install worktree-manager
Worktree Manager
Manages Docker app instances and git worktrees for local development.
Each instance gets its own docker-compose stack (backend + frontend), isolated git branch, and .env.worktree-\x3Cname> file. MySQL and nginx-proxy are managed separately by their own plugins.
Prerequisites
Start these first (order matters):
proxy-manager start— creates the shared Docker network (nginx-proxy_net)mysql-manager start— starts the shared MySQL container
Architecture
project/
├── docker-compose.yml # app stack template (backend + frontend)
├── run.sh # this plugin's entry point (copy to project root)
├── .env.base # main instance env
├── .env.worktree-\x3Cname> # per-worktree env (gitignored)
└── .worktrees/
└── \x3Cname>/ # git worktree (gitignored)
main→.env.base, project rootworktree→.env.worktree-\x3Cname>, checked out at.worktrees/\x3Cname>- URLs:
http://\x3Cname>.frontend.localhost/http://\x3Cname>.backend.localhost
Commands
All commands run from the project root:
./run.sh list # show all instances + mysql/proxy status
./run.sh start [main|\x3Cname>] # seed db, start containers, connect proxy
./run.sh stop [main|\x3Cname>] # stop containers (db persists)
./run.sh restart [main|\x3Cname>] # stop then start
./run.sh logs [main|\x3Cname>] # follow container logs
./run.sh create-worktree \x3Cname> # git worktree + branch + env file
./run.sh remove-worktree \x3Cname> # stop containers + drop db + remove worktree
How to Execute Tasks
Full environment setup (first time)
proxy-manager/run.sh start # network + nginx-proxy
mysql-manager/run.sh start # MySQL
./run.sh start main # main app instance
Create a new worktree and start it
./run.sh create-worktree \x3Cname>— creates branchworktree/\x3Cname>, dir.worktrees/\x3Cname>, env file./run.sh start \x3Cname>— seeds db from main snapshot, starts containers, activates proxy route- URLs reported at the end
Stop an instance
./run.sh stop \x3Cname>
Remove a worktree (destructive — always confirm first)
Confirm with user: "Remove worktree '\x3Cname>'? Deletes containers, database, git worktree (branch worktree/\x3Cname>), and .env.worktree-\x3Cname>."
./run.sh remove-worktree \x3Cname>
List all instances
./run.sh list
What start Does
- Checks MySQL container is running (exits with error if not)
CREATE DATABASE IF NOT EXISTSfor the instance- For non-main instances: dumps
codai_main→ instance db docker compose up --build -ddocker network connect— proxy to instance network (activates routes)
Rules
- Always check
./run.sh listbefore starting — it shows MySQL/proxy status. - Always confirm before
remove-worktree— it is irreversible. - After
start, print the frontend and backend URLs. - If
./run.shis not executable:chmod +x run.sh .env.worktree-*files and.worktrees/dir must be gitignored.
Configuration
| Variable | Default | Purpose |
|---|---|---|
MYSQL_CONTAINER |
codai_db |
MySQL container name |
MYSQL_ROOT_PASS |
secret |
MySQL root password |
MYSQL_MAIN_DB |
codai_main |
Source DB for snapshots |
PROXY_CONTAINER |
codai_nginx_proxy |
nginx-proxy container name |
PROJECT_PREFIX |
codai-dev |
Docker Compose project prefix |
Related Plugins
proxy-manager— nginx-proxy lifecycle and network management (start first)mysql-manager— MySQL lifecycle and database admin (start second)
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install worktree-manager - After installation, invoke the skill by name or use
/worktree-manager - Provide required inputs per the skill's parameter spec and get structured output
What is Worktree Manager?
Manage Docker-based dev instances and git worktrees. Handles app container lifecycle, database seeding, and proxy route activation. Requires mysql-manager an... It is an AI Agent Skill for Claude Code / OpenClaw, with 64 downloads so far.
How do I install Worktree Manager?
Run "/install worktree-manager" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Worktree Manager free?
Yes, Worktree Manager is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Worktree Manager support?
Worktree Manager is cross-platform and runs anywhere OpenClaw / Claude Code is available (linux, darwin).
Who created Worktree Manager?
It is built and maintained by Jair Pereira (@pereirajair); the current version is v1.0.3.