worktree

worktree is a skill for Claude Code, Codex from zts212653/clowder-ai. It costs 59 tokens per session (5,608 once invoked), scanned A, original, MIT.

A workflow for creating an isolated Git worktree, which is a separate working copy of a repository tied to its own branch. It also defines checks and project-specific rules before development begins.

In plain words
What is it for?
Use it before non-trivial development involving code, scripts, APIs, command-line tools, or other executable project areas. It also covers memory searches, branch locations, and required checks.
Why use it?
It keeps feature work away from the main branch and helps prevent changes from interfering with production files or other work.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md; mentions AGENTS.md; mentions Codex.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is pnpm worktree:new ../cat-cafe-{feature-name} --branch feat/{feature-name} --owner {你的 catId} --policy merged.

Good fit Use it before non-trivial development involving code, scripts, APIs, command-line tools, or other executable project areas. It also covers memory searches, branch locations, and required checks.

Compare 6 skills from other repositories ↓
About the project

Clowder AI is a self-hosted workspace where AI agents from different model families work together as a persistent team, retaining identities, shared evidence, and memory across tasks. It is for people who want to coordinate multiple AI agents without repeatedly rebuilding their context.

zts212653/clowder-ai · 3,471 stars · on GitHub

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/zts212653/clowder-ai
agentmods
npx agentmods add skills/zts212653/clowder-ai/worktree

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/zts212653/clowder-ai/worktree/github.svg)](https://agentmods.dev/skills/zts212653/clowder-ai/worktree)
Your own site
<a href="https://agentmods.dev/skills/zts212653/clowder-ai/worktree"><img src="https://agentmods.dev/badge/skills/zts212653/clowder-ai/worktree/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for worktree

Your own site · 80×15
<a href="https://agentmods.dev/skills/zts212653/clowder-ai/worktree"><img src="https://agentmods.dev/badge/skills/zts212653/clowder-ai/worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,608 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 3 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 109
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 151
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 152
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00059 $0.05608
Opus 5.5 $0.00024 $0.02243
Sonnet 5.5 $0.00012 $0.01122
Haiku 4.5 $0.00006 $0.00561

Measured today against content hash 7b250f7fcdbc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

worktree scanned grade A 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 today.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- 🔴 **`localhost:3003/3004` 默认属于 `cat-cafe-runtime`**。如果你要验证当前 worktree 的未合入改动,浏览器 / Playwright / curl 不能直接打这两个端口,除非你明确是在做 runtime 验收而不是开发验证
cat-cafe-skills/worktree/SKILL.md · 323 lines

How it starts

The opening of the file, as written. The whole thing — 323 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Worktree

开始任何非 trivial 的功能开发前,必须拉 worktree 隔离,不要直接在 main 上改代码。Skill / MCP description 如果改到 API route、localhost、script、CLI command、第一方执行面,即使只有几行,也不按“纯文档免验证”处理:默认跑 skill reference/surface 与 claim 对应的定向检查;只有共享契约、门禁执行链或 targeted 无法覆盖跨包合流风险时才跑 full pnpm gate;高风险标签单独加强对应独立审查 / 授权。非 trivial 行为改动仍应开 worktree。

获准的新 Feature 开工或旧 Phase 续做,在原责任现场先按 custody-recognition 核 accepted scope 并复用原 Task;worktree 只是代码隔离,不是新的托付身份。已批准的执行子线程继续自己的实现,不读取或迁移父线程 Task。

Co-Creation Docs 边界

纯文档不再按行数决定是否进 worktree。用户授权落盘的共创文档先加载 co-creation-docs;显然低风险时猫可直接判定,拿不准或准备升到重载体时才运行 pnpm classify:co-creation-docs:

  • 显然 low-risk 或 delivery=direct_push → 不加载本 skill;走轻量文档校验 + 按内容决定 review=required|reuse|skip + commit/push。
  • delivery=pull_request 且 lane=co_creation_docs → 独立分支用于冲突/治理 review,但不自动升级 full gate。
  • lane=regular_development → 正常加载本 skill。

cat-cafe-skills/**、sop-definitions/**、脚本、CLI 与其他第一方执行面始终属于 regular development;文件扩展名是 .md 也不例外。

开工前 Recall(F102 记忆系统)🔴

拉 worktree 前,先用记忆系统搜一下相关上下文(见 CLAUDE.md 记忆系统段落):

search_evidence("{feature关键词}")
search_evidence("{topic}", scope="all")

不搜就开工 = 从零开始,可能重蹈覆辙。

目录位置(铁律)

Clowder AI 项目:../cat-cafe-{feature-name}(relay-station/ 同级)

pnpm worktree:new ../cat-cafe-{feature-name} --branch feat/{feature-name} --owner {你的 catId} --policy merged
  • 🔴 禁止在项目内部创建(不要用 .worktrees/ 子目录)
  • 🔴 cat-cafe-runtime 是生产环境,绝对不能删/清理! 它不是开发 worktree
  • 🔴 禁止在 cat-cafe-runtime 里执行 pnpm start / pnpm runtime:start(会先 kill 旧 API,等于把在线 runtime 踢掉)
  • 🔴 localhost:3003/3004 默认属于 cat-cafe-runtime。如果你要验证当前 worktree 的未合入改动,浏览器 / Playwright / curl 不能直接打这两个端口,除非你明确是在做 runtime 验收而不是开发验证

其他项目:先查 CLAUDE.md / AGENTS.md 有没有指定位置 → 有就用 → 没有再问用户。

创建前:Main 同步检查(F073 门禁)

开 worktree 前必须确认 main 与 origin/main 完全同步(双向)。其他猫看的是 origin/main,不同步 = 信息不对称。

# Step 1: 检查是否有未提交的文档变更
git status --porcelain docs/ | head -5
# 如果有输出 → 先 commit 再继续

# Step 2: 检查 main 与 remote 双向同步
git fetch origin main --quiet
AHEAD=$(git rev-list --count origin/main..main)
BEHIND=$(git rev-list --count main..origin/main)
echo "ahead=$AHEAD behind=$BEHIND"
# ahead > 0 → 先 git push origin main
# behind > 0 → 先 git pull origin main
# 两者都 = 0 → 可以继续

Read the full file on GitHub · 323 lines

Changes

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.

  1. yesterday Changed a249d98df3ac
  2. 3d ago Changed · +24 lines 7b250f7fcdbc
  3. 8d ago Changed · +15 lines · +16 tokens per session 3a409ae47ed2
  4. 14d ago Changed · +19 lines 187c843ba62f
  5. 1mo ago Changed 20d1a37a28f1
  6. 1mo ago Changed 306748654177
  7. 1mo ago Changed f2073ccefbaf
  8. 1mo ago First seen · 265 lines · 43 tokens per session scan A af508f637a0e

Subscribe to this mod's changes

worktree is a skill published in the GitHub repository zts212653/clowder-ai (3,471 stars, last pushed today), licensed MIT. It adds 59 tokens to every session and 5,608 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.