agentleFS
niksavisniksavis/basicly/.claude/skills/worktree-isolation/SKILL.md

worktree-isolation

Skill0 starsChanged 56 days agoMITView on GitHub

Isolates work in a sibling git worktree, then merges and cleans up. Use to keep a change out of the main checkout or when parallel tracks collide.

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    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
  1. Distinctive:

    Work: Do the change in the worktree.

    line 38
  2. Very specific:

    Use merge or merge-queue only for a worktree that the loop does not drive.

    line 40

“Common” is measured: kept by at least 6 in 10 of the 5 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Generated by `basicly skills-build` from skill.yaml. Do not edit; edit the source. -->

Worktree Isolation

This skill runs a unit of work in a sibling git worktree with basicly worktree. It covers placement, provisioning, merge and cleanup. For tracker records see work-tracker. For commits see the git reference of cli-tools and conventional-commits.

Rules

  • Isolate every non-trivial change. This includes multi-file work, work that runs the gates, and work parallel to another track.
  • Skip isolation for a trivial edit, such as a typo. A worktree has a real setup cost.
  • Put the worktree at the sibling path <repo>.worktrees/<name>. A worktree inside the repository is not provisioned, so its hooks run no gates.
  • Never pass -c core.hooksPath=... in a worktree. A relative path skips every hook with no message.
  • Do not resolve a merge conflict by hand. A conflict means the scopes missed a coupling, so the lane applies its intent again on the new base.
  • Run merge commands from the base checkout. Git refuses to update a branch that another worktree has checked out.

Lifecycle

basicly worktree create <name> [--base <branch>]           # add and provision
basicly worktree list                                       # active sessions; stale ones are marked
basicly worktree merge <name> --bead <id> [--mode M]        # rebase, verify, --no-ff merge
basicly worktree merge-queue <name>:<id> ... [--mode M]     # merge several, in the given topological order
basicly worktree cleanup <name> [--force]                   # remove the worktree and its merged branch
  1. Create. The worktree gets the branch harness/<name>, from [worktree].base_branch in basicly.toml or the current branch. It gets its own .venv (uv sync) and its own node_modules. The node_modules tree is copied from a checkout with an identical package-lock.json, else it comes from npm install. Neither tree is a symlink to the main checkout, so cleanup is safe. The command installs the repository's git hooks for every stage. It refuses when [worktree].concurrency is reached. Read the configured value.
  2. Work. Do the change in the worktree. Its hooks gate each commit as on the main checkout.
  3. Merge. Under basicly loop, the build-to-verify advance merges for you. Use merge or merge-queue only for a worktree that the loop does not drive.
  4. Clean up. cleanup removes the worktree, prunes the registry, and deletes harness/<name> when it is merged. It keeps an unmerged branch unless you pass --force. It never touches the base branch. It can reclaim a worktree whose directory is gone.

Hooks

A linked worktree's .git is a file. Git resolves its hooks to the shared common directory. Provisioning installs the hooks there, so a plain git commit in the worktree runs every gate.

A relative override such as git -c core.hooksPath=.git/hooks commit resolves inside the worktree. There .git/hooks does not exist, so git skips pre-commit, commit-msg and the record id check. The commit looks clean, and the defect shows only on a later commit. To see where hooks resolve, read the path:

git rev-parse --git-path hooks

Claude Code

The Claude Code setting worktree.bgIsolation (on by default) moves a background agent into .claude/worktrees/. That conflicts with sibling worktrees. Run this once per repository to set it to none:

basicly worktree bg-isolation

The command writes the committed .claude/settings.json, so it asks for consent. --yes gives that consent.

Codex and Copilot have no equivalent setting.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.