fix(git-worktree): auto-copy .env files when creating worktrees#27
Merged
kieranklaassen merged 2 commits intoEveryInc:mainfrom Dec 2, 2025
Merged
Conversation
Problem:
When Claude creates worktrees, it sometimes calls `git worktree add` directly
instead of using the worktree-manager.sh script. This means .env files don't
get copied to the new worktree, causing the app to fail on startup.
Solution:
1. Add copy_env_files() function to worktree-manager.sh that copies all .env*
files (except .env.example) from main repo to new worktree
2. Call copy_env_files() automatically during worktree creation
3. Add new 'copy-env' command to manually copy env files to existing worktrees
4. Update SKILL.md with CRITICAL section instructing Claude to NEVER call
git worktree add directly - always use the manager script
5. Update all code examples to use ${CLAUDE_PLUGIN_ROOT} for portability
6. Add troubleshooting section for missing .env files
Features:
- Automatically copies .env, .env.local, .env.test, etc.
- Skips .env.example (should be in git)
- Creates .backup if destination already exists
- New 'copy-env' command for manual copying to existing worktrees
Ari4ka
approved these changes
Nov 29, 2025
Ari4ka
approved these changes
Nov 29, 2025
Collaborator
|
Thanks! |
Ari4ka
approved these changes
Dec 2, 2025
Contributor
Author
Np, great work @kieranklaassen ! |
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 18, 2026
Graduated compression plan (Approach C) for non-Schelling instruction content across 28 review agents and top 5 skills. Three phases: category-name compression, enumeration+example compression, process compression -- each validated by ablation. Blocked on EveryInc#19+EveryInc#27 execution. Conservative post-EveryInc#19+EveryInc#27 savings estimate: ~15-20KB.
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 19, 2026
…egative-space agent optimization Classify all 28 review agents into Schelling tiers and apply graduated compression. T1 (8 agents): full negative-space rewrite (75% reduction). T2 (9 agents): graduated compression retaining load-bearing sections (27%). T3/T4 (11 agents): identity-only compression (3%). Total: 36,219 bytes saved (26% of 137,595B agent content). Ablation-validated on 4 agents spanning all tiers -- no quality regression. Unblocks EveryInc#18 Kolmogorov Compression.
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 19, 2026
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 19, 2026
Apply four compression patterns (category-name, enumeration, example, process) across 20 non-T1 review agents and 5 top skills. Graduated three-phase execution with ablation validation at each phase. Total: 90,771 bytes saved (33% of 273,888B instruction corpus). Combined with EveryInc#19+EveryInc#27: ~127KB total agent+skill reduction. Phase 1 (P1 category-name): 12,977B across 17 agents. Phase 2 (P2+P4 enum+example): 21,565B across 10 files. Phase 3 (P3 process): 57,812B across 11 files. Ablation noise floor calibrated at 0.47 composite (identical-content self-comparison), rendering the plan's 0.95 threshold unreachable with single-run evaluations. All scores within noise floor range. 762/764 tests pass (2 pre-existing resolve-base.sh failures).
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 21, 2026
Graduated compression plan (Approach C) for non-Schelling instruction content across 28 review agents and top 5 skills. Three phases: category-name compression, enumeration+example compression, process compression -- each validated by ablation. Blocked on EveryInc#19+EveryInc#27 execution. Conservative post-EveryInc#19+EveryInc#27 savings estimate: ~15-20KB.
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 21, 2026
…egative-space agent optimization Classify all 28 review agents into Schelling tiers and apply graduated compression. T1 (8 agents): full negative-space rewrite (75% reduction). T2 (9 agents): graduated compression retaining load-bearing sections (27%). T3/T4 (11 agents): identity-only compression (3%). Total: 36,219 bytes saved (26% of 137,595B agent content). Ablation-validated on 4 agents spanning all tiers -- no quality regression. Unblocks EveryInc#18 Kolmogorov Compression.
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 21, 2026
armstrongl
added a commit
to nuggylib/compound-engineering-plugin
that referenced
this pull request
Apr 21, 2026
Apply four compression patterns (category-name, enumeration, example, process) across 20 non-T1 review agents and 5 top skills. Graduated three-phase execution with ablation validation at each phase. Total: 90,771 bytes saved (33% of 273,888B instruction corpus). Combined with EveryInc#19+EveryInc#27: ~127KB total agent+skill reduction. Phase 1 (P1 category-name): 12,977B across 17 agents. Phase 2 (P2+P4 enum+example): 21,565B across 10 files. Phase 3 (P3 process): 57,812B across 11 files. Ablation noise floor calibrated at 0.47 composite (identical-content self-comparison), rendering the plan's 0.95 threshold unreachable with single-run evaluations. All scores within noise floor range. 762/764 tests pass (2 pre-existing resolve-base.sh failures).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a common issue where
.envfiles aren't automatically copied when creating git worktrees, causing development setup failures in new worktrees.Problem
When Claude Code users create worktrees using raw
git worktree addcommands (instead of the manager script), environment files are not copied over. This leads to:Solution
1. Enhanced SKILL.md documentation
Added a prominent "CRITICAL: Always Use the Manager Script" section that:
git worktree adddirectly2. Script already had the functionality
The
worktree-manager.shscript already included:copy_env_files()function that copies.env*filescreatecommandcopy-envcommand for existing worktrees that missed the copyThe issue was that the SKILL.md didn't make it clear enough that Claude MUST use the script, leading Claude to call raw git commands instead.
Changes
skills/git-worktree/SKILL.md- Added CRITICAL section, updated all examples to use script path, added troubleshooting section for missing env filesworktree-manager.sh- the functionality already existed)Testing
Verified that:
.env,.env.local,.env.testfilescopy-envcommand works for existing worktrees