verify-worktree-plugins
Verify Worktree Plugin Patches
After plugin updates, the worktree skills (compound-engineering git-worktree, superpowers using-git-worktrees) lose custom patches that tell Claude Code to launch new instances in worktree directories.
What This Checks
| Component | What's Verified |
|---|---|
| compound-engineering SKILL.md | "Claude Code + Worktree Working Directory" section |
| compound-engineering worktree-manager.sh | "Open a NEW Claude Code instance" banner after create |
| superpowers SKILL.md | "Launch Claude Code" in step 5 report |
| PreCompact hook | getWorktreeContext function for compaction survival |
Both marketplace and latest cache versions are checked.
Instructions
1. Run the verification script
bash ~/.claude/scripts/verify-worktree-plugins.sh
2. If any checks fail, re-apply patches
bash ~/.claude/scripts/verify-worktree-plugins.sh --patch
3. If the PreCompact hook is missing worktree detection
The --patch flag cannot auto-fix the TypeScript hook. Regenerate it manually:
The hook at ~/.claude/hooks/context-compression-hook.ts needs a getWorktreeContext() function that:
- Runs
git rev-parse --git-dirto detect if CWD is a worktree (path contains/worktrees/) - If yes, outputs branch, worktree path, and main repo path
- This output gets injected as a
<system-reminder>during compaction
Regenerate it with this structure:
import { execSync } from "node:child_process";
function getWorktreeContext(): string | null {
// Check git-dir for "/worktrees/" to detect worktree
// Return formatted context string with branch, path, main repo
// Return null if not in a worktree
}
// In main(): call getWorktreeContext() and console.log if non-null
4. Report results to the user
Show the verification output and note any files that needed patching.
Background
Claude Code's statusline, git context, and system prompt are set at launch time. Running cd in a Bash tool call does NOT change the process CWD. After auto-compact, Claude reverts to the launch directory's context. Each worktree needs its own Claude Code instance launched from that directory (cd /path && claude).
The worktree plugin patches ensure Claude always tells the user to open a new terminal and launch Claude Code from the worktree directory after creation.
When to Run
- After updating the
compound-engineeringplugin - After updating the
superpowersplugin - If worktree creation stops showing the "launch Claude Code" instructions
- Periodically as a sanity check
More from skinnyandbald/fish-skills
simplify-parallel
Run code simplification across entire codebase using parallel agents with automatic segmentation and coordination
38critic-review
Unified plan review — stack detection, Context7 staleness scan, multi-model counselors dispatch, and prioritized triage. Three modes: full pipeline (default), --dry-run (copyable prompt), --feedback (analyze external input).
35pr-resolution
Resolve PR review comments. Use when asked to fix PR feedback, given a PR URL, or on '/pr-resolution'.
34counselors
Fan out a prompt to multiple AI coding agents in parallel and synthesize their responses.
32capture-learning
Capture comprehensive problem-solving narratives from work sessions, documenting the journey of discovery
32ceo-briefing
Research any topic and produce a structured executive briefing optimized for rapid CEO decision-making.
30