/install git-factory
Git Factory — Worktree Isolation for Moths
Each moth gets its own branch, its own workspace, its own PR. No conflicts. No merge hell.
When to Use
- Multi-moth coding tasks — parallel feature work on the same repo
- Open-source PRs — isolated branch per contribution
- Skill packaging — each skill gets its own worktree for clean commits
- Any moth that writes code — default to worktree isolation
Quick Reference
Provision a worktree for a moth
# From the repo root
.\skills\git-factory\scripts\
ew-worktree.ps1 -RepoPath . -TaskSlug "fix-login-bug"
# Returns: C:\Users\spaz\clawd\.worktrees\fix-login-bug
Finish and submit PR
.\skills\git-factory\scripts\finish-worktree.ps1 `
-WorktreePath ".worktrees\fix-login-bug" `
-CommitMessage "moth(fix-login-bug): fix auth redirect loop" `
-CreatePR -PRTitle "Fix login redirect bug" `
-PRBody "Fixes the auth redirect loop on expired sessions"
List active worktrees
.\skills\git-factory\scripts\list-worktrees.ps1 -RepoPath .
Clean up stale worktrees (>7 days)
.\skills\git-factory\scripts\cleanup-stale.ps1 -RepoPath . -MaxAgeDays 7
Moth Dispatch Integration
When spawning a coding moth, include the worktree in the task prompt:
Your working directory is: C:\Users\spaz\clawd\.worktrees\\x3Ctask-slug>
You are on branch: moth/\x3Ctask-slug>
Base branch: master
Work ONLY in this directory. When finished:
1. Stage and commit your changes
2. Push your branch: git push -u origin moth/\x3Ctask-slug>
3. Report what you built and any issues
Do NOT modify files outside your worktree.
Conventions
| Item | Convention |
|---|---|
| Worktree location | \x3Crepo>/.worktrees/\x3Ctask-slug> |
| Branch naming | moth/\x3Ctask-slug> |
| Commit prefix | moth(\x3Ctask-slug>): \x3Cdescription> |
| PR mode | Draft by default |
| Stale threshold | 7 days (configurable) |
.worktrees/ |
Added to .gitignore automatically |
How It Works
new-worktree.ps1creates a branchmoth/\x3Cslug>and a worktree at.worktrees/\x3Cslug>- Moth works in the isolated directory — full git repo, own branch, no conflicts
finish-worktree.ps1commits, pushes, optionally creates a draft PR, then removes the worktreecleanup-stale.ps1runs periodically to remove abandoned worktrees
Limitations
- Worktrees share the same
.gitdirectory — large repos may have lock contention on heavy git ops - Can't have two worktrees on the same branch
- Windows file locking can prevent cleanup if processes have files open\r
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install git-factory - After installation, invoke the skill by name or use
/git-factory - Provide required inputs per the skill's parameter spec and get structured output
What is Git Factory?
Provision and manage isolated git worktrees for individual coding tasks, enabling parallel branches and clean PR workflows without merge conflicts. It is an AI Agent Skill for Claude Code / OpenClaw, with 94 downloads so far.
How do I install Git Factory?
Run "/install git-factory" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Git Factory free?
Yes, Git Factory is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Git Factory support?
Git Factory is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Git Factory?
It is built and maintained by Spaztazim (@spaztazim); the current version is v1.0.0.