worktree
Skill19 starsChanged 2 months agoMITView on GitHub
Manage Git worktrees per writer for Agent Toolkit swarms — isolated branches, handoff promotion,
- Commits and pushes
We split this skill into the rules it gives an agent
8 rules. 0 are common, 3 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 45 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Create and maintain worktree-per-writer isolation for agent-toolkit swarm so each role works on its own branch without stepping on others.
- Very specific: line 25
Before swarm promote — ensure the handoff's worktree is clean and pushable.
- Very specific: line 54
Do not create worktrees by hand for swarm roles — let handoff create do it so state.json stays authoritative.
- Distinctive: line 66
If a worktree is orphaned or locked:
- Distinctive: line 77
After reviewer/integrator approves the handoff's artifact:
- Very specific: line 101
Never edit .agent-toolkit/swarm/runs/<run-id>/state.json worktree entries by hand — use swarm CLI.
- Distinctive: line 102
Never use git checkout in the main worktree to switch swarm branches.
- Very specific: line 103
Never delete a worktree that has an active handoff — complete or handoff first.
“Common” is measured: kept by at least 6 in 10 of the 45 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Worktree
Create and maintain worktree-per-writer isolation for agent-toolkit swarm so each role works on its own branch without stepping on others. Integrates with swarm-handoff promotion and github-cli-workflow for PRs.
When to use
- Swarm needs isolated writes: implementer, reviewer, integrator each own a worktree/branch.
worktree_failedtrace orfind_repo_rooterror on.gitfile worktrees.- Before
swarm promote— ensure the handoff's worktree is clean and pushable. - Cleanup after a run is promoted or abandoned.
Prerequisites
- Repo is Git with
git worktreeavailable (git worktree --help). - Swarm run exists:
.agent-toolkit/swarm/runs/<run-id>/state.json; worktrees live under.agent-toolkit/swarm/runs/<run-id>/worktrees/<role>-<short>/. find_repo_rootusesgit rev-parse --git-common-dirto handle worktree.gitfiles (not directories).
Workflow
1. Inspect current worktrees
git worktree list
agent-toolkit swarm status --run-id <run-id> --json | jq '.worktrees'
# Expected: {implementer: {path, branch, commit}, reviewer: {path, branch}, ...}
cat .agent-toolkit/swarm/runs/<run-id>/state.json | jq '.trace | map(select(.event | contains("worktree")))'2. How swarm creates them (automatic)
On handoff create --from X --to Y for a writer role Y, swarm:
- Resolves repo root via
find_repo_root(git rev-parse --git-common-dirfallback). - Creates branch
swarm/<run-id>/<role>if missing. - Runs
git worktree add <run-dir>/worktrees/<role>-<short> <branch>. - Exports
AGENT_TOOLKIT_SWARM_RUN_ID/RUN_DIR/REPO SWARMFORGE_ROLEandcd <worktree> && exec <runner> "$(cat prompt)"via_user_shell()(/usr/bin/zsh -lcon this host).
Do not create worktrees by hand for swarm roles — let handoff create do it so state.json stays authoritative.
3. Manual recovery
If worktree_failed:
git rev-parse --git-common-dir # from worktree dir — should succeed
AGENT_TOOLKIT_SWARM_RUN_ID=<run-id> agent-toolkit swarm handoff create --type artifact --from implementer --to reviewer --artifact artifacts/retry.md --run-id <run-id>
# Re-triggers provisioning with fixed repo-root logicIf a worktree is orphaned or locked:
git worktree list | grep <run-id>
git worktree remove <path> --force
git worktree prune
git branch -D swarm/<run-id>/<role> # only if run is abandoned and branch is merged/abandoned4. Promotion and PR
After reviewer/integrator approves the handoff's artifact:
agent-toolkit swarm promote --run-id <run-id> --handoff-id <handoff-id>
git -C <worktree-path> log --oneline -n 5
git -C <worktree-path> push -u origin <branch>
# Delegate to github-cli-workflow for draft PR
gh pr create --title "swarm/<run-id>: <summary>" --body-file artifacts/<handoff-artifact> --base mainFor reuse: same run-id reuses worktrees; no prune between sequential handoffs. New run only for isolated feature branches.
5. Cleanup after merge
gh pr merge <number> --squash --delete-branch
git worktree remove <path> --force
git worktree prune
agent-toolkit swarm list --json | jq '.[] | select(.run_id=="<run-id>") | .status'
# Optionally archive state: tar -czf /tmp/swarm-<run-id>.tgz .agent-toolkit/swarm/runs/<run-id>Boundaries
- Never edit
.agent-toolkit/swarm/runs/<run-id>/state.jsonworktree entries by hand — use swarm CLI. - Never use
git checkoutin the main worktree to switch swarm branches; alwaysgit worktree. - Never delete a worktree that has an
activehandoff — complete or handoff first.
Delegates to
| Need | Skill |
| Create the handoff that provisions the worktree | swarm-handoff |
| Launch or observe the swarm | swarm, swarm-observer |
| Herdr/tmux pane for the worktree | herdr |
| Push and create PR after promotion | github-cli-workflow |
| Review before promotion | code-reviewer, security-reviewer |
Other versions57 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 57
- Significant-Gravitas/AutoGPT★ 188ksame name
- kortix-ai/suna★ 20ksame name
- gitkraken/vscode-gitlens★ 10ksame name
- Zipstack/unstract★ 7.4ksame name
- mistralai/mistral-vibe★ 5.3ksame name
- nubjs/nub★ 4.4ksame name
- raine/workmux★ 3ksame name
- astashov/liftosaur★ 768same name
- nudgebee/nudgebee★ 520same name
- rhesis-ai/rhesis★ 402same name
47 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use worktree-merge, resolve-conflicts and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
leessjuSkillworktree-merge
Squash-merge the current worktree branch into the main branch (or a specified target). Analyzes git history and source code to craft a comprehensive commit message.
Also in 3 projects that use this
ralphkraussSkillresolve-conflicts
Resolve git merge conflicts or re-apply changes from a stale branch onto current main. Use when user says "resolve conflicts", "merge conflicts", "rebase branch", "branch is behind", "re-apply changes", "port branch", or a branch is too far behind main to merge cleanly.
Also in 5 projects that use this
hdcolaSkillpr-comments
Fetch unresolved review comments from a GitHub PR or mark comments as resolved. Use this when managing PR review feedback, checking pending comments, or marking review threads as resolved. Supports GitHub URLs or explicit owner/repo/PR-number from anywhere, or PR number auto-detection from within a git repository.
Also in 3 projects that use this
PydanticSkillcoverage
Fetch coverage diff from Codecov for the current branch or a specific PR. Shows uncovered lines, patch coverage, and overall coverage change.
Also in 3 projects that use this
johnlindquistSkilldiagram
Maintain and synchronize Unified Impact Diagrams following Diagram Driven Development (DDD) methodology. Create, update, and manage diagrams that connect user value to technical implementation.
Also in 4 projects that use this
SentrySkille2e
Run E2E tests for Sentry JavaScript SDK test applications
Also in 4 projects that use this
In this repository106 other files it gives its agents.
- AGENTS.mdAGENTS.md
- reviewSkill
- mcp-auditSkill
- owasp-agentic-reviewSkill
- supply-chain-auditSkill
- threat-modelingSkill
- architecture-diagramSkill
- c4-modelSkill
- aws-well-architected-reviewSkill
- cloud-design-patternsSkill
- assistantSkill
- dev-companionSkill
- onboardingSkill
- output-handshakeSkill
- pr-fallbackSkill
- projectSkill
- workspace-knowledge-syncSkill
- workspaceSkill
- dbt-validationSkill
- snowflake-validationSkill
- adrSkill
- agreementSkill
- bugSkill
- decision-logSkill
- development-workflowSkill
- epicSkill
- incidentSkill
- management-unit-assessmentSkill
- meeting-minutesSkill
- planningSkill
- prdSkill
- project-assessment-evidenceSkill
- project-assessmentSkill
- spikeSkill
- taskSkill
- technical-unit-assessmentSkill
- trdSkill
- user-storySkill
- workflow-client-bootstrapSkill
- workflow-generic-projectSkill
- work-itemSkill
- bragSkill
- brag-slimSkill
- design-assessmentSkill
- design-improvementSkill
- figma-code-connect-componentsSkill
- figma-create-design-system-rulesSkill
- figma-create-new-fileSkill
- figma-implement-designSkill
- figmaSkill
- frontend-design-reviewSkill
- frontend-designSkill
- scroll-worldSkill
- web-design-guidelinesSkill
- fix-merge-conflictsSkill
- gh-address-commentsSkill
- gh-contribution-plannerSkill
- gh-fix-ciSkill
- github-cli-workflowSkill
- gitlab-cli-workflowSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

