worktree-setup

A setup helper for Git worktrees, which are extra working folders connected to one Git repository. It links selected environment and secret files from the main folder when a new worktree starts.

In plain words
What is it for?
Use it when running multiple agent sessions or branches in separate worktrees. It supports default links, project-specific file lists, and checks for broken links.
Why use it?
Git normally leaves ignored files such as .env and .npmrc out of new worktrees, so parallel coding sessions may lack environment settings or access tokens. This keeps those files available without overwriting files already present.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/teamspwk/nova/worktree-setup
Any agent
npx skills add TeamSPWK/nova --skill worktree-setup
Clone the repo
git clone --depth 1 https://github.com/TeamSPWK/nova

Made for: Claude Code, Codex.

Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,670 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
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 $0.00065 $0.01670
Opus 5 $0.00032 $0.00835
Sonnet 5 $0.00013 $0.00334
Haiku 4.5 $0.00006 $0.00167

Measured yesterday against content hash 14ec6a149eb4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

worktree-setup scanned grade B 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 yesterday.

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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

설정 예시 (`~/.claude/settings.json` 또는 프로젝트 `.claude/settings.json`):
.claude/skills/worktree-setup/SKILL.md · 101 lines

How it starts

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

Nova Worktree Setup

git worktree는 기본적으로 gitignored 파일(.env, .secret/, .npmrc 등)을 새 작업 디렉토리로 복사하지 않는다. 그래서 worktree를 만들면 환경변수·시크릿·레지스트리 토큰이 통째로 사라진 채 세션이 시작된다. 이 스킬은 그 갭을 닫는다 — 병렬 에이전트가 같은 환경으로 바로 일할 수 있게.

동작

  1. SessionStart 훅이 자동 실행한다 (hooks/worktree-setup.sh). 설치만 하면 끝. opt-in 불필요.

  2. 메인 레포를 감지한다: CONDUCTOR_ROOT_PATHgit worktree list 첫 항목 순서.

  3. 메인 레포에서 다음 항목을 worktree 루트로 심볼릭 링크한다 (존재하면 skip, 멱등):

    기본 대상 타입 용도
    .env 파일 기본 환경변수
    .env.local 파일 로컬 오버라이드
    .env.development 파일 개발 환경
    .secret 디렉토리 시크릿 디렉토리 (SWK 컨벤션)
    .npmrc 파일 프라이빗 레지스트리 토큰

    .env.production기본 대상에서 제외한다. 운영 시크릿을 worktree에 노출하는 사고를 막기 위해 — 필요 시 worktree-sync.json에 명시.

  4. 이미 존재하는 파일·심링크는 절대 덮어쓰지 않는다. 재실행도 안전.

  5. 깨진 심링크 감지: worktree에 이미 심링크가 있지만 대상이 사라진 경우(예: 메인 레포에서 .env 삭제 후 worktree 심링크만 남음), 자동 교체는 하지 않고 stderr에 경고를 출력한다. 사용자가 readlink로 대상을 확인하고 수동 대응한다.

프로젝트별 오버라이드

프로젝트 루트에 .claude/worktree-sync.json을 두면 기본 대상을 교체한다:

{
  "links": [".env", ".env.local", "config/secrets.json", ".npmrc", ".envrc"]
}
  • 절대 경로(/...)는 무시된다.
  • 경로 세그먼트 ..(상위 디렉토리 이동)이 포함되면 무시된다. 단 파일명 안의 .. 문자열(예: .env..backup)은 허용된다.
  • 경로는 메인 레포 루트 기준의 상대 경로다.
  • links가 있으면 기본 5종 대신 이 목록만 사용한다 (교체 방식).

트리거 조건

  • 자동: SessionStart 훅이 매번 실행 (멱등)
  • 수동: 사용자가 /nova:worktree-setup 호출 시 즉시 재시도
  • 장애: 사용자가 "env 못 찾음", "시크릿 안 읽힘", ".env가 비었다"를 보고하면 worktree 상황을 의심하고 이 스킬의 동작을 확인한다

런타임 감지 체크리스트

사용자가 환경 문제를 보고할 때 확인할 것:

  1. git worktree list — 현재 메인 레포인지 worktree인지 확인
  2. ls -la .env .secret/ .npmrc — 심링크가 걸려있는지, 링크 대상이 존재하는지
  3. readlink -f .env (Linux) / readlink .env (macOS) — 링크 대상 경로 확인
  4. 메인 레포의 파일이 존재하는지 (.env 자체가 메인에도 없으면 링크 대상이 없음)

분기 ref 선택 (worktree.baseRef, CC v2.1.133+)

Claude Code v2.1.133부터 --worktree/EnterWorktree/agent-isolation 워크트리가 어느 ref에서 분기할지 settings.json worktree.baseRef로 명시 선택할 수 있다.

타임라인: v2.1.128에서 EnterWorktreeorigin/<default> 대신 로컬 HEAD에서 분기하도록 동작이 수정됐고(unpushed 커밋 누락 차단), v2.1.133에서 사용자가 head vs fresh를 명시 선택할 수 있는 설정이 도입됐다. v2.1.128~v2.1.132 구간에는 본 설정 자체가 없다.

Read the full file on GitHub · 101 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 First seen · 101 lines · 65 tokens per session scan B 14ec6a149eb4

Subscribe to this mod's changes

worktree-setup is a skill published in the GitHub repository TeamSPWK/nova (2 stars, last pushed 2d ago), licensed MIT. It adds 65 tokens to every session and 1,670 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

loopx-project

Use when connecting a repository or project goal document to LoopX, maintaining project-local goal state, refreshing stale dashboard status, syncing local projects into the shared global registry, or diagnosing LoopX CLI/PATH/status/history issues across multiple repos. For registering durable project materials such…

huangruiteng/loopx · 74 tokens

loopx-auto-research

Use when a LoopX worker is operating an auto-research lane, demo pane, frontier item, evidence packet, promotion/retirement decision, or visible tmux/Codex auto-research rehearsal. Identity must come from the LoopX role profile and quota/frontier packet; this skill only provides role-specific execution checklists…

huangruiteng/loopx · 79 tokens

loopx-material

Operate an explicitly activated LoopX Material Lifecycle for a connected project. Use for material-store inventory, lossless migration, candidate/archive transitions, exact-read-backed ranking, ranked-entry rebuilds, bounded Explore intake, owner-gated apply, rollback, and audit. Do not use for ordinary one-off…

huangruiteng/loopx · 74 tokens

loopx-benchmark

Use when a LoopX-managed goal runs, tracks, scores, or analyzes a benchmark experiment through benchmark-toolkit, including experiment-board rows, solver arms, integrity qualification, matched comparisons, or case insights. Do not use for casual benchmark discussion, ordinary software microbenchmarks, or eval mentions…

huangruiteng/loopx · 69 tokens

loopx-change-quality

Qualify the exact final diff for a LoopX-managed goal. Use when goal policy enables changequalityqualification, before a non-trivial delivery or merge, and when producing or repairing an exact-scope quality receipt. The workflow is language-neutral, permits at most one policy-authorized safe-fix pass, and never grants…

huangruiteng/loopx · 75 tokens

loopx-pr-program

Use when LoopX must manage a multi-PR or multi-MR delivery program across one or more repositories: inventory current change requests, reconcile new/merged/closed or retargeted work, preserve requirement and dependency priorities, maintain a roadmap document, or monitor material lifecycle/check/review changes over…

huangruiteng/loopx · 95 tokens