worktree
Skill5 starsChanged 9 months agoMITView on GitHub
Manage git worktrees for autoimprove experiments. Creates isolated worktrees for each experiment so the main codebase is never touched. Handles setup, teardown, and merging winning experiments back to main.
- Deletes or force-pushes
40 other projects use a version of this.
Adopted by
Most recently taken up by
- Significant-Gravitas/AutoGPTtheir own version, first seen Nov 18, 2026
- kortix-ai/sunatheir own version, first seen Oct 5, 2026
- ShalomPrinz/go2-dispatchertheir own version, first seen Oct 4, 2026
- jantichy/claudetheir own version, first seen Oct 2, 2026
- domengabrovsek/agent-configtheir own version, first seen Oct 2, 2026
- craigcossairt/trellistheir own version, first seen Oct 1, 2026
Used with
Projects with it also use coverage, backlog 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.
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
vertz-devSkillbacklog
Manages deferred/blocked work items as GitHub Issues with labels and blocker tracking
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 3 projects that use this
nicolasestremSkillcleanup
Clean up code, remove dead code, and optimize project structure
Also in 3 projects that use this
MongoDBSkilljira
Use this skill for any Jira operation in the DOCSP project — creating, viewing, searching, updating, transitioning, commenting on, or linking tickets. Also handles follow-up ticket creation to manage scope creep. TRIGGER when: user mentions a DOCSP-XXXXX ticket number or any Jira ticket URL; user asks to view, open, check, update, transition, close, comment on, link, or search tickets; user references \"the ticket\", \"the Jira\", or \"open a ticket\". SKIP: GitHub issues; non-Jira platforms; questions unrelated to ticket operations.
Also in 3 projects that use this
Other versions40 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 40
- Significant-Gravitas/AutoGPT★ 188ksame name
- kortix-ai/suna★ 20ksame name
- Zipstack/unstract★ 7.3ksame name
- mistralai/mistral-vibe★ 5ksame name
- nudgebee/nudgebee★ 398same name
- microsoft/service-fabric-dotnet★ 277same name
- murray17/rovai-ai★ 122same name
- forrestchang/worktree-workflow★ 108same name
- Rune-kit/rune★ 88same name
- oprogramadorreal/optimus-claude★ 75same name
30 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.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- auditSkill
- detect-stackSkill
- improve-loopSkill
- measureSkill
- rollbackSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 35 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 7
Every autoimprove experiment runs in an isolated git worktree — a separate directory linked to the same repo but on its own branch.
- Distinctive: line 20
Run once before the first experiment in a session:
- Distinctive: line 42
Run at the start of each iteration:
- Distinctive: line 62
All measurement commands must be run from inside the worktree path:
- Distinctive: line 75
If AFTER score > BEFORE score:
- Distinctive: line 112
Run after the session completes or if something goes wrong:
- Distinctive: line 136
If something goes wrong mid-session and worktrees are left dangling:
“Common” is measured: kept by at least 6 in 10 of the 35 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 Management Skill
Every autoimprove experiment runs in an isolated git worktree — a separate directory linked to the same repo but on its own branch. The main working directory is never modified. Only winning experiments get merged back.
your-project/ ← main worktree (never touched during experiments)
.claude/autoimprove/worktrees/ ← experiment worktrees live here
experiment-001/ ← branch: autoimprove/experiment-001
experiment-002/ ← branch: autoimprove/experiment-002Setup worktree environment
Run once before the first experiment in a session:
# 1. Make sure we're on a clean main branch
git status
git branch --show-current
# 2. Create the worktree container directory (gitignored)
mkdir -p .claude/autoimprove/worktrees
# 3. Add it to .gitignore if not already there
grep -q ".claude/autoimprove/worktrees" .gitignore 2>/dev/null || echo ".claude/autoimprove/worktrees" >> .gitignore
# 4. Record the base commit so all experiments branch from the same point
BASE_COMMIT=$(git rev-parse HEAD)
echo "Base commit: $BASE_COMMIT"Create a new experiment worktree
Run at the start of each iteration:
EXPERIMENT_ID=$(printf "%03d" $ITERATION_NUMBER)
BRANCH="autoimprove/experiment-$EXPERIMENT_ID"
WORKTREE_PATH=".claude/autoimprove/worktrees/experiment-$EXPERIMENT_ID"
# Create a new branch and worktree from current HEAD
git worktree add -b "$BRANCH" "$WORKTREE_PATH"
echo "Created worktree: $WORKTREE_PATH"
echo "Branch: $BRANCH"Now switch all subsequent file edits and commands to run inside $WORKTREE_PATH. The main directory is untouched.
Run measurement in a worktree
All measurement commands must be run from inside the worktree path:
cd .claude/autoimprove/worktrees/experiment-$EXPERIMENT_ID
# Run the measurement suite from .claude/autoimprove/config.md
# (same commands, different working directory)Winning experiment — merge back to main
If AFTER score > BEFORE score:
BRANCH="autoimprove/experiment-$EXPERIMENT_ID"
# Option A: Squash merge (recommended — keeps main history clean)
git merge --squash "$BRANCH"
git commit -m "autoimprove($EXPERIMENT_ID): $HYPOTHESIS_ONE_LINE
Score: $BEFORE_SCORE → $AFTER_SCORE (+$DELTA pts)
Files: $CHANGED_FILES"
# Remove the worktree and branch
git worktree remove ".claude/autoimprove/worktrees/experiment-$EXPERIMENT_ID"
git branch -D "$BRANCH"
echo "✅ Experiment $EXPERIMENT_ID merged to main"Losing experiment — discard cleanly
If AFTER score <= BEFORE score:
# Just remove the worktree and delete the branch — main is untouched
git worktree remove ".claude/autoimprove/worktrees/experiment-$EXPERIMENT_ID" --force
git branch -D "autoimprove/experiment-$EXPERIMENT_ID"
echo "❌ Experiment $EXPERIMENT_ID discarded — no changes to main"Cleanup all worktrees (end of session)
Run after the session completes or if something goes wrong:
# List all autoimprove worktrees
git worktree list | grep autoimprove
# Remove all experiment worktrees
for wt in .claude/autoimprove/worktrees/experiment-*; do
git worktree remove "$wt" --force 2>/dev/null
done
# Clean up branches
git branch | grep "autoimprove/experiment" | xargs git branch -D 2>/dev/null
# Remove the container directory
rm -rf .claude/autoimprove/worktrees
echo "All experiment worktrees cleaned up"Emergency recovery
If something goes wrong mid-session and worktrees are left dangling:
# Check for stale worktrees
git worktree prune
# List all worktrees
git worktree list
# Force remove a specific one
git worktree remove .claude/autoimprove/worktrees/experiment-001 --force
git branch -D autoimprove/experiment-001Key guarantees
- Main branch is never modified until a winning experiment is explicitly merged
- Each experiment starts from the same commit — experiments are independent, not cumulative
- No leftover branches — winning experiments become squash commits, losers are deleted entirely
- Safe to Ctrl+C — worktrees can be cleaned up manually with the cleanup commands above
- Parallel-safe — each experiment has its own directory and branch, so multiple sessions can run without conflict (advanced use)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

