Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add ccoalm/ccl-skills --skill worktree-isolationgit clone --depth 1 https://github.com/ccoalm/ccl-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/ccoalm/ccl-skills/worktree-isolation)<a href="https://agentmods.dev/skills/ccoalm/ccl-skills/worktree-isolation"><img src="https://agentmods.dev/badge/skills/ccoalm/ccl-skills/worktree-isolation.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00315 | $0.11445 |
| Opus 5 | $0.00158 | $0.05722 |
| Sonnet 5 | $0.00063 | $0.02289 |
| Haiku 4.5 | $0.00032 | $0.01145 |
Grade C, and why
worktree-isolation scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
**删 worktree 前先救 gitignored 产物**:`git worktree remove`(不带 `--force`)会拒绝脏树/未跟踪文件,但 **gitignored 文件不算"脏"**——worktree 里生成的 gitignored 内容**会随目录一起被删且 git 不会拒绝**,删后不可恢复。绝大多数(依赖目录、构建/测试产物、缓存、日志)本就该删;要救的是其中**重算代价高的数据产物**(data/、o How it starts
The opening of the file, as written. The whole thing — 180 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Worktree Isolation(编辑隔离)
核心心法
主检出(main 那个工作树)是干净的基线/集成点,不是开发现场。每个迭代/任务在自己的 worktree 里做。并行的两个迭代 = 两个 worktree,互不碰主检出 → 天生不会 clobber。
「天生不会 clobber」只覆盖 git 工作树 / 索引 / 分支——不覆盖仓外的共享运行时状态。 独立 worktree 让并行 lane 互不碰彼此的 tracked 文件和 index,但不隔离仓外共享面,大致三类:①共享服务/端口——同一本机的测试库 / 消息队列 / 缓存服务、监听端口(如 :3000)、docker compose 工程名与卷;②共享文件状态——共享的 .env、跨 worktree 共享的可变 node_modules / .venv / build 输出 / 生成物目录、固定 /tmp 路径;③主机全局配置与凭据——$HOME 下的工具配置与 auth profile、KUBECONFIG / gcloud·kubectl 当前 context / cloud·registry 凭据、~/.npmrc、浏览器/设备 profile(切错 context 会让另一条 lane 的 migration/deploy/install 打到错误目标——是权限/目标级 clobber,不止数据)。两个 worktree 同时跑 pytest / migration / dev server / deploy 会在这些面互踩——一方的 migration 或 fixture 清库毁掉另一方、端口占用失败、缓存串写、或打到错误集群。所以并行前先隔离:每条 lane 独立的 DB/schema/namespace、不同端口、独立 compose project 与卷、每 worktree 自己的可变依赖安装/构建/输出目录、独立的 KUBECONFIG/配置 profile 并显式传 context 而非依赖全局当前值(并发安全的内容寻址/只读缓存可共享,不必强拆——如 pnpm store、Go module cache;cargo 仅指依赖下载缓存,不含 $CARGO_HOME 的 config/凭据/bin/registry index/target;只拆会被并发写坏的可变面);隔离不了的共享面就把那部分工作串行(呼应 multi-agent-delegation 的「共享 state / migration / 生成物就串行或留本地」)。单人单线顺序跑通常不触发,但共享库残留脏数据或残留的全局 context 仍可能跨 lane 串——按需重置。
绝不在 main 上开发:main(主检出 / main 分支)永远是干净基线/集成点,不是开发现场——任何迭代/功能、哪怕一行修改,都先建分支 + worktree 再改,不论单人单线还是并发、不论是不是技能仓库(worktree 很便宜,没有例外)。并发只是让这条更刚性,不是它的前提。
绝不依赖 ambient cwd(机械纪律,与上条并列):多 worktree 下 shell 的 cwd 可能在两次工具调用之间被 harness 静默重置(常见回显 Shell cwd was reset to <某路径>;被重置的是 cd 出来的 shell cwd——宿主原生 EnterWorktree/--worktree 设的持久工作上下文不受此影响,对它 git -C 是双保险)。所以凡必须落到某个特定检出的操作都不靠"当前恰好 cd 在哪":git 变更(add/commit/merge/branch 等)一律显式 git -C "<abs-worktree-path>" …(-C 等价于在该目录里起 git,pathspec 也按 -C 目录解析,故配绝对文件路径);文件写入用绝对路径(宿主原生 Write/Edit 本就要求绝对路径,自动满足);确实需要工作目录的命令(在 worktree 内跑 pytest/build/dev server,或本技能自己的 cwd 相关操作——Step 0 的 worktree-status.sh、收尾「在主检出里跑」的 git worktree remove/prune、worktree-sweep.sh)用单条 cd <abs> && <cmd> 在调用当刻设好工作目录,绝不假设它存活到下一次工具调用。为什么"cd 前先确认 cwd"不够:确认之后、下次调用之前 cwd 仍可能被重置,裸 git commit/相对路径就落到 cwd 当时指向的检出——多 worktree 下常是主检出,把提交落到错的分支,到 ff-only 合并才暴露(即收尾节「合并方向」条的"站错分支就会合进 B、信息却写着 C")。命令若落到非 git 目录或空索引会显式报错,真正危险的是 add+commit 都静默落进主检出那种。诱因不止重置——删除已用 worktree 后路径复用同样让 cwd 失效(见收尾节「已删 worktree 的路径从此作废」),两者都是本条实例。
What ships with it
7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 7d ago First seen · 180 lines · 315 tokens per session scan C 37fcf770f9ee
worktree-isolation is a skill published in the GitHub repository ccoalm/ccl-skills (6 stars, last pushed today), licensed Apache-2.0. It adds 315 tokens to every session and 11,445 once invoked, about $0.0016 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
security-pipeline
Use when security verification is needed - pre-commit security checks, vulnerability scanning, STRIDE threat analysis. Integrates with /handoff-verify --security and /commit-push-pr. CWE Top 25 based.
memstack-security-git-guard
Use when the user says 'git-guard', 'check git protection', 'is this repo protected', 'verify gitleaks', 'set up git hooks', 'install git-guard', or wants to confirm a repo blocks secrets and internal files before commit. This is an installer and verifier, NOT a scanner (gitleaks does the actual scanning). Do NOT use…
memstack-development-changelog-generator
Use when the user says 'generate changelog', 'update changelog', 'what changed', 'release notes', 'write changelog', or needs a formatted CHANGELOG.md from git commit history. Do NOT use for diary entries, git log viewing, or commit message writing.
ln-63-release-publisher
Prepares and publishes an explicitly requested tagged GitHub release. Not for ordinary commits, package publication, or announcements.
ln-64-community-announcer
Drafts or publishes fact-checked GitHub Discussions announcements for project updates. Not for release creation or issue responses.
aiwg-pr
AIWG-specific pull request delivery workflow for AIWG product/workspace changes; not the generic repository PR process.